File tree 3 files changed +115
-0
lines changed
3 files changed +115
-0
lines changed Original file line number Diff line number Diff line change
1
+ id : use-of-blowfish-java
2
+ severity : warning
3
+ language : java
4
+ message : >-
5
+ 'Use of Blowfish was detected. Blowfish uses a 64-bit block size
6
+ that makes it vulnerable to birthday attacks, and is therefore considered
7
+ non-compliant. Instead, use a strong, secure cipher:
8
+ Cipher.getInstance("AES/CBC/PKCS7PADDING"). See
9
+ https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions
10
+ for more information.'
11
+ note : >-
12
+ [CWE-327] Use of a Broken or Risky Cryptographic Algorithm.
13
+ [REFERENCES]
14
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
15
+ - https://googleprojectzero.blogspot.com/2022/10/rc4-is-still-considered-harmful.html
16
+
17
+ ast-grep-essentials : true
18
+ rule :
19
+ kind : method_invocation
20
+ all :
21
+ - has :
22
+ kind : identifier
23
+ field : name
24
+ regex : ^getInstance$
25
+ nthChild :
26
+ position : 2
27
+ reverse : true
28
+ - has :
29
+ kind : argument_list
30
+ field : arguments
31
+ nthChild :
32
+ position : 1
33
+ reverse : true
34
+ has :
35
+ nthChild :
36
+ position : 1
37
+ ofRule :
38
+ not :
39
+ kind : line_comment
40
+ kind : string_literal
41
+ has :
42
+ kind : string_fragment
43
+ regex : ^Blowfish$
44
+ not :
45
+ has :
46
+ nthChild :
47
+ position : 2
48
+ ofRule :
49
+ not :
50
+ kind : line_comment
Original file line number Diff line number Diff line change
1
+ id : use-of-blowfish-java
2
+ snapshots :
3
+ ? |-
4
+ public void useofBlowfish2() {
5
+ Cipher.getInstance("Blowfish");
6
+ }
7
+ : labels :
8
+ - source : Cipher.getInstance("Blowfish")
9
+ style : primary
10
+ start : 31
11
+ end : 61
12
+ - source : getInstance
13
+ style : secondary
14
+ start : 38
15
+ end : 49
16
+ - source : Blowfish
17
+ style : secondary
18
+ start : 51
19
+ end : 59
20
+ - source : ' "Blowfish"'
21
+ style : secondary
22
+ start : 50
23
+ end : 60
24
+ - source : ("Blowfish")
25
+ style : secondary
26
+ start : 49
27
+ end : 61
28
+ ? |
29
+ public void useofBlowfish2() {
30
+ useCipher(Cipher.getInstance("Blowfish"));
31
+ }
32
+ : labels :
33
+ - source : Cipher.getInstance("Blowfish")
34
+ style : primary
35
+ start : 41
36
+ end : 71
37
+ - source : getInstance
38
+ style : secondary
39
+ start : 48
40
+ end : 59
41
+ - source : Blowfish
42
+ style : secondary
43
+ start : 61
44
+ end : 69
45
+ - source : ' "Blowfish"'
46
+ style : secondary
47
+ start : 60
48
+ end : 70
49
+ - source : ("Blowfish")
50
+ style : secondary
51
+ start : 59
52
+ end : 71
Original file line number Diff line number Diff line change
1
+ id : use-of-blowfish-java
2
+ valid :
3
+ - |
4
+ crypto.Cipher.getInstance("AES");
5
+ invalid :
6
+ - |
7
+ public void useofBlowfish2() {
8
+ useCipher(Cipher.getInstance("Blowfish"));
9
+ }
10
+ - |
11
+ public void useofBlowfish2() {
12
+ Cipher.getInstance("Blowfish");
13
+ }
You can’t perform that action at this time.
0 commit comments