-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Python: Add LDAP Insecure Authentication query #5445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes 👍 (apologies about it taking so long to review 😬)
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.