logo

Database

Typescript Ssl Verification Bypass

Description

Detects code patterns that disable SSL/TLS certificate verification in TypeScript applications. This vulnerability allows applications to accept invalid SSL certificates, potentially enabling man-in-the-middle attacks where attackers can intercept and tamper with supposedly secure HTTPS communications.

Weakness:

313 - Insecure service configuration - Certificates

Category: Functionality Abuse

Detection Strategy

    Identifies usage of HTTPS, TLS or request modules by analyzing imports and module aliases

    Looks for configurations where certificate verification is disabled through properties like 'rejectUnauthorized: false'

    Examines HTTPS/TLS client configurations in module methods and request options

    Flags code that explicitly disables certificate validation or uses insecure verification settings

Vulnerable code example

import * as https from 'node:https';

const options = {
  hostname: 'example.com',
  port: 443,
  path: '/',
  method: 'GET',
  rejectUnauthorized: false  // VULNERABLE: Disables SSL certificate validation...

✅ Secure code example

import * as https from 'node:https';

const options = {
  hostname: 'example.com',
  port: 443,
  path: '/',
  method: 'GET',
  // Removed rejectUnauthorized: false to enable certificate validation...