CVE Professor
/
All CVEs
CVE-2026-141471

CVE-2026-141471 — Cesanta Mongoose — CWE-295

CRITICAL CVSS 9.1 Shodan

Mongoose is an embedded web server and network library. From 7.17 until 7.24, Mongoose's MG_TLS_BUILTIN client in src/tls_builtin.c can accept an attacker-controlled server certificate chain when configured with a single DER CA certificate and processing a peer-provided chain, because mg_tls_verify_cert_signature() can return a negative issuer-key parsing result that callers negate as though verification succeeded. A crafted issuer with the trusted CA subject and public-key bytes but an unparseable RSA encoding can pair with an attacker-self-signed leaf that is not signed by the trusted CA, allowing a redirected client connection to complete a TLS 1.3 handshake and exchange application data without the trusted CA private key. This issue is fixed in 7.24.

Mongoose is an embedded web server and network library. From 7.17 until 7.24, Mongoose's MG_TLS_BUILTIN client in src/tls_builtin.c can accept an attacker-controlled server certificate chain when configured with a single DER CA certificate and processing a peer-provided chain, because mg_tls_verify_cert_signature() can return a negative issuer-key parsing result that callers negate as though verification succeeded. A crafted issuer with the trusted CA subject and public-key bytes but an unparseable RSA encoding can pair with an attacker-self-signed leaf that is not signed by the trusted CA, allowing a redirected client connection to complete a TLS 1.3 handshake and exchange application data without the trusted CA private key. This issue is fixed in 7.24.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Attack Vector Network AV:N
Attack Complexity High AC:H
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality High C:H
Integrity High I:H
Availability None A:N
AI Security Analysis & Remediation

🎯 What is this vulnerability?

This vulnerability is a Critical TLS Certificate Verification Bypass in the Mongoose embedded web server library, specifically affecting the MG_TLS_BUILTIN client implementation.

The Technical Flaw:
The core issue lies in the error handling logic of the function mg_tls_verify_cert_signature() within src/tls_builtin.c. When Mongoose is configured to use a single DER-encoded CA certificate for peer verification, it attempts to parse the issuer's public key from the provided certificate chain.

1. Parsing Failure: If an attacker provides a certificate chain where the issuer certificate (which claims to be the trusted CA) contains an unparseable RSA public key encoding (e.g., malformed ASN.1 structure or invalid key bytes), the parsing routine fails.
2. Logic Error: The function mg_tls_verify_cert_signature() returns a negative value to indicate this parsing error.
3. Incorrect Negation: The calling code incorrectly interprets this negative return value. Instead of treating it as a fatal verification failure, the code negates the result (or checks for != 0 in a way that treats the error code as a success flag), effectively concluding that the signature verification succeeded.
4. Bypass: Consequently, the TLS handshake proceeds as if the peer's certificate chain was validly signed by the trusted CA, even though the cryptographic signature check was never actually performed or was impossible to perform due to the malformed key.

CWE-295 (Improper Certificate Validation): The system fails to properly validate the certificate chain, allowing an attacker to present a self-signed leaf certificate that is not signed by the trusted CA, paired with a crafted issuer certificate that triggers the parsing error.

⚡ Attack Chain

1. Discovery & Reconnaissance

  • Fingerprinting: The attacker identifies targets running applications that embed Mongoose (common in IoT devices, embedded systems, and lightweight microservices).
  • Version Enumeration: Using tools like nmap with SSL/TLS scripts or manual probing, the attacker determines the Mongoose version. The vulnerability affects versions 7.17 through 7.23.
  • Configuration Check: The attacker must confirm that the Mongoose client is configured with MG_TLS_BUILTIN and uses a single DER CA certificate for verification. This is a common configuration in embedded environments to minimize memory footprint.
  • 2. Exploitation

    The attacker performs a Man-in-the-Middle (MitM) attack. They intercept the TLS connection between the Mongoose client and the legitimate server.

    Prerequisites:

  • Attacker has network position to intercept traffic (e.g., same LAN, compromised router, or ARP spoofing).

  • Attacker has the public CA certificate (DER format) used by the Mongoose client.

  • Attacker generates a malicious certificate chain:

  • * Leaf Certificate: Self-signed by the attacker's private key. The Subject must match what the Mongoose client expects (or be ignored if hostname verification is weak/disabled).
    * Issuer Certificate: A crafted certificate where:
    * The Subject matches the Subject of the trusted CA.
    * The Public Key field contains malformed/unparseable RSA key bytes (e.g., truncated ASN.1, invalid modulus length, or garbage data).
    * The signature on this issuer certificate is irrelevant because the parser fails before signature verification.

    Illustrative PoC Concept (Python/OpenSSL):

    # Illustrative only - Actual crafting requires specific ASN.1 manipulation
    # 1. Extract CA Subject from trusted_ca.der
    # 2. Create a new X509 certificate:
    #    - Subject: <CA Subject>
    #    - Issuer: <CA Subject> (Self-signed issuer)
    #    - Public Key: b'\x00\x01\x02\x03' (Invalid RSA key bytes)
    # 3. Sign this issuer cert with attacker's key (signature is ignored due to parse error)
    # 4. Create Leaf Cert:
    #    - Subject: <Expected Hostname>
    #    - Issuer: <CA Subject>
    #    - Public Key: Attacker's valid RSA key
    #    - Signature: Attacker's private key
    # 5. Present [Leaf, Issuer] chain to Mongoose client

    Exploitation Step:
    1. Attacker intercepts the TCP connection.
    2. Attacker presents the malicious certificate chain during the TLS 1.3 handshake.
    3. Mongoose client attempts to verify the chain:
    * Parses Issuer Cert → Fails to parse RSA key → mg_tls_verify_cert_signature() returns negative error code.
    * Caller negates/checks error code incorrectly → Verification marked as SUCCESS.
    4. TLS handshake completes.
    5. Attacker and Mongoose client exchange application data over the encrypted channel.

    3. Post-Exploitation

  • Data Exfiltration: The attacker can read all data sent by the Mongoose client (e.g., sensor data, API keys, user credentials).
  • Data Injection: The attacker can inject malicious data into the stream, potentially leading to:
  • * Command injection if the client processes untrusted input. * State corruption in the embedded device. * Persistence if the attacker can modify firmware update payloads.
  • Lateral Movement: If the Mongoose client has access to internal network resources, the attacker can pivot using the compromised device's credentials or network position.
  • 🌍 Real World Impact

    CVSS 4.0 Vector Analysis:

  • AV:N (Network): Exploitable remotely over the network.

  • AC:H (High): Requires specific conditions (MitM position, specific Mongoose configuration with single DER CA).

  • AT:P (Passive): No user interaction required.

  • PR:N (None): No authentication required for the attacker to initiate the MitM.

  • UI:N (None): No user interaction.

  • VC:H (High): Confidentiality impact is high (all data in transit is exposed).

  • VI:H (High): Integrity impact is high (attacker can modify data in transit).

  • VA:N (None): No availability impact (service remains up).
  • Practical Consequences:

  • IoT Security Breach: Many IoT devices use Mongoose for secure communication. This vulnerability allows attackers to silently intercept and tamper with device communications, leading to unauthorized control of physical devices (e.g., smart locks, industrial controllers).

  • API Key Theft: If the Mongoose client transmits API keys or tokens, these can be stolen and reused.

  • Supply Chain Risk: If the Mongoose client is part of a larger system, compromised data can lead to broader system compromise.
  • 🛡️ Remediation & Mitigation

    1. Upgrade

  • Affected Versions: Mongoose 7.17 to 7.23.
  • Fixed Version: Mongoose 7.24.
  • Action: Immediately upgrade all instances of Mongoose to version 7.24 or later.
  • 2. Workarounds (If Immediate Upgrade is Not Possible)

  • Disable MG_TLS_BUILTIN: If possible, switch to a different TLS backend (e.g., OpenSSL, mbedTLS) that does not have this specific parsing bug.
  • Use Multiple CA Certificates: The vulnerability is triggered when configured with a single DER CA certificate. If the application logic allows, configure Mongoose to use a CA bundle (multiple certificates) or a different verification mode that may not trigger the same code path. Note: This is not a guaranteed fix and should be tested.*
  • Network Segmentation: Isolate Mongoose-based devices from untrusted networks. Use VLANs, firewalls, or MACsec to prevent MitM attacks.
  • Disable TLS Verification (Not Recommended): As a last resort, if the application can tolerate it, disable TLS verification entirely. This is highly discouraged as it exposes all traffic.
  • 3. Detection

  • Network Traffic Analysis: Look for TLS handshakes where the certificate chain contains an issuer certificate with an invalid or unparseable public key. Tools like Wireshark can be used to inspect TLS records.
  • Log Monitoring: Check Mongoose client logs for TLS verification errors. However, due to the bug, the error may be logged as a success. Look for unusual patterns in application logs (e.g., unexpected data from the server).
  • Certificate Transparency Logs: If the CA is public, check Certificate Transparency logs for any unexpected certificates issued with the CA's subject.
  • ModSecurity Rule (Illustrative - For Web Servers, Not Directly Applicable to Mongoose Client):
    Since Mongoose is an embedded library, WAF rules are not directly applicable. However, if the Mongoose client is behind a reverse proxy, ensure the proxy enforces strict TLS verification.

    ⚠️ Urgency

    Priority: CRITICAL

  • CVSS Score: 9.1 (Critical)
  • Exploitability: High. The vulnerability is well-understood and can be exploited with standard cryptographic tools. The main barrier is the need for a MitM position.
  • Impact: High. Complete compromise of confidentiality and integrity of TLS-secured communications.
  • CISA KEV: Not currently listed, but given the criticality and ease of exploitation in IoT environments, it is likely to be added.
  • Recommendation: Patch immediately. All Mongoose-based applications should be updated to version 7.24 or later. If immediate patching is not possible, implement network segmentation and monitor for MitM activity.
[🤖 CVE Professor AI Security Engine]
Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="Cesanta Mongoose"
CVSS Score
9.1 / 10 · CVSS CRITICAL
Weakness Types (CWE)
CWE-295
Affected Products (1)
Cesanta:Mongoose
References & Advisories (3)
Related CVEs
9.1
CVE-2026-144956
Hoverfly before 1.12.17 contains an improper certificate validation vulnerability in GetHttpClient in core/htt
8.4
CVE-2026-81133
Dell Secure Connect Gateway - Virtual Edition, versions prior to 5.36.00.16, contains an Improper Certificate
5.9
CVE-2026-52896
On affected platforms running Arista EOS with Streaming Telemetry Agent (TerminAttr) configured with gRPC tunn
9.1
CVE-2026-144304
Certifi versions before 2026.10.18 include the `emSign ECC Root CA - G3` root certificate in their bundled CA
7.4
CVE-2026-110481
Improper Certificate Validation vulnerability in Apache Camel Milo component. This issue affects Apache Cam
7.4
CVE-2026-115278
Improper Certificate Validation vulnerability in Apache Camel Vert.x components. This issue affects Apache
7.4
CVE-2026-132829
Improper Certificate Validation vulnerability in Apache Camel FTP component. This issue affects Apache Came