|
12 | 12 | */
|
13 | 13 |
|
14 | 14 | import java
|
15 |
| -import semmle.code.java.dataflow.FlowSources |
16 |
| -import semmle.code.java.security.ResponseSplitting |
| 15 | +import semmle.code.java.security.ResponseSplittingQuery |
| 16 | +import ResponseSplittingFlow::PathGraph |
17 | 17 |
|
18 |
| -module ResponseSplittingConfig implements DataFlow::ConfigSig { |
19 |
| - predicate isSource(DataFlow::Node source) { |
20 |
| - source instanceof RemoteFlowSource and |
21 |
| - not source instanceof SafeHeaderSplittingSource |
22 |
| - } |
23 |
| - |
24 |
| - predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink } |
25 |
| - |
26 |
| - predicate isBarrier(DataFlow::Node node) { |
27 |
| - node.getType() instanceof PrimitiveType |
28 |
| - or |
29 |
| - node.getType() instanceof BoxedType |
30 |
| - or |
31 |
| - exists(MethodAccess ma, string methodName, CompileTimeConstantExpr target | |
32 |
| - node.asExpr() = ma and |
33 |
| - ma.getMethod().hasQualifiedName("java.lang", "String", methodName) and |
34 |
| - target = ma.getArgument(0) and |
35 |
| - ( |
36 |
| - methodName = "replace" and target.getIntValue() = [10, 13] // 10 == "\n", 13 == "\r" |
37 |
| - or |
38 |
| - methodName = "replaceAll" and |
39 |
| - target.getStringValue().regexpMatch(".*([\n\r]|\\[\\^[^\\]\r\n]*\\]).*") |
40 |
| - ) |
41 |
| - ) |
42 |
| - } |
43 |
| -} |
44 |
| - |
45 |
| -module ResponseSplitting = TaintTracking::Global<ResponseSplittingConfig>; |
46 |
| - |
47 |
| -import ResponseSplitting::PathGraph |
48 |
| - |
49 |
| -from ResponseSplitting::PathNode source, ResponseSplitting::PathNode sink |
50 |
| -where ResponseSplitting::flowPath(source, sink) |
| 18 | +from ResponseSplittingFlow::PathNode source, ResponseSplittingFlow::PathNode sink |
| 19 | +where ResponseSplittingFlow::flowPath(source, sink) |
51 | 20 | select sink.getNode(), source, sink,
|
52 | 21 | "This header depends on a $@, which may cause a response-splitting vulnerability.",
|
53 | 22 | source.getNode(), "user-provided value"
|
0 commit comments