Add ResponseSplittingLocalQuery

This commit is contained in:
Ed Minnix
2023-04-05 14:02:35 -04:00
parent 91b3533035
commit e4f47ece43
3 changed files with 30 additions and 20 deletions

View File

@@ -10,3 +10,4 @@ category: minorAnalysis
* Added the `ExecTaintedLocalQuery.qll` library to provide the `LocalUserInputToArgumentToExecFlow` taint-tracking module to reason about command injection vulnerabilities caused by local data flow. * Added the `ExecTaintedLocalQuery.qll` library to provide the `LocalUserInputToArgumentToExecFlow` taint-tracking module to reason about command injection vulnerabilities caused by local data flow.
* Added the `StackTraceExposureQuery.qll` library to provide the `printsStackExternally`, `stringifiedStackFlowsExternally`, and `getMessageFlowsExternally` predicates to reason about stack trace exposure vulnerabilities. * Added the `StackTraceExposureQuery.qll` library to provide the `printsStackExternally`, `stringifiedStackFlowsExternally`, and `getMessageFlowsExternally` predicates to reason about stack trace exposure vulnerabilities.
* Added the `SqlTaintedLocalQuery.qll` library to provide the `LocalUserInputToArgumentToSqlFlow` taint-tracking module to reason about SQL injection vulnerabilities caused by local data flow. * Added the `SqlTaintedLocalQuery.qll` library to provide the `LocalUserInputToArgumentToSqlFlow` taint-tracking module to reason about SQL injection vulnerabilities caused by local data flow.
* Added the `ResponseSplittingLocalQuery.qll` library to provide the `ResponseSplittingLocalFlow` taint-tracking module to reason about response splitting vulnerabilities caused by local data flow.

View File

@@ -0,0 +1,24 @@
/** Provides a taint-tracking configuration to reason about response splitting vulnerabilities from local user input. */
import java
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.ResponseSplitting
/**
* A taint-tracking configuration to reason about response splitting vulnerabilities from local user input.
*/
module ResponseSplittingLocalConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput }
predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink }
predicate isBarrier(DataFlow::Node node) {
node.getType() instanceof PrimitiveType or
node.getType() instanceof BoxedType
}
}
/**
* Taint-tracking flow for response splitting vulnerabilities from local user input.
*/
module ResponseSplittingLocalFlow = TaintTracking::Global<ResponseSplittingLocalConfig>;

View File

@@ -12,26 +12,11 @@
*/ */
import java import java
import semmle.code.java.dataflow.FlowSources import semmle.code.java.security.ResponseSplittingLocalQuery
import semmle.code.java.security.ResponseSplitting import ResponseSplittingLocalFlow::PathGraph
module ResponseSplittingLocalConfig implements DataFlow::ConfigSig { from ResponseSplittingLocalFlow::PathNode source, ResponseSplittingLocalFlow::PathNode sink
predicate isSource(DataFlow::Node source) { source instanceof LocalUserInput } where ResponseSplittingLocalFlow::flowPath(source, sink)
predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink }
predicate isBarrier(DataFlow::Node node) {
node.getType() instanceof PrimitiveType or
node.getType() instanceof BoxedType
}
}
module ResponseSplitting = TaintTracking::Global<ResponseSplittingLocalConfig>;
import ResponseSplitting::PathGraph
from ResponseSplitting::PathNode source, ResponseSplitting::PathNode sink
where ResponseSplitting::flowPath(source, sink)
select sink.getNode(), source, sink, select sink.getNode(), source, sink,
"This header depends on a $@, which may cause a response-splitting vulnerability.", "This header depends on a $@, which may cause a response-splitting vulnerability.",
source.getNode(), "user-provided value" source.getNode(), "user-provided value"