GHSA-r8wq-qrxc-hmcm: Python ldap Denial of Service Vulnerability

MODERATE
CVSS 6.5
CWE-1333
Published
Advisory Summary

GHSA-r8wq-qrxc-hmcm is a MODERATE (CVSS 6.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Python ldap libraries in the PyPI ecosystem. The issue involves redos in ldap schema parser. Remediation is available by upgrading affected packages to version 3.4.0.

GHSA-r8wq-qrxc-hmcm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-r8wq-qrxc-hmcm
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Python ldap
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-r8wq-qrxc-hmcm

To remediate this vulnerability, upgrade all affected Python ldap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

python-ldap fixed: 3.4.0
pip install python-ldap>=3.4.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show python-ldap

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-r8wq-qrxc-hmcm, inspect your installed packages using pip:

pip show python-ldap

Analyze the terminal output to locate any version of Python ldap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.4.0), your application is affected.

Note: The pip show python-ldap command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Python ldap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

https://github.com/python-ldap/python-ldap/issues/424 ### Impact The LDAP schema parser of python-ldap 3.3.1 and earlier are vulnerable to a regular expression denial-of-service attack. The issue affects clients that use ``ldap.schema`` package to parse LDAP schema definitions from an untrusted source. ### Patches The upcoming release of python-ldap 3.4.0 will contain a workaround to prevent ReDoS attacks. The schema parser refuses schema definitions with an excessive amount of backslashes. ### Workarounds As a workaround, users can check input for excessive amount of backslashes in schemas. More than a dozen backslashes per line are atypical. ### References [CWE-1333](https://cwe.mitre.org/data/definitions/1333.html) ### For more information If you have any questions or comments about this advisory: * Open an issue in [python-ldap](https://github.com/python-ldap/python-ldap) tracker

GHSA-r8wq-qrxc-hmcm Affected Python ldap Versions

1 component(s)
Fixed Versions:
3.4.0
Product / Package Ecosystem Affected Versions Fixed Version
python-ldap
PyPI
< 3.4.0
3.4.0

References

Frequently Asked Questions

What is GHSA-r8wq-qrxc-hmcm?
GHSA-r8wq-qrxc-hmcm is a security vulnerability in Python ldap involving ReDoS in LDAP schema parser under CWE-1333: Inefficient Regular Expression Complexity.
Which Python ldap versions are affected?
Affected versions include releases prior to 3.4.0 across affected packages: python-ldap.
What version fixes GHSA-r8wq-qrxc-hmcm?
Upgrading to 3.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is python-ldap affected?
Yes, python-ldap is affected in releases prior to 3.4.0. Upgrade your dependency to 3.4.0 or later.
What is the CVSS score of GHSA-r8wq-qrxc-hmcm?
GHSA-r8wq-qrxc-hmcm has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-r8wq-qrxc-hmcm?
GHSA-r8wq-qrxc-hmcm is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check PyPI dependencies for GHSA-r8wq-qrxc-hmcm?
Run the dependency tree command: 'pip show python-ldap'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r8wq-qrxc-hmcm",
  "modified" : "2021-11-26T18:26:27Z",
  "published" : "2021-11-29T17:58:59Z",
  "aliases" : [ ],
  "summary" : "ReDoS in LDAP schema parser",
  "details" : "https://github.com/python-ldap/python-ldap/issues/424\n\n### Impact\nThe LDAP schema parser of python-ldap 3.3.1 and earlier are vulnerable to a regular expression denial-of-service attack. The issue affects clients that use ``ldap.schema`` package to parse LDAP schema definitions from an untrusted source.\n\n### Patches\nThe upcoming release of python-ldap 3.4.0 will contain a workaround to prevent ReDoS attacks. The schema parser refuses schema definitions with an excessive amount of backslashes.\n\n### Workarounds\nAs a workaround, users can check input for excessive amount of backslashes in schemas. More than a dozen backslashes per line are atypical.\n\n### References\n[CWE-1333](https://cwe.mitre.org/data/definitions/1333.html)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [python-ldap](https://github.com/python-ldap/python-ldap) tracker\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "python-ldap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/python-ldap/python-ldap/security/advisories/GHSA-r8wq-qrxc-hmcm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/python-ldap/python-ldap/issues/424"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/python-ldap/python-ldap"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-26T18:26:27Z",
    "nvd_published_at" : null
  }
}