Miggo Logo

CVE-2025-61911: python-ldap has sanitization bypass in ldap.filter.escape_filter_chars

N/A

CVSS Score

Basic Information

EPSS Score
-
Published
10/10/2025
Updated
10/10/2025
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
python-ldappip< 3.4.53.4.5

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the ldap.filter.escape_filter_chars function, which fails to properly sanitize input when it's a list or dictionary and escape_mode is set to 1. The provided security advisory and commit patch directly point to this function as the source of the vulnerability. The patch adds a type check to ensure the input is a string, thus preventing the type confusion that leads to the sanitization bypass. The evidence from the commit 3957526fb1852e84b90f423d9fef34c7af25b85a clearly shows the addition of this type check in Lib/ldap/filter.py as the fix. Therefore, escape_filter_chars is the function that would appear in a runtime profile during the exploitation of this vulnerability.

Vulnerable functions

escape_filter_chars
Lib/ldap/filter.py
The function `escape_filter_chars` in the `ldap.filter` module is vulnerable to a sanitization bypass. When `escape_mode=1` is configured, and the `assertion_value` parameter is a list or a dictionary instead of a string, the function fails to escape special LDAP filter characters. This allows an attacker to inject malicious filter strings, potentially leading to an LDAP injection attack. The patch mitigates this by adding a type check at the beginning of the function to ensure that the `assertion_value` is a string.

WAF Protection Rules

WAF Rule

### Summ*ry T** s*nitiz*tion m*t*o* `l**p.*ilt*r.*s**p*_*ilt*r_***rs` **n ** tri*k** to skip *s**pin* o* sp**i*l ***r**t*rs w**n * *r**t** `list` or `*i*t` is suppli** *s t** `*ss*rtion_v*lu*` p*r*m*t*r, *n* t** non-****ult `*s**p*_mo**=*` is *on*i*u

Reasoning

T** vuln*r**ility li*s in t** `l**p.*ilt*r.*s**p*_*ilt*r_***rs` *un*tion, w*i** **ils to prop*rly s*nitiz* input w**n it's * list or *i*tion*ry *n* `*s**p*_mo**` is s*t to *. T** provi*** s**urity **visory *n* *ommit p*t** *ir**tly point to t*is *un*