new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

OWASP Cheat Sheets · all subjects

injection/ldap_injection

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

LDAP special characters in Distinguished Names

LDAP Distinguished Names (DN) have special characters that must be escaped: backslash, hash, plus, less-than, greater-than, comma, semicolon, double-quote, equals, and leading or trailing spaces. Each DN points to exactly one entry with one or more attributes. Example DN: cn=Richard Feynman, ou=Physics Department, dc=Caltech, dc=edu

LDAP search filters use prefix notation

LDAP search filters are written in Polish notation (prefix notation) and use standard boolean logic to search for users with certain attributes. Example: (&(ou=Physics)(|(manager=cn=Freeman Dyson,ou=Physics,dc=Caltech,dc=edu)(manager=cn=Albert Einstein,ou=Physics,dc=Princeton,dc=edu)))

LDAP escaping types: Search filter vs DN

There are two forms of LDAP escaping. Encoding for LDAP Search is used when sanitizing input for a search filter. Encoding for LDAP DN (Distinguished Name) is used when using a DN as a username-like credential for accessing resources. The proper escaping depends on whether input is for a search filter or DN.

Java LDAP DN escaping implementation

Java LDAP DN escaping must handle meta characters from RFC 2253 and JNDI: +, ", <, >, ;, /. The backslash character is both a Java and LDAP escape character and must be escaped first. Positional characters (# at start, spaces at start/end) require special handling per RFC 2253.

Java LDAP search filter escaping implementation

Java LDAP search filter escaping from RFC 2254 must escape: backslash to \5c, asterisk to \2a, open parenthesis to \28, close parenthesis to \29, and null byte to \00.

Give your agent this brain