LDAP injection
LDAP Injection is an attack used to exploit web based applications that construct LDAP statements based on user input. When an application fails to properly sanitize user input, it's possible to modify LDAP statements using a local proxy.
Summary
Exploitation
Example 1.
Example 2
Payloads
Blind Exploitation
We can extract using a bypass login
Defaults attributes
Can be used in an injection like *)(ATTRIBUTE_HERE=*
Exploiting userPassword attribute
userPassword
attribute is not a string like the cn
attribute for example but it’s an OCTET STRING In LDAP, every object, type, operator etc. is referenced by an OID : octetStringOrderingMatch (OID 2.5.13.18).
octetStringOrderingMatch (OID 2.5.13.18): An ordering matching rule that will perform a bit-by-bit comparison (in big endian ordering) of two octet string values until a difference is found. The first case in which a zero bit is found in one value but a one bit is found in another will cause the value with the zero bit to be considered less than the value with the one bit.
Scripts
Discover valid LDAP fields
Ref. [5][5]
Special blind LDAP injection (without "*")
Ref. [5][5]
References
SSH key authentication via LDAP
Last updated