Skip to content
OpenAdvisories
Medium · 5.5 CVE-2025-61911 EUVD-2025-33797GHSA-r7r6-cc7p-4v5mPYSEC-2026-1847

python-ldap has sanitization bypass in ldap.filter.escape_filter_chars

Published Oct 10, 2025 · Updated Oct 14, 2025 · Assigned by GitHub_M

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`.

Affected products

VendorProductAffectedFixed
python-ldap python-ldap < 3.4.5 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-ldap 3.4.5-1 —
Debian 13 python-ldap 3.4.4-1+deb13u1 —
Debian 12 python-ldap 3.4.3-2+deb12u1 —
ReleasePackageFixed inAdvisory
Ubuntu 25.10 python-ldap 3.4.4-1ubuntu0.25.10.1 USN-7828-1
Ubuntu 24.04 LTS python-ldap 3.4.4-1ubuntu0.24.04.1 USN-7828-1
Ubuntu 22.04 LTS python-ldap 3.2.0-4ubuntu7.2 USN-7828-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS python-ldap 3.2.0-4ubuntu2.1+esm1 USN-7828-1
Ubuntu Pro 18.04 LTS python-ldap 3.0.0-1ubuntu0.2+esm1 USN-7828-1
Ubuntu Pro 16.04 LTS python-ldap 2.4.22-0.1ubuntu0.1~esm1 USN-7828-1
ReleasePackageFixed inAdvisory
SLES 15 SP6 python-ldap 3.1.0-150100.3.5.1 SUSE-SU-2025:3714-1, SUSE-SU-2025:3695-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 python-ldap 3.4.4-160000.3.1 SUSE-SU-2026:20933-1
SLES 16.0 python-ldap 3.4.4-160000.3.1 SUSE-SU-2026:20933-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-ldap 3.4.5-1.1 openSUSE-SU-2025:15637-1
openSUSE Leap 16.0 python-ldap 3.4.4-160000.3.1 openSUSE-SU-2026:20421-1
openSUSE Leap 15.6 python-ldap 3.4.0-150400.3.3.1 SUSE-SU-2025:3714-1
ReleasePackageFixed inAdvisory
Alpine v3.24 py3-ldap 3.4.5-r0 —

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2 python-ldap 2.4.15-2.amzn2.0.7 ALAS2-2025-3083

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 python-ldap No fix yet —
Azure Linux 2 (CBL-Mariner) python-ldap No fix yet —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI python-ldap < 3.4.5 3.4.5 GHSA-r7r6-cc7p-4v5m

Advisories 8

References