LDAP Injection is an attack used to exploit web based applications that construct LDAP statements based on user input. The main way LDAP stores names is based on DN (distinguished name) These are sometimes used to access resources, like a username. The proper escaping depends on whether you are sanitizing input for a search filter, or you are using a DN as a username-like credential for accessing some resource. Use a framework (like LINQtoLDAP that escapes automatically)”]
Source: https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html

