Skip to content

Commit ac0edaa

Browse files
committed
rsa-padding-set-scala
1 parent f182a4b commit ac0edaa

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
id: rsa-padding-set-scala
2+
language: scala
3+
severity: warning
4+
message: >-
5+
Usage of RSA without OAEP (Optimal Asymmetric Encryption Padding) may.
6+
note: >-
7+
[CWE-780] Use of RSA Algorithm without OAEP
8+
[REFERENCES]
9+
- https://owasp.org/Top10/A02_2021-Cryptographic_Failures
10+
rule:
11+
any:
12+
- pattern: $CIPHER.getInstance($MODE)
13+
constraints:
14+
MODE:
15+
regex: '.*RSA/.*/NoPadding.*'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
id: rsa-padding-set-scala
2+
snapshots:
3+
Cipher.getInstance("RSA/ECB/NoPadding"):
4+
labels:
5+
- source: Cipher.getInstance("RSA/ECB/NoPadding")
6+
style: primary
7+
start: 0
8+
end: 39
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
id: rsa-padding-set-scala
2+
valid:
3+
- |
4+
Cipher.getInstance("AES/CBC/PKCS5Padding");
5+
Cipher.getInstance("DES/ECB/PKCS5Padding");
6+
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
7+
invalid:
8+
- |
9+
Cipher.getInstance("RSA/ECB/NoPadding")

0 commit comments

Comments
 (0)