LDAP Injection
Summary
Reports cluster around:
- ForgeRock OpenAM Webfinger CVE-2021-29156 LDAP injection enabling password-hash retrieval
- registration form with name field allowing LDAP filter chars
- DoS via LDAP filter injection in npm modules. Detection is mostly CVE-marker-driven; injection probing is similar to SQLi but rarer.
Top Affected Components / Targets
ForgeRock OpenAMLDAP-backed login formsActive Directory web interfacesnpm modules using LDAP filters
Common Attack Vectors
Inject *)(uid=* to escape filterSubmit (cn=*) to retrieve all entriesUse OpenAM Webfinger CVE payloadSubmit double quotes / parens to detect injection error
Common Payloads
*)(uid=**)(objectClass=*admin)(&)*)(|(uid=*))Webfinger: ?resource=acct:*@* (CVE-2021-29156)
Detection Strategy
CVE-2021-29156.
Submit double-quote / unbalanced parens to login / search params and parse responses for LDAP error codes (0x80005000, LDAPException).
Tip: Testing tools that run these checks in parallel across every discovered endpoint can cut the time required substantially compared to fully manual testing, as long as they confirm findings with more than one signal to keep the false-positive rate down.
False-Positive Notes
Rare bug class; require explicit LDAP error markers before flagging.
How to Test
Manual Testing Methodology
Here is a systematic approach to identifying LDAP Injection vulnerabilities in a target application.
Before testing, map all input vectors that could be affected. Identify parameters, headers, cookies, and request bodies that interact with the vulnerable component. A proxy such as Burp Suite or OWASP ZAP, paired with normal browsing of the target, is usually enough to build this list.
Send a legitimate request and record the normal response: status code, content length, response time, and any identifying tokens. This baseline matters because it's what you'll compare later responses against once payloads are involved.
Inject test payloads into each identified input vector one at a time. Start with benign detection payloads before escalating to anything that could actually trigger the vulnerability. For LDAP Injection specifically, submit LDAP-filter metacharacters (*, (, ), &, |) or XML structural characters (<, >, &, a crafted closing tag) into every parameter that feeds into a directory query or an XML document, testing both authentication-bypass-style payloads and structural injection.
Compare the response against your baseline, looking specifically for authentication bypassing unexpectedly, broader directory results than the query should return, or injected elements/attributes appearing in how the application subsequently processes the document.
Once a potential vulnerability is detected, confirm it with at least a few independent test cases to rule out coincidence. Document the exact request and response as proof. For LDAP Injection, a confirmed finding typically means showing that attacker-controlled input changes the application's behavior in a way that matters for security, not just that a payload was reflected somewhere harmless.
Real-World Impact
Real-World Impact
LDAP injection, XML injection, and related structured-syntax injection classes share the same shape as SQL injection but target a different query or document language: user input gets concatenated into an LDAP filter, an XML document, or another structured format without being escaped for that format's special characters, letting an attacker alter the structure the receiving parser sees rather than just its data.
LDAP injection specifically can let an attacker bypass authentication filters entirely (by injecting a filter that always evaluates true) or enumerate directory contents — usernames, group memberships, organizational structure — that should have required legitimate query permissions to see. XML injection can let an attacker add, modify, or spoof elements the application trusts, which is especially serious when those elements carry authorization-relevant data.
Both are less frequently reported than SQL or command injection simply because LDAP and raw XML query construction are less common than SQL in modern applications, but where they do exist, the exploitation pattern and severity are directly comparable.
Prevention & Remediation
Prevention and Secure Coding
Preventing LDAP Injection takes a defense-in-depth approach — no single control below is sufficient alone, but together they close off both the primary path and the most common bypasses.
Use the platform's parameterized/escaping API for the target syntax. Most LDAP and XML libraries provide a proper escaping function or parameterized filter-building API — use it instead of string concatenation, the same discipline as parameterized SQL.
Allowlist validate before it ever reaches the query. Restrict input feeding into a filter or document structure to an expected character set and length before it's used at all.
Least-privilege service accounts for the underlying directory or document store. An LDAP bind account or XML-processing service account scoped to only what it needs limits what a successful injection can actually reach.
Treat structural characters as forbidden, not something to sanitize away. Reject input containing syntax-significant characters for the target format (()&| for LDAP filters, <>& for raw XML construction) rather than trying to strip or escape them ad hoc.
Source reports
A sample of the disclosed HackerOne reports this playbook was synthesized from.