Skip to content

Commit 08c5476

Browse files
committed
Correct Ldap Unauth Bind Sink
1 parent d654e98 commit 08c5476

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,37 @@ abstract class LdapAuthSink extends DataFlow::Node { }
1818
abstract class LdapSanitizer extends DataFlow::Node { }
1919

2020
/**
21-
* A vulnerable argument to `go-ldap` or `ldap`'s `NewSearchRequest` function.
21+
* A vulnerable argument to `go-ldap` or `ldap`'s `bind` function (Only v2).
2222
*/
2323
private class GoLdapBindSink extends LdapAuthSink {
2424
GoLdapBindSink() {
2525
exists(Method meth, string base, string t, string m |
2626
t = ["Conn"] and
27-
meth.hasQualifiedName([
28-
"github.com/go-ldap/ldap", "github.com/go-ldap/ldap/v3", "gopkg.in/ldap.v2",
29-
"gopkg.in/ldap.v3"
30-
], t, m) and
27+
meth.hasQualifiedName(["gopkg.in/ldap.v2"], t, m) and
3128
this = meth.getACall().getArgument(1)
3229
|
3330
base = ["Bind"] and m = base
3431
)
3532
}
3633
}
3734

35+
/**
36+
* A vulnerable argument to `go-ldap` or `ldap`'s `UnauthenticatedBind` function (Only v3).
37+
*/
38+
private class GoLdapAnonymousBindSink extends LdapAuthSink {
39+
GoLdapAnonymousBindSink() {
40+
exists(Method meth, string base, string t, string m |
41+
t = ["Conn"] and
42+
meth.hasQualifiedName([
43+
"github.com/go-ldap/ldap", "github.com/go-ldap/ldap/v3", "gopkg.in/ldap.v3"
44+
], t, m) and
45+
this = meth.getACall().getArgument(0)
46+
|
47+
base = ["UnauthenticatedBind"] and m = base
48+
)
49+
}
50+
}
51+
3852
/**
3953
* A call to a regexp match function, considered as a barrier guard for sanitizing untrusted URLs.
4054
*

0 commit comments

Comments
 (0)