Skip to content

Commit 86a06bd

Browse files
committed
JS: Flag crypto operations with weak block mode
1 parent e907d68 commit 86a06bd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/BrokenCryptoAlgorithmCustomizations.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ module BrokenCryptoAlgorithm {
4040
class WeakCryptographicOperationSink extends Sink {
4141
WeakCryptographicOperationSink() {
4242
exists(CryptographicOperation application |
43-
application.getAlgorithm().isWeak() and
43+
(
44+
application.getAlgorithm().isWeak()
45+
or
46+
application.getBlockMode().isWeak()
47+
) and
4448
this = application.getAnInput()
4549
)
4650
}

javascript/ql/test/query-tests/Security/CWE-327/BrokenCryptoAlgorithm.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,23 @@ nodes
1111
| tst.js:19:17:19:24 | password |
1212
| tst.js:19:17:19:24 | password |
1313
| tst.js:19:17:19:24 | password |
14+
| tst.js:22:21:22:30 | secretText |
15+
| tst.js:22:21:22:30 | secretText |
16+
| tst.js:22:21:22:30 | secretText |
1417
edges
1518
| tst.js:3:5:3:24 | secretText | tst.js:11:17:11:26 | secretText |
1619
| tst.js:3:5:3:24 | secretText | tst.js:11:17:11:26 | secretText |
20+
| tst.js:3:5:3:24 | secretText | tst.js:22:21:22:30 | secretText |
21+
| tst.js:3:5:3:24 | secretText | tst.js:22:21:22:30 | secretText |
1722
| tst.js:3:18:3:24 | trusted | tst.js:3:5:3:24 | secretText |
1823
| tst.js:3:18:3:24 | trusted | tst.js:3:5:3:24 | secretText |
1924
| tst.js:11:17:11:26 | secretText | tst.js:11:17:11:26 | secretText |
2025
| tst.js:17:17:17:25 | o.trusted | tst.js:17:17:17:25 | o.trusted |
2126
| tst.js:19:17:19:24 | password | tst.js:19:17:19:24 | password |
27+
| tst.js:22:21:22:30 | secretText | tst.js:22:21:22:30 | secretText |
2228
#select
2329
| tst.js:11:17:11:26 | secretText | tst.js:3:18:3:24 | trusted | tst.js:11:17:11:26 | secretText | A broken or weak cryptographic algorithm depends on $@. | tst.js:3:18:3:24 | trusted | sensitive data froman access to trusted |
2430
| tst.js:11:17:11:26 | secretText | tst.js:11:17:11:26 | secretText | tst.js:11:17:11:26 | secretText | A broken or weak cryptographic algorithm depends on $@. | tst.js:11:17:11:26 | secretText | sensitive data froman access to secretText |
2531
| tst.js:17:17:17:25 | o.trusted | tst.js:17:17:17:25 | o.trusted | tst.js:17:17:17:25 | o.trusted | A broken or weak cryptographic algorithm depends on $@. | tst.js:17:17:17:25 | o.trusted | sensitive data froman access to trusted |
32+
| tst.js:22:21:22:30 | secretText | tst.js:3:18:3:24 | trusted | tst.js:22:21:22:30 | secretText | A broken or weak cryptographic algorithm depends on $@. | tst.js:3:18:3:24 | trusted | sensitive data froman access to trusted |
33+
| tst.js:22:21:22:30 | secretText | tst.js:22:21:22:30 | secretText | tst.js:22:21:22:30 | secretText | A broken or weak cryptographic algorithm depends on $@. | tst.js:22:21:22:30 | secretText | sensitive data froman access to secretText |

0 commit comments

Comments
 (0)