Skip to content

Commit b30c92e

Browse files
committed
Refactored into MvelInjection.qll using CSV models
1 parent 59e6e1f commit b30c92e

File tree

3 files changed

+257
-369
lines changed

3 files changed

+257
-369
lines changed

java/ql/src/Security/CWE/CWE-094/MvelInjection.ql

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,31 @@
1111
*/
1212

1313
import java
14-
import MvelInjectionLib
14+
import semmle.code.java.dataflow.FlowSources
15+
import semmle.code.java.dataflow.TaintTracking
16+
import semmle.code.java.security.MvelInjection
1517
import DataFlow::PathGraph
1618

17-
from DataFlow::PathNode source, DataFlow::PathNode sink, MvelInjectionConfig conf
19+
/**
20+
* A taint-tracking configuration for unsafe user input
21+
* that is used to construct and evaluate a MVEL expression.
22+
*/
23+
class MvelInjectionFlowConfig extends TaintTracking::Configuration {
24+
MvelInjectionFlowConfig() { this = "MvelInjectionFlowConfig" }
25+
26+
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
27+
28+
override predicate isSink(DataFlow::Node sink) { sink instanceof MvelEvaluationSink }
29+
30+
override predicate isSanitizer(DataFlow::Node sanitizer) {
31+
sanitizer instanceof MvelInjectionSanitizer
32+
}
33+
34+
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
35+
any(MvelInjectionAdditionalTaintStep c).step(node1, node2)
36+
}
37+
}
38+
39+
from DataFlow::PathNode source, DataFlow::PathNode sink, MvelInjectionFlowConfig conf
1840
where conf.hasFlowPath(source, sink)
1941
select sink.getNode(), source, sink, "MVEL injection from $@.", source.getNode(), "this user input"

0 commit comments

Comments
 (0)