Skip to content

Commit 1a9bfb3

Browse files
committed
Correct barrier
1 parent bf9d0b9 commit 1a9bfb3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

go/ql/src/experimental/CWE-287/ImproperLdapAuth.ql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/**
2-
* @name LDAP query built from user-controlled sources
3-
* @description Building an LDAP query from user-controlled sources is vulnerable to insertion of
4-
* malicious LDAP code by the user.
2+
* @name Improper LDAP Authentication
3+
* @description A user-controlled query carries no authentication
54
* @kind path-problem
6-
* @problem.severity error
7-
* @id go/ldap-injection
5+
* @problem.severity warning
6+
* @id go/improper-ldap-auth
87
* @tags security
98
* experimental
10-
* external/cwe/cwe-90
9+
* external/cwe/cwe-287
1110
*/
1211

1312
import go

go/ql/src/experimental/CWE-287/ImproperLdapAuth.qll

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, LdapSanitizer { }
4545
private predicate equalityAsSanitizerGuard(DataFlow::Node g, Expr e, boolean outcome) {
4646
exists(DataFlow::Node passwd, DataFlow::EqualityTestNode eq |
4747
g = eq and
48-
exists(eq.getAnOperand().getStringValue()) and
4948
passwd = eq.getAnOperand() and
5049
e = passwd.asExpr() and
51-
outcome = true
50+
(
51+
eq.getAnOperand().getStringValue().length() > 0 and outcome = eq.getPolarity()
52+
or
53+
eq.getAnOperand().getStringValue().length() = 0 and
54+
outcome = eq.getPolarity().booleanNot()
55+
)
5256
)
5357
}
5458

@@ -64,7 +68,7 @@ class EqualityAsSanitizerGuard extends LdapSanitizer {
6468

6569
/**
6670
* A taint-tracking configuration for reasoning about when an `UntrustedFlowSource`
67-
* flows into an argument or field that is vulnerable to LDAP injection.
71+
* flows into an argument or field that is vulnerable to Improper LDAP Authentication.
6872
*/
6973
class ImproperLdapAuthConfiguration extends TaintTracking::Configuration {
7074
ImproperLdapAuthConfiguration() { this = "Improper LDAP Auth" }

0 commit comments

Comments
 (0)