Skip to content

Commit 63bd323

Browse files
committed
Improve qhelp
1 parent 7e45649 commit 63bd323

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
<overview>
6+
<p>If an LDAP query is built using string concatenation or string formatting, and it doesn't carry any kind of authentication,
7+
anonymous binds causes an empty or None-set password to result in a successful authentication.</p>
8+
</overview>
9+
10+
<recommendation>
11+
<p>Use a strong password while establishing a LDAP connection to execute a query a user controls.</p>
12+
</recommendation>
13+
14+
<example>
15+
<p>In the following examples, the code accepts both <code>username</code> and <code>dc</code> from the user,
16+
which it then uses to build a LDAP query and DN while the connection carries no authentication or binds anonymously.</p>
17+
18+
<sample src="examples/auth_bad_2.py" />
19+
<sample src="examples/auth_bad_3.py" />
20+
21+
<p>In the third and fourth examples, the authentication is established using a password from a secure source such as environment variables.</p>
22+
23+
<sample src="examples/auth_good_2.py" />
24+
<sample src="examples/auth_good_3.py" />
25+
</example>
26+
27+
<references>
28+
<li>SonarSource: <a href="https://rules.sonarsource.com/python/type/Vulnerability/RSPEC-4433">RSPEC-4433</a>.</li>
29+
<li>Python2: <a href="https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html">LDAP Documentation</a>.</li>
30+
<li>Python3: <a href="https://ldap3.readthedocs.io/en/latest/">LDAP Documentation</a>.</li>
31+
</references>
32+
</qhelp>

python/ql/src/experimental/Security/CWE-287/LDAPImproperAuth.qhelp

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)