Apr 14, 2026·5 min read·15 visits
mitmproxy <= 12.2.1 is vulnerable to LDAP injection (CWE-90) in the proxyauth addon. Attackers can bypass proxy authentication by injecting malicious LDAP control characters into the username field. Fixed in version 12.2.2.
mitmproxy versions 12.2.1 and below contain a moderate severity LDAP injection vulnerability in the built-in proxyauth addon. When configured to use LDAP for proxy authentication, improper sanitization of the username field allows unauthenticated attackers to manipulate LDAP queries. This can lead to proxy authentication bypass and potential information disclosure.
The mitmproxy application provides an interception proxy utilized heavily by security researchers and developers for analyzing HTTP/HTTPS traffic. To restrict access to the proxy itself, administrators can enable the proxyauth addon. This addon supports multiple authentication backends, including an LDAP backend configured via the --proxyauth "ldap:..." command-line flag.
In mitmproxy versions 12.2.1 and earlier, the LDAP authentication mechanism fails to safely process user-supplied credentials before utilizing them in backend directory queries. Specifically, the application exhibits an Improper Neutralization of Special Elements used in an LDAP Query vulnerability, tracked as CWE-90.
Because the LDAP integration is not enabled by default, the vulnerability only affects instances where administrators have explicitly configured mitmproxy to authenticate users against a remote LDAP or Active Directory server. When this configuration is active, the proxy exposes an attack surface that processes unauthenticated external input directly into directory searches.
The vulnerability stems from the method mitmproxy uses to construct LDAP search filters within the mitmproxy/addons/proxyauth.py module. When an incoming HTTP request triggers proxy authentication, the application extracts the username from the Proxy-Authorization header and incorporates it into an LDAP search query to locate the corresponding user record.
The application code directly interpolates the user-controlled username string into the LDAP filter template without applying appropriate escaping mechanisms. RFC 4515 defines specific control characters used in LDAP string representations of search filters, including parentheses (), asterisks *, ampersands &, and vertical bars |.
By lacking a sanitization step using a standard LDAP escaping function (such as replacing ( with \28), the application permits these control characters to retain their syntactic meaning in the backend query. This allows an attacker to prematurely terminate the intended username attribute assertion and append arbitrary logical conditions to the broader search filter.
The vulnerability manifests in the Python code responsible for executing the LDAP bind and search operations. In the vulnerable implementation, the application relies on standard Python string formatting techniques to dynamically build the query string.
# Vulnerable pattern within proxyauth.py
# The username is directly interpolated without escaping
search_filter = "(&(uid={}))".format(username)Pull Request #6428 resolves this weakness by implementing proper input parameterization and escaping for the LDAP search filter key. The patched version invokes a dedicated escaping routine prior to query construction.
# Patched implementation using proper escaping (PR #6428)
from ldap3.utils.conv import escape_filter_chars
# Neutralize RFC 4515 control characters
safe_username = escape_filter_chars(username)
search_filter = "(&(uid={}))".format(safe_username)This remediation ensures that any special characters injected by the user are transformed into their corresponding hexadecimal escape sequences. Consequently, the LDAP server interprets the input strictly as literal string data for the target attribute, preventing modifications to the underlying boolean logic of the query.
Exploitation requires network access to the mitmproxy listener and the proxy authentication feature to be configured with the LDAP backend. The attacker initiates the exploit by sending an HTTP request containing a crafted Proxy-Authorization header. The payload targets the username field and leverages standard LDAP injection syntax.
Consider an application that constructs the following filter structure: (&(uid=USER_INPUT)(objectClass=person)). An attacker submits the username payload admin)(|(password=*. The application interpolates this payload, resulting in the expanded query: (&(uid=admin)(|(password=*)(objectClass=person))).
This manipulated query evaluates to true if the record with uid=admin exists, or if any record with a password attribute and objectClass=person exists. Depending on the backend LDAP server's handling of anonymous binds or default directory access controls, this boolean manipulation often results in a successful search response, thereby bypassing the proxy's authentication requirement.
The primary impact of this vulnerability is authentication bypass. An attacker successfully exploiting the LDAP injection flaw can route arbitrary HTTP/HTTPS traffic through the mitmproxy instance without possessing valid credentials. This undermines the intended access controls and exposes internal network segments if the proxy has routing access to private infrastructure.
Beyond simple bypass, the vulnerability presents a risk of unauthorized access via identity spoofing. If the attacker crafts an injection payload that forces the LDAP server to return a specific, highly privileged user record (e.g., an administrator account), the application may authenticate the session under that elevated identity.
Additionally, the injection point facilitates boolean inference attacks against the backend directory. An attacker can systematically extract information regarding the directory structure, valid usernames, and other attributes by submitting conditional payloads and observing whether the proxy grants or denies access based on the query's boolean result.
The definitive remediation for this vulnerability is updating mitmproxy to version 12.2.2 or higher. The release of version 12.2.2 on April 12, 2026, incorporates the fixes from PR #6428, ensuring all user input is strictly validated and escaped before interacting with the LDAP backend.
For environments unable to immediately deploy the patch, administrators must apply configuration-based workarounds. The most effective mitigation is disabling the proxyauth LDAP module entirely, transitioning to a local password file or an alternative, securely implemented authentication backend.
If the LDAP integration must remain active on a vulnerable version, network-level restrictions must be strictly enforced. Administrators should isolate the mitmproxy instance, ensuring that only trusted, internal IP addresses can reach the proxy listener. Additionally, monitoring LDAP server logs for queries containing unauthorized logical operators (*, (, ), &, |) can provide detective capabilities against active exploitation attempts.
| Product | Affected Versions | Fixed Version |
|---|---|---|
mitmproxy mitmproxy | <= 12.2.1 | 12.2.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-90 |
| Attack Vector | Network |
| Severity | Moderate |
| Impact | Authentication Bypass, Information Disclosure |
| Exploit Status | Proof of Concept available |
| Fixed Version | 12.2.2 |
Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection')
An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.
CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.
CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.
The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.
CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.
An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.