@@ -30,9 +30,7 @@ private DataFlow::Node commandArgument(SystemCommandExecution sys, DataFlow::Typ
3030 t .start ( ) and
3131 result = sys .getACommandArgument ( )
3232 or
33- exists ( DataFlow:: TypeBackTracker t2 |
34- t = t2 .smallstep ( result , commandArgument ( sys , t2 ) )
35- )
33+ exists ( DataFlow:: TypeBackTracker t2 | t = t2 .smallstep ( result , commandArgument ( sys , t2 ) ) )
3634}
3735
3836/**
@@ -43,9 +41,7 @@ private DataFlow::SourceNode argumentList(SystemCommandExecution sys, DataFlow::
4341 t .start ( ) and
4442 result = sys .getArgumentList ( ) .getALocalSource ( )
4543 or
46- exists ( DataFlow:: TypeBackTracker t2 |
47- result = argumentList ( sys , t2 ) .backtrack ( t2 , t )
48- )
44+ exists ( DataFlow:: TypeBackTracker t2 | result = argumentList ( sys , t2 ) .backtrack ( t2 , t ) )
4945}
5046
5147/**
@@ -61,15 +57,29 @@ private DataFlow::SourceNode argumentList(SystemCommandExecution sys, DataFlow::
6157 * let args = ["-c", cmd];
6258 * childProcess.spawn(sh, args, cb);
6359 * ```
60+ * or
61+ * ```
62+ * let cmd = getCommand();
63+ * childProcess.spawn("cmd.exe", ["/c"].concat(cmd), cb);
64+ * ```
6465 */
6566predicate isIndirectCommandArgument ( DataFlow:: Node source , SystemCommandExecution sys ) {
66- exists (
67- DataFlow:: ArrayCreationNode args , DataFlow:: Node shell , string dashC
68- |
67+ exists ( DataFlow:: ArrayCreationNode args , DataFlow:: Node shell , string dashC |
6968 shellCmd ( shell .asExpr ( ) , dashC ) and
7069 shell = commandArgument ( sys , DataFlow:: TypeBackTracker:: end ( ) ) and
71- args = argumentList ( sys , DataFlow:: TypeBackTracker:: end ( ) ) and
7270 args .getAPropertyWrite ( ) .getRhs ( ) .mayHaveStringValue ( dashC ) and
73- source = args .getAPropertyWrite ( ) .getRhs ( )
71+ (
72+ args = argumentList ( sys , DataFlow:: TypeBackTracker:: end ( ) ) and
73+ source = args .getAPropertyWrite ( ) .getRhs ( )
74+ or
75+ exists ( DataFlow:: MethodCallNode concatCall |
76+ args = concatCall .getReceiver ( ) and
77+ concatCall .getMethodName ( ) = "concat" and
78+ concatCall = argumentList ( sys , DataFlow:: TypeBackTracker:: end ( ) )
79+ |
80+ source = concatCall .getAnArgument ( ) or
81+ source = concatCall .getAnArgument ( ) .getALocalSource ( ) .getAPropertyWrite ( ) .getRhs ( )
82+ )
83+ )
7484 )
7585}
0 commit comments