@@ -23,8 +23,6 @@ module DecompressionBomb {
23
23
private class ReadInputStreamQualifierSink extends DecompressionBomb:: Sink {
24
24
ReadInputStreamQualifierSink ( ) { this .asExpr ( ) = any ( BombReadInputStreamCall r ) .getQualifier ( ) }
25
25
}
26
-
27
- abstract class BombTypeInputStream extends RefType { }
28
26
}
29
27
30
28
/**
@@ -34,7 +32,7 @@ module XerialSnappy {
34
32
/**
35
33
* A type that is responsible for `SnappyInputStream` Class
36
34
*/
37
- class TypeInputStream extends DecompressionBomb :: BombTypeInputStream {
35
+ class TypeInputStream extends RefType {
38
36
TypeInputStream ( ) {
39
37
this .getASupertype * ( ) .hasQualifiedName ( "org.xerial.snappy" , "SnappyInputStream" )
40
38
}
@@ -99,7 +97,7 @@ module ApacheCommons {
99
97
/**
100
98
* The types that are responsible for specific compression format of `CompressorInputStream` Class
101
99
*/
102
- class TypeCompressors extends DecompressionBomb :: BombTypeInputStream {
100
+ class TypeCompressors extends RefType {
103
101
TypeCompressors ( ) {
104
102
this .getASupertype * ( )
105
103
.hasQualifiedName ( "org.apache.commons.compress.compressors.gzip" ,
@@ -163,15 +161,6 @@ module ApacheCommons {
163
161
)
164
162
}
165
163
}
166
-
167
- predicate step ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
168
- exists ( Call call |
169
- // Constructors
170
- call .getCallee ( ) .getDeclaringType ( ) instanceof TypeCompressors and
171
- call .getArgument ( 0 ) = n1 .asExpr ( ) and
172
- call = n2 .asExpr ( )
173
- )
174
- }
175
164
}
176
165
177
166
/**
@@ -181,7 +170,7 @@ module ApacheCommons {
181
170
/**
182
171
* The types that are responsible for specific compression format of `ArchiveInputStream` Class
183
172
*/
184
- class TypeArchivers extends DecompressionBomb :: BombTypeInputStream {
173
+ class TypeArchivers extends RefType {
185
174
TypeArchivers ( ) {
186
175
this .getASupertype * ( )
187
176
.hasQualifiedName ( "org.apache.commons.compress.archivers.ar" , "ArArchiveInputStream" ) or
@@ -235,7 +224,7 @@ module ApacheCommons {
235
224
/**
236
225
* A type that is responsible for `ArchiveInputStream` Class
237
226
*/
238
- class TypeArchivers extends DecompressionBomb :: BombTypeInputStream {
227
+ class TypeArchivers extends RefType {
239
228
TypeArchivers ( ) {
240
229
this .getASupertype * ( )
241
230
.hasQualifiedName ( "org.apache.commons.compress.archivers" , "ArchiveStreamFactory" )
@@ -253,11 +242,7 @@ module ApacheCommons {
253
242
}
254
243
255
244
/**
256
- * Gets `n1` and `n2` which `CompressorInputStream n2 = new CompressorStreamFactory().createCompressorInputStream(n1)`
257
- * or `ArchiveInputStream n2 = new ArchiveStreamFactory().createArchiveInputStream(n1)` or
258
- * `n1.read(n2)`,
259
- * second one is added because of sanitizer, we want to compare return value of each `read` or similar method
260
- * that whether there is a flow to a comparison between total read of decompressed stream and a constant value
245
+ * Gets `n1` and `n2` which `ZipInputStream n2 = new ZipInputStream(n1)`
261
246
*/
262
247
private class CompressorsAndArchiversAdditionalTaintStep extends DecompressionBomb:: AdditionalStep
263
248
{
@@ -314,12 +299,21 @@ module Zip4j {
314
299
}
315
300
}
316
301
317
- class Sink extends DecompressionBomb:: Sink {
318
- Sink ( ) {
319
- this .asExpr ( ) = any ( ReadInputStreamCall r ) .getQualifier ( )
320
- or
321
- exists ( ConstructorCall call | call .getConstructedType ( ) instanceof TypeZipInputStream |
322
- this .asExpr ( ) = call .getArgument ( 0 )
302
+ /**
303
+ * Gets `n1` and `n2` which `CompressorInputStream n2 = new CompressorStreamFactory().createCompressorInputStream(n1)`
304
+ * or `ArchiveInputStream n2 = new ArchiveStreamFactory().createArchiveInputStream(n1)` or
305
+ * `n1.read(n2)`,
306
+ * second one is added because of sanitizer, we want to compare return value of each `read` or similar method
307
+ * that whether there is a flow to a comparison between total read of decompressed stream and a constant value
308
+ */
309
+ private class CompressorsAndArchiversAdditionalTaintStep extends DecompressionBomb:: AdditionalStep
310
+ {
311
+ override predicate step ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
312
+ exists ( Call call |
313
+ // Constructors
314
+ call .getCallee ( ) .getDeclaringType ( ) instanceof TypeZipInputStream and
315
+ call .getArgument ( 0 ) = n1 .asExpr ( ) and
316
+ call = n2 .asExpr ( )
323
317
)
324
318
}
325
319
}
@@ -332,7 +326,7 @@ module Zip {
332
326
/**
333
327
* The Types that are responsible for `ZipInputStream`, `GZIPInputStream`, `InflaterInputStream` Classes
334
328
*/
335
- class TypeInputStream extends DecompressionBomb :: BombTypeInputStream {
329
+ class TypeInputStream extends RefType {
336
330
TypeInputStream ( ) {
337
331
this .getASupertype * ( )
338
332
.hasQualifiedName ( "java.util.zip" ,
0 commit comments