|
1 |
| -[ |
2 |
| - { |
3 |
| - "comment": "Potentially tained data was returned from the called function.", |
4 |
| - "class": "TaintSource", |
5 |
| - "method": "get_tainted_int:()I", |
6 |
| - "result": { |
7 |
| - "location": "return_value", |
8 |
| - "taint": "<TaintSource.get_tainted_int@Integer>" |
9 |
| - } |
10 |
| - }, |
11 |
| - { |
12 |
| - "comment": "Potentially tained data was returned from the tainted input stream.", |
13 |
| - "class": "TaintedInputStream", |
14 |
| - "method": "read:([BII)I", |
15 |
| - "result": { |
16 |
| - "location": "arg1", |
17 |
| - "taint": "<TaintedInputStream.read@byte[]>" |
18 |
| - } |
19 |
| - }, |
20 |
| - { |
21 |
| - "comment": "Conversion of an array of potentially tainted bytes to a string.", |
22 |
| - "class": "java.lang.String", |
23 |
| - "method": "<init>:([BII)V", |
24 |
| - "input": { |
25 |
| - "location": "arg1", |
26 |
| - "taint": "<TaintedInputStream.read@byte[]>" |
27 |
| - }, |
28 |
| - "result": { |
29 |
| - "location": "arg0", |
30 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
31 |
| - } |
32 |
| - }, |
33 |
| - { |
34 |
| - "comment": "Appending a potentially tainted string into the StringBuilder instance. Making the builder tainted.", |
35 |
| - "class": "java.lang.StringBuilder", |
36 |
| - "method": "append:(Ljava/lang/String;)Ljava/lang/StringBuilder;", |
37 |
| - "input": { |
38 |
| - "location": "arg1", |
39 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
40 |
| - }, |
41 |
| - "result": { |
42 |
| - "location": "arg0", |
43 |
| - "taint": "<StringBuilder.append(toString(TaintedInputStream.read@byte[]))@StringBuilder>" |
44 |
| - } |
45 |
| - }, |
46 |
| - { |
47 |
| - "comment": "Conversion of potentially tainted data in the StringBuilder to a potentially tainted string.", |
48 |
| - "class": "java.lang.StringBuilder", |
49 |
| - "method": "toString:()Ljava/lang/String;", |
50 |
| - "input": { |
51 |
| - "location": "arg0", |
52 |
| - "taint": "<StringBuilder.append(toString(TaintedInputStream.read@byte[]))@StringBuilder>" |
53 |
| - }, |
54 |
| - "result": { |
55 |
| - "location": "return_value", |
56 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
57 |
| - } |
58 |
| - }, |
59 |
| - { |
60 |
| - "comment": "Inserting a potentially tainted string into a HashMap container. Making the container tainted.", |
61 |
| - "class": "java.util.HashMap", |
62 |
| - "method": "put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", |
63 |
| - "input": { |
64 |
| - "location": "arg2", |
65 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
66 |
| - }, |
67 |
| - "result": { |
68 |
| - "location": "arg0", |
69 |
| - "taint": "<HashMap.put(toString(TaintedInputStream.read@byte[]))@HashMap>" |
70 |
| - } |
71 |
| - }, |
72 |
| - { |
73 |
| - "comment": "Retrieving a potentially tainted string from a HashMap container.", |
74 |
| - "class": "java.util.HashMap", |
75 |
| - "method": "get:(Ljava/lang/Object;)Ljava/lang/Object;", |
76 |
| - "input": { |
77 |
| - "location": "arg0", |
78 |
| - "taint": "<HashMap.put(toString(TaintedInputStream.read@byte[]))@HashMap>" |
79 |
| - }, |
80 |
| - "result": { |
81 |
| - "location": "return_value", |
82 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
83 |
| - } |
84 |
| - }, |
85 |
| - { |
86 |
| - "comment": "Retrieving a potentially tainted character from a potentially tainted string.", |
87 |
| - "class": "java.lang.String", |
88 |
| - "method": "charAt:(I)C", |
89 |
| - "input": { |
90 |
| - "location": "arg0", |
91 |
| - "taint": "<toString(TaintedInputStream.read@byte[])@String>" |
92 |
| - }, |
93 |
| - "result": { |
94 |
| - "location": "return_value", |
95 |
| - "taint": "<charAt(toString(TaintedInputStream.read@byte[]))@Character>" |
96 |
| - } |
97 |
| - }, |
98 |
| - { |
99 |
| - "comment": "Writing a potentially tainted data into the output", |
100 |
| - "class": "TaintSink", |
101 |
| - "method": "receive_taint:(C)V", |
102 |
| - "sinkTarget": { |
103 |
| - "location": "arg0", |
104 |
| - "taint": "<charAt(toString(TaintedInputStream.read@byte[]))@Character>" |
105 |
| - } |
106 |
| - } |
107 |
| -] |
| 1 | +{ |
| 2 | + "namespace": "com.diffblue.security", |
| 3 | + "rules": |
| 4 | + [ |
| 5 | + { |
| 6 | + "comment": "Streams returned by getInputStream on ServletRequest are tainted", |
| 7 | + "class": "javax.servlet.http.HttpServletRequest", |
| 8 | + "method": "getInputStream:()Ljava/io/InputStream;", |
| 9 | + "result": { |
| 10 | + "location": "returns", |
| 11 | + "taint": "Tainted stream" |
| 12 | + } |
| 13 | + }, |
| 14 | + { |
| 15 | + "comment": "Read from tainted stream gives tainted string", |
| 16 | + "class": "java.io.InputStream", |
| 17 | + "method": "read:([BII)I", |
| 18 | + "input": { |
| 19 | + "location": "this", |
| 20 | + "taint": "Tainted stream" |
| 21 | + }, |
| 22 | + "result": { |
| 23 | + "location": "arg1", |
| 24 | + "namespace": "com.diffblue.security.specialized", |
| 25 | + "taint": "Tainted byte array" |
| 26 | + } |
| 27 | + }, |
| 28 | + { |
| 29 | + "comment": "Construction from an array of tainted bytes gives a tainted string", |
| 30 | + "class": "java.lang.String", |
| 31 | + "method": "<init>:([BII)V", |
| 32 | + "input": { |
| 33 | + "location": "arg1", |
| 34 | + "namespace": "com.diffblue.security.specialized", |
| 35 | + "taint": "Tainted byte array" |
| 36 | + }, |
| 37 | + "result": { |
| 38 | + "location": "this", |
| 39 | + "taint": "Tainted string" |
| 40 | + } |
| 41 | + }, |
| 42 | + { |
| 43 | + "comment": "Bytes obtained from a tainted string are tainted.", |
| 44 | + "class": "java.lang.String", |
| 45 | + "method": "getBytes:()[B", |
| 46 | + "input": { |
| 47 | + "location": "this", |
| 48 | + "taint": "Tainted string" |
| 49 | + }, |
| 50 | + "result": { |
| 51 | + "location": "returns", |
| 52 | + "namespace": "com.diffblue.security.specialized", |
| 53 | + "taint": "Tainted byte array" |
| 54 | + } |
| 55 | + }, |
| 56 | + { |
| 57 | + "comment": "Streams returned by getOutputStream on ServletResponse are vulnerable", |
| 58 | + "class": "javax.servlet.http.HttpServletResponse", |
| 59 | + "method": "getOutputStream:()Ljava/io/OutputStream;", |
| 60 | + "result": { |
| 61 | + "location": "returns", |
| 62 | + "vulnerability": "Vulnerable stream" |
| 63 | + } |
| 64 | + }, |
| 65 | + { |
| 66 | + "comment": "Writing potentially tainted bytes (in a given range) to a vulnerable stream is a sink.", |
| 67 | + "class": "java.io.OutputStream", |
| 68 | + "method": "write:([BII)V", |
| 69 | + "input": { |
| 70 | + "location": "arg1", |
| 71 | + "namespace": "com.diffblue.security.specialized", |
| 72 | + "taint": "Tainted byte array" |
| 73 | + }, |
| 74 | + "sinkTarget": { |
| 75 | + "location": "this", |
| 76 | + "vulnerability": "Vulnerable stream" |
| 77 | + } |
| 78 | + }, |
| 79 | + { |
| 80 | + "comment": "Writing potentially tainted bytes (the whole array) to a vulnerable stream is a sink.", |
| 81 | + "class": "java.io.OutputStream", |
| 82 | + "method": "write:([B)V", |
| 83 | + "input": { |
| 84 | + "location": "arg1", |
| 85 | + "namespace": "com.diffblue.security.specialized", |
| 86 | + "taint": "Tainted byte array" |
| 87 | + }, |
| 88 | + "sinkTarget": { |
| 89 | + "location": "this", |
| 90 | + "vulnerability": "Vulnerable stream" |
| 91 | + }, |
| 92 | + "message": "Unescaped HTML potentially written back to browser" |
| 93 | + } |
| 94 | + ] |
| 95 | +} |
| 96 | + |
0 commit comments