File tree Expand file tree Collapse file tree
lib/semmle/code/java/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /** Provides a taint-tracking configuration to reason about use of externally controlled strings to make command line commands. */
2+
3+ import java
4+ private import semmle.code.java.dataflow.FlowSources
5+ private import semmle.code.java.security.ExternalProcess
6+ private import semmle.code.java.security.CommandArguments
7+
8+ /** A taint-tracking configuration to reason about use of externally controlled strings to make command line commands. */
9+ module LocalUserInputToArgumentToExecFlowConfig implements DataFlow:: ConfigSig {
10+ predicate isSource ( DataFlow:: Node src ) { src instanceof LocalUserInput }
11+
12+ predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) instanceof ArgumentToExec }
13+
14+ predicate isBarrier ( DataFlow:: Node node ) {
15+ node .getType ( ) instanceof PrimitiveType
16+ or
17+ node .getType ( ) instanceof BoxedType
18+ or
19+ isSafeCommandArgument ( node .asExpr ( ) )
20+ }
21+ }
22+
23+ /**
24+ * Taint-tracking flow for use of externally controlled strings to make command line commands.
25+ */
26+ module LocalUserInputToArgumentToExecFlow =
27+ TaintTracking:: Global< LocalUserInputToArgumentToExecFlowConfig > ;
Original file line number Diff line number Diff line change 1212 * external/cwe/cwe-088
1313 */
1414
15- import semmle.code.java.Expr
16- import semmle.code.java.dataflow.FlowSources
17- import semmle.code.java.security.ExternalProcess
18- import semmle.code.java.security.CommandArguments
19-
20- module LocalUserInputToArgumentToExecFlowConfig implements DataFlow:: ConfigSig {
21- predicate isSource ( DataFlow:: Node src ) { src instanceof LocalUserInput }
22-
23- predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) instanceof ArgumentToExec }
24-
25- predicate isBarrier ( DataFlow:: Node node ) {
26- node .getType ( ) instanceof PrimitiveType
27- or
28- node .getType ( ) instanceof BoxedType
29- or
30- isSafeCommandArgument ( node .asExpr ( ) )
31- }
32- }
33-
34- module LocalUserInputToArgumentToExecFlow =
35- TaintTracking:: Global< LocalUserInputToArgumentToExecFlowConfig > ;
36-
15+ import java
16+ import semmle.code.java.security.ExecTaintedLocalQuery
3717import LocalUserInputToArgumentToExecFlow:: PathGraph
3818
3919from
You can’t perform that action at this time.
0 commit comments