/

CVE-2026-73253

Severity:

CRITICAL RISK

(9.1)

TLS Hostname Verification Bypass (CWE-295) in Mongoose

CVE-2026-73253

Analyzed

Vulnerability type

Category:

Improper Certificate Validation

CWE:

CWE-295

Impact:

TLS Traffic Interception and Modification

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Mongoose's built-in TLS stack may incorrectly accept a certificate for a deeper subdomain when a wildcard certificate covers only a parent domain. An on-path attacker with such a certificate could impersonate the intended host and intercept or modify encrypted client traffic.

Affected context

The issue occurs in Mongoose deployments that use the built-in TLS implementation for client-side certificate hostname verification. It becomes risky when certificate names containing wildcards are compared against hostnames without preserving DNS label boundaries, allowing a pattern such as *.example.com to match a deeper name such as foo.bar.example.com.

Exploit preconditions

  • Attack surface: Client-side TLS connections using Mongoose's built-in TLS stack
  • Required access: An on-path network position and control of, or access to, a valid wildcard certificate for a parent domain
  • Trigger point: Server hostname verification during TLS certificate validation
  • Why exploitation is possible: Wildcard matching may cross DNS label boundaries, causing a certificate that should not authorize a deeper subdomain to be accepted

Why this happens

The vulnerability results from hostname verification logic that uses a wildcard matching routine without enforcing DNS label-boundary restrictions. The mg_tls_verify_cert_san() and mg_tls_verify_cert_cn() functions rely on matching behavior that can treat a wildcard in a parent-domain position as covering multiple subdomain labels. This is an instance of CWE-295: Improper Certificate Validation, because the client may accept a certificate that does not correctly identify the requested host.

Potential impact

  • An attacker may impersonate a protected service
  • TLS traffic could be intercepted or modified
  • Credentials, tokens, or other sensitive data may be exposed
  • Clients could receive manipulated application responses
  • Affected connections may support follow-on attacks against dependent systems

General mitigation guidance

Mitigation generally focuses on enforcing standards-compliant hostname verification and preserving DNS label boundaries during wildcard comparison.

Common defensive patterns include:

  • Use TLS libraries and hostname-verification APIs that restrict wildcards to a single left-most DNS label
  • Avoid custom certificate matching logic where a platform-provided verifier is available
  • Treat both Subject Alternative Name and legacy Common Name checks consistently and securely
  • Prefer exact host authorization or narrowly scoped certificate names where operationally feasible
  • Limit client privileges and sensitive operations so a compromised TLS session has reduced impact
  • Apply certificate validation and trust-policy checks before exchanging application data

How teams detect issues like this

Organizations can identify related risks through:

  • Static analysis of certificate verification code for wildcard matching and unrestricted glob behavior
  • Code review checks covering DNS label boundaries, Subject Alternative Name handling, and Common Name fallback
  • TLS integration tests using parent-domain wildcards against one-level and multi-level subdomains
  • Policy enforcement requiring standardized hostname-verification APIs rather than generic pattern matchers
  • Network monitoring for unexpected certificate identities, trust changes, or suspicious interception indicators

Automated security review tools may help flag custom certificate validation and unsafe wildcard comparisons.

Sources

SourceLink
github.comgithub.com/cesanta/mongoose/commit/a9df523f76f43a38bd53b4232b9cfd4c16869e71
github.comgithub.com/cesanta/mongoose/pull/3611
github.comgithub.com/cesanta/mongoose/releases/tag/7.22
github.comgithub.com/cesanta/mongoose/security/advisories/GHSA-jp6g-796f-39vp

Frequently asked

questions

Exploitation generally requires an on-path network position, such as the ability to observe or interfere with traffic, plus a certificate that the vulnerable verifier incorrectly accepts.

No direct application authentication is necessarily required. The key conditions are a client using the affected TLS stack and an attacker capable of presenting an improperly matching certificate during connection establishment.

Use standards-compliant hostname verification that permits a wildcard to match only one DNS label, and prefer established platform or TLS-library verification APIs over custom wildcard matching.

Test certificate validation with nested subdomains, review wildcard semantics explicitly, enforce secure TLS policies in CI, and monitor for unexpected certificate identities in production.

Find out what's already
exploitable in your codebase.