LDAP injection
In computer security, LDAP injection is a code injection technique used to exploit web applications which could reveal sensitive user information or modify information represented in the LDAP (Lightweight Directory Access Protocol) data stores.[src] LDAP injection exploits a security vulnerability in an application by manipulating input parameters passed to internal search, add or modify functions.[src] When an application fails to properly sanitize user input, it is possible for an attacker to modify an LDAP statement.[src]
In computer security, LDAP injection is a code injection technique used to exploit web applications which could reveal sensitive user information or modify information represented in the LDAP (Lightweight Directory Access Protocol) data stores.[src] LDAP injection exploits a security vulnerability in an application by manipulating input parameters passed to internal search, add or modify functions.[src] When an application fails to properly sanitize user input, it is possible for an attacker to modify an LDAP statement.[src] ==Technical implementation== LDAP injection occurs when user input is not properly sanitized and then used as part of a dynamically generated LDAP filter.[src] This results in potential manipulation of the LDAP statements performed on the LDAP server to either view, modify, or bypass authentication credentials.[src] ==Prevention== LDAP injection is a known attack and can be prevented by simple measures.[src] All of the client supplied input must be checked/sanitized of any characters that may result in malicious behavior.[src] The input validation should verify the input by checking for the presence of special characters that are a part of the LDAP query language, known data types, legal values, etc.[src] White list input validation can also be used to detect unauthorized input before it is passed to the LDAP query.[src] ==Example== In the below example a query is constructed to validate a user's credentials for the purpose of logging in.[src] String filter = "(&(USER = " + user_name + ") (PASSWORD = " + user_password + "))"; In a typical use case, a user would provide their user credentials and this filter would be used to validate these credentials.[src] However, an attacker can enter a crafted input for the variable user_name such as johnDoe)(&) and any value for password.[src] The finished query will then become (&(USER = johnDoe)(&))(PASSWORD = pass)) .[src] Only the first portion of this query is processed by the LDAP server (&(USER = johnDoe)(&) , which always evaluates to true allowing the attacker to gain access to the system without needing to provide valid user credentials.[src] ==See also== SQL injection, a similar malicious attack method ==References==[src]
18 sentences · 18 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"LDAP injection." encyclopegia.org, 2026, https://encyclopegia.org/wiki/ldap-injection. Accessed 06 December 2026.
Chicago
"LDAP injection." encyclopegia.org. Accessed December 6, 2026. https://encyclopegia.org/wiki/ldap-injection.
APA
encyclopegia.org. (2026). LDAP injection. Retrieved December 6, 2026, from https://encyclopegia.org/wiki/ldap-injection
Accessed December 6, 2026 · CC BY-SA 4.0 · citation page · JSON