Python: Add LDAP Insecure Authentication query#5445
Conversation
|
The intent of this PR, alerting when not using SSL/TLS for connecting to a remote LDAP server, looks good to me 👍 Without being an expert in this area, I think this should have a |
Great! I drafted it because it can be ported to
I agree ^^ |
…' into jorgectf/python/ldapinsecureauth
|
This PR is ready for code review 😃 @RasmusWL |
RasmusWL
left a comment
There was a problem hiding this comment.
Just took a quick glance at a few parts of the code (so not a full review by any means). I found a few minor things that I thought I might as well point out now.
|
I also think the |
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
My bad! Thanks for the suggestions, the |
|
Would it be possible to add qhelp to this query? I think that will help people to understand how to fix the bug. It's not obvious from the error message that the solution is to enable TLS. |
Of course, working on it now :) |
There was a problem hiding this comment.
Overall looks good 👍
I'm a bit worried that this query will not be able to flag See new comment below"ldap://" + os.getenv("LDAP_HOST"). I think you might be able to simplify your source definition to source.(StrConst).getText().matches("ldap://"), and then let the default taint steps take care of any form of string concatenation. Not sure if there is a good reason you didn't do this, would be happy to hear.
Besides that, a few minor things that could be improved (some of which probably fall into the nitpicky side of things)
python/ql/src/experimental/Security/CWE-522/LDAPInsecureAuth.qhelp
Outdated
Show resolved
Hide resolved
python/ql/src/experimental/Security/CWE-522/LDAPInsecureAuth.ql
Outdated
Show resolved
Hide resolved
python/ql/src/experimental/semmle/python/security/LDAPInsecureAuth.qll
Outdated
Show resolved
Hide resolved
python/ql/src/experimental/semmle/python/security/LDAPInsecureAuth.qll
Outdated
Show resolved
Hide resolved
python/ql/src/experimental/semmle/python/security/LDAPInsecureAuth.qll
Outdated
Show resolved
Hide resolved
It just dawned upon me that this is might be a bad suggestion, since this completely goes against your efforts on reducing FPs from private IPs such as |
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
It felt the right thing to do while reviewing Java's similar query 👍 |
Before it didn't really showcase that we know it can make connections secure.
|
Absolutely no problem @RasmusWL. Thank you for reviewing the PR and helping me as usual :D |
Any suggestions/tricks to improve the query or workarounds (to learn), no matter how minimal they are, are massively appreciated.