22 * @name Local-user-controlled command line
33 * @description Using externally controlled strings in a command line is vulnerable to malicious
44 * changes in the strings.
5- * @kind problem
5+ * @kind path- problem
66 * @problem.severity recommendation
77 * @precision medium
88 * @id java/command-line-injection-local
1414import semmle.code.java.Expr
1515import semmle.code.java.dataflow.FlowSources
1616import semmle.code.java.security.ExternalProcess
17+ import DataFlow:: PathGraph
1718
1819class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
1920 LocalUserInputToArgumentToExecFlowConfig ( ) { this = "LocalUserInputToArgumentToExecFlowConfig" }
@@ -28,6 +29,8 @@ class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking::Configurat
2829}
2930
3031from
31- StringArgumentToExec execArg , LocalUserInput origin , LocalUserInputToArgumentToExecFlowConfig conf
32- where conf .hasFlow ( origin , DataFlow:: exprNode ( execArg ) )
33- select execArg , "$@ flows to here and is used in a command." , origin , "User-provided value"
32+ DataFlow:: PathNode source , DataFlow:: PathNode sink , StringArgumentToExec execArg ,
33+ LocalUserInputToArgumentToExecFlowConfig conf
34+ where conf .hasFlowPath ( source , sink ) and sink .getNode ( ) .asExpr ( ) = execArg
35+ select execArg , source , sink , "$@ flows to here and is used in a command." , source .getNode ( ) ,
36+ "User-provided value"
0 commit comments