Skip to content

Commit 39a38c4

Browse files
committed
Rust: Tweak .qhelp layout.
1 parent bb4322c commit 39a38c4

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

rust/ql/src/queries/security/CWE-328/WeakSensitiveDataHashing.qhelp

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
<qhelp>
55
<overview>
66
<p>
7-
Using a broken or weak cryptographic hash function can leave data
7+
A broken or weak cryptographic hash function can leave data
88
vulnerable, and should not be used in security related code.
99
</p>
1010

1111
<p>
1212
A strong cryptographic hash function should be resistant to:
13+
<ul>
14+
<li>
15+
<b>Pre-image attacks</b>. If you know a hash value <code>h(x)</code>,
16+
you should not be able to easily find the input <code>x</code>.
17+
</li>
18+
<li>
19+
<b>Collision attacks</b>. If you know a hash value <code>h(x)</code>,
20+
you should not be able to easily find a different input
21+
<code>y</code>
22+
with the same hash value <code>h(x) = h(y)</code>.
23+
</li>
24+
<li>
25+
<b>Brute force</b>. For passwords and other data with limited
26+
input space, if you know a hash value <code>h(x)</code>
27+
you should not be able to find the input <code>x</code> even using
28+
a brute force attack (without significant computational effort).
29+
</li>
30+
</ul>
1331
</p>
14-
<ul>
15-
<li>
16-
<b>Pre-image attacks</b>. If you know a hash value <code>h(x)</code>,
17-
you should not be able to easily find the input <code>x</code>.
18-
</li>
19-
<li>
20-
<b>Collision attacks</b>. If you know a hash value <code>h(x)</code>,
21-
you should not be able to easily find a different input
22-
<code>y</code>
23-
with the same hash value <code>h(x) = h(y)</code>.
24-
</li>
25-
<li>
26-
<b>Brute force</b>. For passwords and other data with limited
27-
input space, if you know a hash value <code>h(x)</code>
28-
you should not be able to find the input <code>x</code> even using
29-
a brute force attack (without significant computational effort).
30-
</li>
31-
</ul>
3232

3333
<p>
3434
As an example, both MD5 and SHA-1 are known to be vulnerable to collision attacks.
@@ -51,18 +51,17 @@
5151

5252
<p>
5353
Ensure that you use a strong, modern cryptographic hash function, such as:
54+
<ul>
55+
<li>
56+
Argon2, scrypt, bcrypt, or PBKDF2 for passwords and other data with limited input space where
57+
a dictionary-like attack is feasible.
58+
</li>
59+
<li>
60+
SHA-2, or SHA-3 in other cases.
61+
</li>
62+
</ul>
5463
</p>
5564

56-
<ul>
57-
<li>
58-
Argon2, scrypt, bcrypt, or PBKDF2 for passwords and other data with limited input space where
59-
a dictionary-like attack is feasible.
60-
</li>
61-
<li>
62-
SHA-2, or SHA-3 in other cases.
63-
</li>
64-
</ul>
65-
6665
<p>
6766
Note that special purpose algorithms, which are used to ensure that a message comes from a
6867
particular sender, exist for message authentication. These algorithms should be used when
@@ -95,6 +94,8 @@
9594
<a href="https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Security_Cheat_Sheet.html">
9695
Transport Layer Security Cheat Sheet
9796
</a>
97+
</li>
98+
<li>
9899
GitHub:
99100
<a href="https://github.com/RustCrypto/hashes?tab=readme-ov-file#rustcrypto-hashes">
100101
RustCrypto: Hashes
@@ -103,11 +104,12 @@
103104
<a href="https://github.com/RustCrypto/password-hashes?tab=readme-ov-file#rustcrypto-password-hashes">
104105
RustCrypto: Password Hashes
105106
</a>
107+
</li>
108+
<li>
106109
The RustCrypto Book:
107110
<a href="https://rustcrypto.org/key-derivation/hashing-password.html">
108111
Password Hashing
109112
</a>
110-
111113
</li>
112114
</references>
113115

0 commit comments

Comments
 (0)