Correct barrier

This commit is contained in:
Maiky
2023-06-05 01:25:17 +02:00
parent bf9d0b93d7
commit 1a9bfb38aa
2 changed files with 12 additions and 9 deletions

View File

@@ -1,13 +1,12 @@
/**
* @name LDAP query built from user-controlled sources
* @description Building an LDAP query from user-controlled sources is vulnerable to insertion of
* malicious LDAP code by the user.
* @name Improper LDAP Authentication
* @description A user-controlled query carries no authentication
* @kind path-problem
* @problem.severity error
* @id go/ldap-injection
* @problem.severity warning
* @id go/improper-ldap-auth
* @tags security
* experimental
* external/cwe/cwe-90
* external/cwe/cwe-287
*/
import go

View File

@@ -45,10 +45,14 @@ class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, LdapSanitizer { }
private predicate equalityAsSanitizerGuard(DataFlow::Node g, Expr e, boolean outcome) {
exists(DataFlow::Node passwd, DataFlow::EqualityTestNode eq |
g = eq and
exists(eq.getAnOperand().getStringValue()) and
passwd = eq.getAnOperand() and
e = passwd.asExpr() and
outcome = true
(
eq.getAnOperand().getStringValue().length() > 0 and outcome = eq.getPolarity()
or
eq.getAnOperand().getStringValue().length() = 0 and
outcome = eq.getPolarity().booleanNot()
)
)
}
@@ -64,7 +68,7 @@ class EqualityAsSanitizerGuard extends LdapSanitizer {
/**
* A taint-tracking configuration for reasoning about when an `UntrustedFlowSource`
* flows into an argument or field that is vulnerable to LDAP injection.
* flows into an argument or field that is vulnerable to Improper LDAP Authentication.
*/
class ImproperLdapAuthConfiguration extends TaintTracking::Configuration {
ImproperLdapAuthConfiguration() { this = "Improper LDAP Auth" }