-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathSecondOrderCommandInjection.ql
More file actions
28 lines (26 loc) · 1.11 KB
/
SecondOrderCommandInjection.ql
File metadata and controls
28 lines (26 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* @name Second order command injection
* @description Using user-controlled data as arguments to some commands, such as git clone,
* can allow arbitrary commands to be executed.
* @kind path-problem
* @problem.severity error
* @security-severity 7.0
* @precision high
* @id js/second-order-command-line-injection
* @tags correctness
* security
* external/cwe/cwe-078
* external/cwe/cwe-088
*/
import javascript
import semmle.javascript.security.dataflow.SecondOrderCommandInjectionQuery
import DataFlow::DeduplicatePathGraph<SecondOrderCommandInjectionFlow::PathNode, SecondOrderCommandInjectionFlow::PathGraph>
from PathNode source, PathNode sink, Sink sinkNode
where
SecondOrderCommandInjectionFlow::flowPath(source.getAnOriginalPathNode(),
sink.getAnOriginalPathNode()) and
sinkNode = sink.getNode()
select sink.getNode(), source, sink,
"Command line argument that depends on $@ can execute an arbitrary command if " +
sinkNode.getVulnerableArgumentExample() + " is used with " + sinkNode.getCommand() + ".",
source.getNode(), source.getNode().(Source).describe()