Skip to content

Commit d748fb5

Browse files
committed
Fix bad models, add tests for those
1 parent 6413de6 commit d748fb5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ module CsvValidation {
627627
"open-url", "jndi-injection", "ldap", "sql", "jdbc-url", "logging", "mvel", "xpath",
628628
"groovy", "xss", "ognl-injection", "intent-start", "pending-intent-sent",
629629
"url-open-stream", "url-redirect", "create-file", "write-file", "set-hostname-verifier",
630-
"header-splitting", "information-leak", "xslt", "jexl", "bean-validation"
630+
"header-splitting", "information-leak", "xslt", "jexl", "bean-validation", "ssti"
631631
] and
632632
not kind.matches("regex-use%") and
633633
not kind.matches("qltest%") and

java/ql/lib/semmle/code/java/security/TemplateInjection.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ private class TemplateInjectionSinkModels extends SinkModelCsv {
9191
"org.thymeleaf;ITemplateEngine;true;processThrottled;;;Argument[0];ssti;manual",
9292
"org.apache.velocity.app;Velocity;true;evaluate;;;Argument[0];ssti;manual",
9393
"org.apache.velocity.app;Velocity;true;evaluate;;;Argument[3];ssti;manual",
94-
"org.apache.velocity,app;VelocityEngine;true;evaluate;;;Argument[0];ssti;manual",
95-
"org.apache.velocity,app;VelocityEngine;true;evaluate;;;Argument[3];ssti;manual",
9694
"org.apache.velocity.app;Velocity;true;mergeTemplate;;;Argument[2];ssti;manual",
95+
"org.apache.velocity.app;VelocityEngine;true;evaluate;;;Argument[0];ssti;manual",
96+
"org.apache.velocity.app;VelocityEngine;true;evaluate;;;Argument[3];ssti;manual",
9797
"org.apache.velocity.app;VelocityEngine;true;mergeTemplate;;;Argument[2];ssti;manual",
9898
"org.apache.velocity.runtime.resource.util;StringResourceRepository;true;putStringResource;;;Argument[1];ssti;manual",
9999
"org.apache.velocity.runtime;RuntimeServices;true;evaluate;;;Argument[0];ssti;manual",

java/ql/test/query-tests/security/CWE-094/VelocitySSTI.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public void bad5(HttpServletRequest request) {
8686
StringWriter w = new StringWriter();
8787
VelocityEngine engine = null;
8888
engine.mergeTemplate("testtemplate.vm", "UTF-8", context, w); // $hasTemplateInjection
89+
AbstractContext ctx = null;
90+
ctx.put("key", code);
91+
engine.evaluate(ctx, null, null, null); // $hasTemplateInjection
92+
engine.evaluate(null, null, null, code); // $hasTemplateInjection
8993
}
9094

9195
@GetMapping(value = "bad6")

0 commit comments

Comments
 (0)