Skip to content

Commit 8513c69

Browse files
authored
Merge pull request github#3329 from artem-smotrakov/mvel-injection
Java: Add a query for MVEL injections
2 parents 00078d1 + b7c3dd6 commit 8513c69

27 files changed

+720
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
2+
<qhelp>
3+
4+
<overview>
5+
<p>
6+
MVEL is an expression language based on Java-syntax.
7+
The language offers many features
8+
including invocation of methods available in the JVM.
9+
If a MVEL expression is built using attacker-controlled data,
10+
and then evaluated, then it may allow the attacker to run arbitrary code.
11+
</p>
12+
</overview>
13+
14+
<recommendation>
15+
<p>
16+
Including user input in a MVEL expression should be avoided.
17+
</p>
18+
</recommendation>
19+
20+
<example>
21+
<p>
22+
The following example uses untrusted data to build a MVEL expression
23+
and then runs it in the default powerfull context.
24+
</p>
25+
<sample src="UnsafeMvelExpressionEvaluation.java" />
26+
</example>
27+
28+
<references>
29+
<li>
30+
MVEL Documentation:
31+
<a href="http://mvel.documentnode.com/">Language Guide for 2.0</a>.
32+
</li>
33+
<li>
34+
OWASP:
35+
<a href="https://owasp.org/www-community/vulnerabilities/Expression_Language_Injection">Expression Language Injection</a>.
36+
</li>
37+
</references>
38+
</qhelp>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @name Expression language injection (MVEL)
3+
* @description Evaluation of a user-controlled MVEL expression
4+
* may lead to remote code execution.
5+
* @kind path-problem
6+
* @problem.severity error
7+
* @precision high
8+
* @id java/mvel-expression-injection
9+
* @tags security
10+
* external/cwe/cwe-094
11+
*/
12+
13+
import java
14+
import MvelInjectionLib
15+
import DataFlow::PathGraph
16+
17+
from DataFlow::PathNode source, DataFlow::PathNode sink, MvelInjectionConfig conf
18+
where conf.hasFlowPath(source, sink)
19+
select sink.getNode(), source, sink, "MVEL injection from $@.", source.getNode(), "this user input"

0 commit comments

Comments
 (0)