@@ -54,10 +54,25 @@ private class ArrayUpdate extends Expr {
5454 ma = this and
5555 ma .getArgument ( 0 ) = array
5656 |
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
5859 m .hasQualifiedName ( "java.nio" , "ByteBuffer" , "get" ) or
5960 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" )
6176 )
6277 }
6378
@@ -95,17 +110,15 @@ private class StaticInitializationVectorSource extends DataFlow::Node {
95110}
96111
97112/**
98- * A sink that initializes a cipher for encryption with unsafe parameters.
113+ * A sink that initializes a cipher with unsafe parameters.
99114 */
100115private class EncryptionInitializationSink extends DataFlow:: Node {
101116 EncryptionInitializationSink ( ) {
102- exists ( MethodAccess ma , Method m , FieldRead fr | m = ma .getMethod ( ) |
117+ exists ( MethodAccess ma , Method m | m = ma .getMethod ( ) |
103118 m .hasQualifiedName ( "javax.crypto" , "Cipher" , "init" ) and
104119 m .getParameterType ( 2 )
105120 .( RefType )
106121 .hasQualifiedName ( "java.security.spec" , "AlgorithmParameterSpec" ) and
107- fr .getField ( ) .hasQualifiedName ( "javax.crypto" , "Cipher" , "ENCRYPT_MODE" ) and
108- DataFlow:: localExprFlow ( fr , ma .getArgument ( 0 ) ) and
109122 ma .getArgument ( 2 ) = this .asExpr ( )
110123 )
111124 }
0 commit comments