---
title: "CAPEC-136: LDAP Injection"
url: https://radicalnotion.ai/capec/capec-136
type: capec
description: "An attacker manipulates or crafts an LDAP query for the purpose of undermining the security of the target. Some applications use user input to create LDAP queries that are processed by an LDAP server. For example, a user might provide their username during authentication and the username might be inserted in an LDAP query during the authentication process. An attacker could use this input to inject additional commands into an LDAP query that could disclose sensitive information. For example, entering a * in the aforementioned query might return information about all users on the system. This attack is very similar to an SQL injection attack in that it manipulates a query to gather additional information or coerce a particular return value."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-136: LDAP Injection

- **Abstraction:** Standard
- **Status:** Draft
- **Typical severity:** High
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

An attacker manipulates or crafts an LDAP query for the purpose of undermining the security of the target. Some applications use user input to create LDAP queries that are processed by an LDAP server. For example, a user might provide their username during authentication and the username might be inserted in an LDAP query during the authentication process. An attacker could use this input to inject additional commands into an LDAP query that could disclose sensitive information. For example, entering a \* in the aforementioned query might return information about all users on the system. This attack is very similar to an SQL injection attack in that it manipulates a query to gather additional information or coerce a particular return value.

## Execution flow

### Step 1: Explore

\[Survey application\] The attacker takes an inventory of the entry points of the application.

- Spider web sites for all available links
- Sniff network communications with application using a utility such as WireShark.

### Step 2: Experiment

\[Determine user-controllable input susceptible to LDAP injection\] For each user-controllable input that the attacker suspects is vulnerable to LDAP injection, attempt to inject characters that have special meaning in LDAP (such as a single quote character, etc.). The goal is to create a LDAP query with an invalid syntax

- Use web browser to inject input through text fields or through HTTP GET parameters
- Use a web application debugging tool such as Tamper Data, TamperIE, WebScarab,etc. to modify HTTP POST parameters, hidden fields, non-freeform fields, or other HTTP header.
- Use modified client (modified by reverse engineering) to inject input.

### Step 3: Experiment

\[Try to exploit the LDAP injection vulnerability\] After determining that a given input is vulnerable to LDAP Injection, hypothesize what the underlying query looks like. Possibly using a tool, iteratively try to add logic to the query to extract information from the LDAP, or to modify or delete information in the LDAP.

- Add logic to the LDAP query to change the meaning of that command. Automated tools could be used to generate the LDAP injection strings.
- Use a web application debugging tool such as Tamper Data, TamperIE, WebScarab,etc. to modify HTTP POST parameters, hidden fields, non-freeform fields, or other HTTP header.

## Prerequisites

- The target application must accept a string as user input, fail to sanitize characters that have a special meaning in LDAP queries in the user input, and insert the user-supplied string in an LDAP query which is then processed.

## Skills required

- **Medium:** The attacker needs to have knowledge of LDAP, especially its query syntax.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Availability | Unreliable Execution | - |
| Integrity | Modify Data | - |
| Confidentiality | Read Data | - |
| Authorization | Execute Unauthorized Commands | Run Arbitrary Code |
| Accountability, Authentication, Authorization, Non-Repudiation | Gain Privileges | - |
| Access Control, Authorization | Bypass Protection Mechanism | - |

## Mitigations

- Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as LDAP content.
- Use of custom error pages - Attackers can glean information about the nature of queries from descriptive error messages. Input validation must be coupled with customized error pages that inform about an error without disclosing information about the LDAP or application.

## Example instances

PowerDNS before 2.9.18, when running with an LDAP backend, does not properly escape LDAP queries, which allows remote attackers to cause a denial of service (failure to answer ldap questions) and possibly conduct an LDAP injection attack. See also: CVE-2005-2301

## Related weaknesses (CWE)

- [CWE-20](https://radicalnotion.ai/cwe/cwe-20): Improper Input Validation
- [CWE-77](https://radicalnotion.ai/cwe/cwe-77): Improper Neutralization of Special Elements used in a Command
- [CWE-90](https://radicalnotion.ai/cwe/cwe-90): Improper Neutralization of Special Elements used in an LDAP Query

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-248](https://radicalnotion.ai/capec/capec-248) | Command Injection |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| WASC | LDAP Injection | 29 |
| OWASP Attacks | LDAP Injection | - |

## Frequently asked questions

### What is CAPEC-136?

An attacker manipulates or crafts an LDAP query for the purpose of undermining the security of the target. Some applications use user input to create LDAP queries that are processed by an LDAP server. For example, a user might provide their username during authentication and the username might be inserted in an LDAP query during the authentication process. An attacker could use this input to inject additional commands into an LDAP query that could disclose sensitive information. For example, entering a \* in the aforementioned query might return information about all users on the system. This attack is very similar to an SQL injection attack in that it manipulates a query to gather additional information or coerce a particular return value.

### How does a LDAP Injection attack work?

It typically unfolds over 3 phases. It begins with: \[Survey application\] The attacker takes an inventory of the entry points of the application.

### How do you prevent CAPEC-136?

Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as LDAP content.

### What weaknesses does CAPEC-136 target?

CAPEC-136 exploits 3 CWE weaknesses: CWE-20 (Improper Input Validation), CWE-77 (Improper Neutralization of Special Elements used in a Command) and CWE-90 (Improper Neutralization of Special Elements used in an LDAP Query).

### How severe is CAPEC-136?

MITRE rates CAPEC-136 as High severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/136.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-136). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
