Skip to content

Commit 219476c

Browse files
committed
Adding KDF iteration count inventory filters.
1 parent ce3eabf commit 219476c

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Detects known weak KDf iteration counts (less than 100k and the count is statically known)
3+
* @id java/crypto_inventory_filters/known_weak_kdf_iteration_count
4+
* @kind problem
5+
*/
6+
7+
import java
8+
import experimental.Quantum.Language
9+
10+
from Crypto::KeyDerivationOperationNode op, Literal l
11+
where
12+
op.getIterationCount().asElement() = l and
13+
l.getValue().toInt() < 100000
14+
select op, "Key derivation operation configures iteration count below 100k: $@", l,
15+
l.getValue().toString()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @name Detects unknown KDf iteration counts
3+
* @id java/crypto_inventory_filters/unknown_kdf_iteration_count
4+
* @kind problem
5+
*/
6+
7+
import java
8+
import experimental.Quantum.Language
9+
10+
from Crypto::KeyDerivationOperationNode op, Element e, string msg
11+
where
12+
e = op.getIterationCount().asElement() and
13+
not e instanceof Literal and
14+
msg = "Key derivation operation with unknown iteration: $@"
15+
or
16+
not exists(op.getIterationCount()) and
17+
e = op.asElement() and
18+
msg = "Key derivation operation with no iteration configuration."
19+
select op, msg, e, e.toString()

0 commit comments

Comments
 (0)