Skip to content

Commit bed8a68

Browse files
committed
Exclude broken algorithms from the list of secure algorithms
1 parent 6b77922 commit bed8a68

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

java/ql/src/semmle/code/java/security/Encryption.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ string getAnInsecureAlgorithmName() {
9999
result = "RC5" or
100100
result = "ARCFOUR" or // a variant of RC4
101101
result = "ECB" or // encryption mode ECB like AES/ECB/NoPadding is vulnerable to replay and other attacks
102-
result = "AES/CBC/PKCS5Padding" // CBC mode of operation with PKCS#5 (or PKCS#7) padding is vulnerable to padding oracle attacks
102+
result = "AES/CBC/PKCS[5|7]Padding" // CBC mode of operation with PKCS#5 (or PKCS#7) padding is vulnerable to padding oracle attacks
103103
}
104104

105105
/**
@@ -141,7 +141,7 @@ string getASecureAlgorithmName() {
141141
result = "SHA512" or
142142
result = "CCM" or
143143
result = "GCM" or
144-
result = "AES" or
144+
result = "AES([^a-zA-Z](?!ECB|CBC/PKCS[5|7]Padding)).*" or
145145
result = "Blowfish" or
146146
result = "ECIES"
147147
}

java/ql/test/library-tests/Encryption/Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class Test {
1414
"AES/ECB/NoPadding",
1515
"AES/CBC/PKCS5Padding");
1616

17-
1817
List<String> goodStrings = Arrays.asList(
1918
"AES",
2019
"AES_function",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| Test.java:35:4:35:17 | super(...) | Test.java:35:10:35:15 | "some" |
2-
| Test.java:39:3:39:38 | getInstance(...) | Test.java:39:29:39:37 | "another" |
1+
| Test.java:37:4:37:17 | super(...) | Test.java:37:10:37:15 | "some" |
2+
| Test.java:41:3:41:38 | getInstance(...) | Test.java:41:29:41:37 | "another" |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| Test.java:16:4:16:8 | "AES" |
2-
| Test.java:17:4:17:17 | "AES_function" |
1+
| Test.java:18:4:18:8 | "AES" |
2+
| Test.java:19:4:19:17 | "AES_function" |

0 commit comments

Comments
 (0)