Skip to content

Commit 4853b8a

Browse files
committed
Try to finish the PR
- Add help documentation - Empty qll file - rename examples
1 parent 7166d54 commit 4853b8a

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<overview>
7+
8+
<p>The featured CodeQL query warns using of none algorithm in verify() functions imported from jsonwebtoken package developed by the auth0 organization.</p>
9+
10+
<p>Backend JavaScript applications handling JWT could be affected by the none algorithm misconfiguration due to misusing verify() functions imported by jsonwebtoken package.
11+
Providing an empty string or a false value, instead of a secret or a key, enable the none algorithm to decode JWT payloads without signature verification.
12+
Misconfigured backend JavaScript on a production environment could be impacted by exploitation violating the integration of a JWT.</p>
13+
</overview>
14+
15+
<recommendation>
16+
<p>
17+
verify() functions should use a secret or a key to decode JWT payloads.
18+
</p>
19+
<p>
20+
Use a a secret or a key to decode JWT payloads.
21+
</p>
22+
<p>
23+
</p>
24+
25+
</recommendation>
26+
27+
<example>
28+
<p>The example starts with a secret signing an object using the HS256 algorithm.
29+
In the second case an empty string is provided, then an undefined value, and finally a false value.
30+
These three misconfigued verify() functions is detected to be potentially a cybersecurity vulnerability.
31+
</p>
32+
<sample src="examples/JWTMissingSecretOrPublicKeyVerification.js" />
33+
34+
</example>
35+
36+
<references>
37+
<li>Auth0 Blog: <a href="https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/#Meet-the--None--Algorithm">Meet the "None" Algorithm</a>.</li>
38+
</references>
39+
</qhelp>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

javascript/ql/src/experimental/Security/CWE-347/examples/index.js renamed to javascript/ql/src/experimental/Security/CWE-347/examples/JWTMissingSecretOrPublicKeyVerification.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const jwt = require("jsonwebtoken");
22

33
const secret = "buybtc";
4-
4+
// #1
55
var token = jwt.sign({ foo: 'bar' }, secret, { algorithm: "HS256" }) // alg:HS256
66
jwt.verify(token, secret, { algorithms: ["HS256", "none"] }) // pass
7-
7+
// #2
88
var token = jwt.sign({ foo: 'bar' }, secret, { algorithm: "none" }) // alg:none (unsafe)
99
jwt.verify(token, "", { algorithms: ["HS256", "none"] }) // detected
1010
jwt.verify(token, undefined, { algorithms: ["HS256", "none"] }) // detected

0 commit comments

Comments
 (0)