带有DirectoryEntry用户名和密码的LDAP注入漏洞?

问题描述 投票:0回答:1

作为身份验证过程的一部分,我们根据用户输入的用户名和密码来构建System.DirectoryServices.DirectoryEntry

    var de = new DirectoryEntry(ldapPathFromConfig, typedUserName, typedPassword, AuthenticationTypes.ReadonlyServer|AuthenticationTypes.Secure);

但是当我们通过Checkmarx运行代码时,它声称typedUserNametypedPassword上存在“ LDAP注入”漏洞,因为它们没有被清除。我不明白为什么,因为根据定义,密码可以是[[anything ...,并且constructor used显然是接受usernamepassword作为第二个和第三个参数。

c# ldap code-injection directoryservices checkmarx
1个回答
0
投票
对于Checkmarx,您应始终清除(验证)您使用的每个值。如果您不这样做,那么Checkmarx会将其视为不受信任的,顺便说一下,按照Checkmarx规则,这可能需要注入一些东西。就您而言,这是Checkmarx的正常发现。

LDAP注入是常见的,就像SQL注入一样,而且我记得,没有像LDAP的Parametrization这样的解决方案(请参阅https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html)。

© www.soinside.com 2019 - 2024. All rights reserved.