作为身份验证过程的一部分,我们根据用户输入的用户名和密码来构建System.DirectoryServices.DirectoryEntry
:
var de = new DirectoryEntry(ldapPathFromConfig, typedUserName, typedPassword, AuthenticationTypes.ReadonlyServer|AuthenticationTypes.Secure);
但是当我们通过Checkmarx运行代码时,它声称typedUserName
和typedPassword
上存在“ LDAP注入”漏洞,因为它们没有被清除。我不明白为什么,因为根据定义,密码可以是[[anything ...,并且constructor used显然是接受username
和password
作为第二个和第三个参数。
LDAP注入是常见的,就像SQL注入一样,而且我记得,没有像LDAP的Parametrization这样的解决方案(请参阅https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)。