CVE-2022-29155

9.8 CRITICAL

📋 TL;DR

This CVE describes a SQL injection vulnerability in OpenLDAP's experimental back-sql backend. Attackers can execute arbitrary SQL commands via specially crafted LDAP search filters, potentially compromising the database. Only systems using the experimental back-sql backend are affected.

💻 Affected Systems

Products:
  • OpenLDAP
Versions: OpenLDAP 2.x before 2.5.12 and 2.6.x before 2.6.2
Operating Systems: All operating systems running affected OpenLDAP versions
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using the experimental back-sql backend (not enabled by default). Most OpenLDAP installations use standard backends and are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full database compromise allowing data theft, modification, or deletion; potential privilege escalation to underlying database server; complete system takeover if database has elevated privileges.

🟠

Likely Case

Unauthorized data access and extraction from the SQL database backend; potential data manipulation or deletion in affected tables.

🟢

If Mitigated

Limited impact due to restricted database permissions; only data accessible to the OpenLDAP service account is exposed.

🌐 Internet-Facing: HIGH if back-sql backend is exposed to internet; attackers can exploit without authentication.
🏢 Internal Only: MEDIUM if back-sql backend is used internally; requires network access but no authentication.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

SQL injection via LDAP search filters is straightforward for attackers familiar with both LDAP and SQL. Public exploit details are available in bug reports.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: OpenLDAP 2.5.12 or 2.6.2

Vendor Advisory: https://bugs.openldap.org/show_bug.cgi?id=9815

Restart Required: Yes

Instructions:

1. Update OpenLDAP to version 2.5.12 or 2.6.2. 2. Stop slapd service. 3. Install updated packages. 4. Restart slapd service. 5. Verify version with 'slapd -V'.

🔧 Temporary Workarounds

Disable back-sql backend

all

Remove or disable the experimental back-sql backend if not required

Comment out or remove back-sql configuration in slapd.conf or slapd.d

Restrict LDAP search permissions

all

Limit which users can perform LDAP search operations

Configure access controls in slapd to restrict search operations

🧯 If You Can't Patch

  • Disable the experimental back-sql backend entirely
  • Implement network segmentation to isolate OpenLDAP servers from untrusted networks

🔍 How to Verify

Check if Vulnerable:

Check if back-sql backend is configured and OpenLDAP version is below 2.5.12 or 2.6.2

Check Version:

slapd -V 2>/dev/null | grep -i 'openldap' || ldapsearch -x -H ldap://localhost -b '' -s base 'objectClass=*' vendorVersion 2>/dev/null

Verify Fix Applied:

Verify OpenLDAP version is 2.5.12 or higher (2.x) or 2.6.2 or higher (2.6.x)

📡 Detection & Monitoring

Log Indicators:

  • Unusual LDAP search patterns with SQL-like syntax
  • Multiple failed search attempts with complex filters
  • Unexpected database errors in OpenLDAP logs

Network Indicators:

  • LDAP search requests containing SQL keywords or special characters
  • Unusual traffic patterns to OpenLDAP port 389

SIEM Query:

source="openldap.log" AND ("sql" OR "select" OR "insert" OR "update" OR "delete") AND event="search"

🔗 References

📤 Share & Export