Skip to content

Commit c799d8f

Browse files
committed
rsa-padding-set-scala
1 parent eaa0f21 commit c799d8f

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
weaken encryption. This could lead to sensitive data exposure. Instead,
7+
use RSA with `OAEPWithMD5AndMGF1Padding` instead.
8+
note: >-
9+
[CWE-780] Use of RSA Algorithm without OAEP
10+
[REFERENCES]
11+
- https://owasp.org/Top10/A02_2021-Cryptographic_Failures
12+
rule:
13+
any:
14+
- pattern: $CIPHER.getInstance($MODE)
15+
constraints:
16+
MODE:
17+
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)