MyBatis ${} interpolation causes SQL injection
Rule ID: vetkit.java.sql-injection.mybatis-dollar-interpolation
A MyBatis mapper splices a parameter into SQL with ${...} (SQL injection). Unlike #{...}, ${...} is pasted into the statement text unescaped, so a caller-controlled value can change the query.
Last updated:
Suite: Security
regex
A MyBatis mapper splices a parameter into SQL with ${...} (SQL injection). Unlike #{...}, ${...} is pasted into the statement text unescaped, so a caller-controlled value can change the query.
Category: SECURITY · Engine rule severity: WARNING
How to fix it
Bind values with #{...}. For identifiers (ORDER BY column, table name) map the input to a fixed allow-list in Java and only splice the allow-listed constant.
References
Source: packages/engine/rules/sast/java.yml.
Related checks
- Java SQL injection from string concatenation or String.format
- Android WebView setAllowFileAccess(true) enabled
- Android WebView onReceivedSslError calls proceed()
- Android WebView addJavascriptInterface with JavaScript on
- Android WebView setAllowUniversalAccessFromFileURLs enabled
- Android MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE files
Check your own repository for this
vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.
Start with the free Security Quick Scan · See how the platform works
Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.