@@ -54,10 +54,25 @@ private class ArrayUpdate extends Expr {
54
54
ma = this and
55
55
ma .getArgument ( 0 ) = array
56
56
|
57
- m .hasQualifiedName ( "java.io" , "InputStream" , "read" ) or
57
+ m .getAnOverride * ( ) .hasQualifiedName ( "java.io" , [ "InputStream" , "RandomAccessFile" ] , "read" ) or
58
+ m .getAnOverride * ( ) .hasQualifiedName ( "java.io" , "DataInput" , "readFully" ) or
58
59
m .hasQualifiedName ( "java.nio" , "ByteBuffer" , "get" ) or
59
60
m .hasQualifiedName ( "java.security" , "SecureRandom" , "nextBytes" ) or
60
- m .hasQualifiedName ( "java.util" , "Random" , "nextBytes" )
61
+ m .hasQualifiedName ( "java.util" , "Random" , "nextBytes" ) or
62
+ m .hasQualifiedName ( "java.util.zip" , "Inflater" , "inflate" ) or
63
+ m .hasQualifiedName ( "io.netty.buffer" , "ByteBuf" , "readBytes" ) or
64
+ m .getAnOverride * ( ) .hasQualifiedName ( "org.bouncycastle.crypto" , "Digest" , "doFinal" )
65
+ )
66
+ or
67
+ exists ( MethodAccess ma , Method m |
68
+ m = ma .getMethod ( ) and
69
+ ma = this and
70
+ ma .getArgument ( 1 ) = array
71
+ |
72
+ m .hasQualifiedName ( "org.apache.commons.io" , "IOUtils" , [ "read" , "readFully" ] ) or
73
+ m .hasQualifiedName ( "io.netty.buffer" , "ByteBuf" , "getBytes" ) or
74
+ m .hasQualifiedName ( "org.bouncycastle.crypto.generators" ,
75
+ any ( string s | s .matches ( "%BytesGenerator" ) ) , "generateBytes" )
61
76
)
62
77
}
63
78
@@ -95,17 +110,15 @@ private class StaticInitializationVectorSource extends DataFlow::Node {
95
110
}
96
111
97
112
/**
98
- * A sink that initializes a cipher for encryption with unsafe parameters.
113
+ * A sink that initializes a cipher with unsafe parameters.
99
114
*/
100
115
private class EncryptionInitializationSink extends DataFlow:: Node {
101
116
EncryptionInitializationSink ( ) {
102
- exists ( MethodAccess ma , Method m , FieldRead fr | m = ma .getMethod ( ) |
117
+ exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
103
118
m .hasQualifiedName ( "javax.crypto" , "Cipher" , "init" ) and
104
119
m .getParameterType ( 2 )
105
120
.( RefType )
106
121
.hasQualifiedName ( "java.security.spec" , "AlgorithmParameterSpec" ) and
107
- fr .getField ( ) .hasQualifiedName ( "javax.crypto" , "Cipher" , "ENCRYPT_MODE" ) and
108
- DataFlow:: localExprFlow ( fr , ma .getArgument ( 0 ) ) and
109
122
ma .getArgument ( 2 ) = this .asExpr ( )
110
123
)
111
124
}
0 commit comments