CVE-2026-40606
Python vulnerability analysis and mitigation

Overview

CVE-2026-40606 is an LDAP Injection vulnerability in mitmproxy's built-in LDAP proxy authentication that allows a malicious client to bypass authentication by crafting a specially formed username. It affects mitmproxy versions 12.2.1 and below; only instances configured with the proxyauth option using LDAP are impacted, and this option is not enabled by default. The vulnerability was initially reported on 2025-12-08, verified on 2025-12-09, and publicly disclosed with a patch on 2026-04-12. It carries a CVSS v3.1 base score of 4.8 (Medium) (GitHub Advisory, Red Hat CVE).

Technical details

The root cause is improper neutralization of special elements used in LDAP queries (CWE-90 / LDAP Injection, CAPEC-136). When mitmproxy's built-in proxy authentication is configured to use LDAP, the username supplied by a connecting client is incorporated into an LDAP query without adequate sanitization. An attacker can inject LDAP special characters (e.g., *, (, ), \, NUL) into the username field to manipulate the query logic and cause the LDAP server to return a successful authentication result for an otherwise unauthorized user. Exploitation requires that the target mitmproxy instance has the proxyauth option explicitly configured with an LDAP backend, which is a non-default configuration (GitHub Advisory).

Impact

Successful exploitation allows an unauthenticated or unauthorized client to bypass LDAP-based proxy authentication on affected mitmproxy instances, gaining unauthorized access to the proxy and any traffic routed through it. This can expose proxied HTTP/TLS traffic to interception or manipulation, undermine security controls that rely on LDAP authentication, and potentially allow attackers to use the proxy as a pivot point. Confidentiality and integrity impacts are rated Low; there is no availability impact (GitHub Advisory, Red Hat CVE).

Exploitability

As of the time of disclosure, there is no public proof-of-concept exploit and no evidence of active in-the-wild exploitation. The vulnerability has an EPSS score of approximately 0.035%, reflecting low near-term exploitation probability. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Exploitation is constrained by the requirement that the target must have LDAP-based proxyauth explicitly configured, raising the effective attack complexity (GitHub Advisory, Feedly).

Exploitation steps

  1. Reconnaissance: Identify mitmproxy instances exposed on the network (e.g., via port scanning for common proxy ports such as 8080 or 8443) and confirm they require proxy authentication, indicating a proxyauth configuration.
  2. Probe authentication type: Attempt a proxy connection and observe the authentication challenge; LDAP-backed instances will respond with a Proxy-Authenticate header requiring credentials.
  3. Craft malicious username: Construct a username containing LDAP special characters designed to manipulate the LDAP filter logic — for example, using a wildcard or filter-breaking sequence such as *)(uid=*))(|(uid=* to cause the LDAP query to match any user.
  4. Send crafted credentials: Submit the malicious username (with any password) as proxy credentials in the Proxy-Authorization header of an HTTP CONNECT or standard proxy request.
  5. Bypass authentication: If the injected LDAP query evaluates to true on the server, mitmproxy grants proxy access without valid credentials, allowing the attacker to route traffic through the proxy (GitHub Advisory).

Indicators of compromise

  • Network: Proxy authentication requests (HTTP CONNECT or standard proxy requests) containing usernames with LDAP special characters such as *, (, ), \, or null bytes in the Proxy-Authorization header.
  • Logs: mitmproxy access logs showing successful proxy authentications from unexpected source IPs or with usernames containing special characters; authentication successes that do not correspond to known LDAP user accounts.
  • Logs: LDAP server query logs showing malformed or unexpected filter expressions originating from the mitmproxy host, particularly filters with wildcard or injected logic operators.
  • Process/Behavior: Unusual or unauthorized traffic being routed through the mitmproxy instance from clients that should not have proxy access.

Mitigation and workarounds

Upgrade mitmproxy to version 12.2.2 or later, which contains the fix for this vulnerability (GitHub Advisory). If immediate patching is not feasible, disable the proxyauth LDAP option until the upgrade can be completed, or restrict network access to the proxy port to trusted clients only. Review mitmproxy access logs for suspicious authentication attempts that may indicate exploitation. Note that instances not using the proxyauth option with LDAP are not affected.

Community reactions

The vulnerability was responsibly disclosed by researcher Yue (Knox) Liu (@yueyueL) to the mitmproxy team, who coordinated a patch release approximately four months after the initial report. The mitmproxy maintainer (mhils) published the advisory alongside the 12.2.2 patch release on 2026-04-12. No significant broader media coverage or notable community controversy has been observed, consistent with the moderate severity rating and non-default affected configuration (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-52776HIGH8.6
  • Python logoPython
  • compliance-trestle
NoYesAug 12, 2026
CVE-2026-55071HIGH8.4
  • Python logoPython
  • stata-mcp
NoYesAug 12, 2026
CVE-2026-73498HIGH7.7
  • Python logoPython
  • mcp-atlassian
NoYesAug 12, 2026
CVE-2026-55074HIGH7.3
  • Python logoPython
  • ansible-jailexec
NoYesAug 12, 2026
CVE-2026-9318MEDIUM4.8
  • Python logoPython
  • taglib
NoYesAug 12, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management