2
2
* @name Local-user-controlled command line
3
3
* @description Using externally controlled strings in a command line is vulnerable to malicious
4
4
* changes in the strings.
5
- * @kind problem
5
+ * @kind path- problem
6
6
* @problem.severity recommendation
7
7
* @precision medium
8
8
* @id java/command-line-injection-local
14
14
import semmle.code.java.Expr
15
15
import semmle.code.java.dataflow.FlowSources
16
16
import semmle.code.java.security.ExternalProcess
17
+ import DataFlow:: PathGraph
17
18
18
19
class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
19
20
LocalUserInputToArgumentToExecFlowConfig ( ) { this = "LocalUserInputToArgumentToExecFlowConfig" }
@@ -28,6 +29,8 @@ class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking::Configurat
28
29
}
29
30
30
31
from
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