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

> Attackers can bypass LDAP filter sanitization in python-ldap to inject queries and access or modify unauthorized directory data.

- **Severity:** Medium 5.5 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Oct 2025
- **Updated:** 14 Oct 2025
- **Also known as:** AZL-68430, AZL-68451, DEBIAN-CVE-2025-61911, ECHO-f6d8-9d6f-c927, GHSA-r7r6-cc7p-4v5m, OESA-2025-2683, PYSEC-2026-1847, UBUNTU-CVE-2025-61911

## What is CVE-2025-61911?

CVE-2025-61911 is a medium-severity vulnerability in python-ldap, published on 10 Oct 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

python-ldap is a lightweight directory access protocol (LDAP) client API for Python. In versions prior to 3.4.5, the sanitization method `ldap.filter.escape_filter_chars` can be tricked to skip escaping of special characters when a crafted `list` or `dict` is supplied as the `assertion_value` parameter, and the non-default `escape_mode=1` is configured. The method `ldap.filter.escape_filter_chars` supports 3 different escaping modes. `escape_mode=0` (default) and `escape_mode=2` happen to raise exceptions when a `list` or `dict` object is supplied as the `assertion_value` parameter. However, `escape_mode=1` computes without performing adequate logic to ensure a fully escaped return value. If an application relies on the vulnerable method in the `python-ldap` library to escape untrusted user input, an attacker might be able to abuse the vulnerability to launch ldap injection attacks which could potentially disclose or manipulate ldap data meant to be inaccessible to them. Version 3.4.5 fixes the issue by adding a type check at the start of the `ldap.filter.escape_filter_chars` method to raise an exception when the supplied `assertion_value` parameter is not of type `str`.

Weakness: CWE-843 (Access of Resource Using Incompatible Type), CWE-75 (Failure to Sanitize Special Elements into a Different Plane)

## Which versions are affected by CVE-2025-61911?

3 open source packages ship an affected version, including python-ldap. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python-ldap` | PyPI | All versions | 3.4.5 |
| `python-ldap` | PyPI | All versions | 3.4.5 |
| `python-ldap` | PyPI | All versions | 3.4.5 |

Products: Python-Ldap Python-Ldap.

## How do I fix CVE-2025-61911?

Upgrade python-ldap to 3.4.5 or later.

## Is CVE-2025-61911 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-61911 exists.

## Other vulnerabilities in python-ldap

- [CVE-2021-46823](https://insights.sbomify.com/CVE-2021-46823/): Denial of Service in python-ldap (medium 6.5)
- [CVE-2025-61912](https://insights.sbomify.com/CVE-2025-61912/): python-ldap Vulnerable to Improper Encoding or Escaping of Output and Improper Null Termination (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-61911 and fix it if it is affected.

What it is: CVE-2025-61911 is a medium-severity vulnerability in python-ldap, published on 10 Oct 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-61911 exists.

Affected packages and fixed versions:
- python-ldap (PyPI): affected all versions; fixed in 3.4.5
- python-ldap (PyPI): affected all versions; fixed in 3.4.5
- python-ldap (PyPI): affected all versions; fixed in 3.4.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-61911/ (Markdown: https://insights.sbomify.com/CVE-2025-61911/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-61911
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-61911
- OSV: https://osv.dev/vulnerability/CVE-2025-61911

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-61911/
Summaries are generated and may contain mistakes; the official description above is the record.
