forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvalTaintPath.ql
More file actions
28 lines (22 loc) · 944 Bytes
/
EvalTaintPath.ql
File metadata and controls
28 lines (22 loc) · 944 Bytes
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 Taint-tracking to 'eval' calls (with path visualization)
* @description Tracks user-controlled values into 'eval' calls (special case of js/code-injection),
* and generates a visualizable path from the source to the sink.
* @kind path-problem
* @problem.severity error
* @tags security
* @id js/examples/eval-taint-path
*/
import javascript
module EvalTaintConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node node) {
node = DataFlow::globalVarRef("eval").getACall().getArgument(0)
}
}
module EvalTaintFlow = TaintTracking::Global<EvalTaintConfig>;
import EvalTaintFlow::PathGraph
from EvalTaintFlow::PathNode source, EvalTaintFlow::PathNode sink
where EvalTaintFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "Eval with user-controlled input from $@.", source.getNode(),
"here"