scanrub
LDAP Injectionmedium prioritynot yet scanned

LDAP Injection

2 min read 5 reports analyzed ScanRub Research
Share

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.
◈ flow diagram
User InputLDAP Filter …Structural I…Query or Doc…Bypass or Da…

Top Affected Components / Targets

  • ForgeRock OpenAM
  • LDAP-backed login forms
  • Active Directory web interfaces
  • npm modules using LDAP filters

Common Attack Vectors

  • Inject *)(uid=* to escape filter
  • Submit (cn=*) to retrieve all entries
  • Use OpenAM Webfinger CVE payload
  • Submit double quotes / parens to detect injection error

Common Payloads

  • *)(uid=*
  • *)(objectClass=*
  • admin)(&)
  • *)(|(uid=*))
  • Webfinger: ?resource=acct:*@* (CVE-2021-29156)

Detection Strategy

Stage 1: CVE marker via Nuclei

CVE-2021-29156.

Stage 2: LDAP-error probe

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.

Step 1: Reconnaissance and Surface Mapping

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.

Step 2: Baseline Request

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.

Step 3: Payload Injection

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.

Step 4: Response Analysis

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.

Step 5: Confirmation

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.

Frequently Asked Questions

What is LDAP Injection?
Reports cluster around: (1) ForgeRock OpenAM Webfinger CVE-2021-29156 LDAP injection enabling password-hash retrieval; (2) registration form with name field allowing LDAP filter chars; (3) DoS via LDAP filter injection in npm modules.
How common is LDAP Injection in bug bounty reports?
Scanrub's research corpus for this playbook is built from 5 disclosed HackerOne reports in this category, synthesized for detection and prevention guidance rather than reproduced verbatim.
How do I test for LDAP Injection?
Map every input vector, record a baseline response, then inject targeted test payloads one field at a time and compare the response for timing, length, error, or reflection differences from that baseline. The "How to Test" section above walks through the full methodology for this specific vulnerability class.
What is the single most effective fix for LDAP Injection?
Build LDAP filters and XML documents through the platform's parameterized or escaping API, never by concatenating raw user input into the query/document structure.
Weekly security research

New vulnerability playbooks, tool updates, and bug bounty insights - delivered to your inbox. No spam.

Unsubscribe anytime. We respect your inbox.
Press ⌘K to search×