Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
// VULNERABLE: String concatenation in HQLStringhql="FROM User WHERE name = '" + name + "'";
Queryquery= session.createQuery(hql);
// SAFE: Named parametersQueryquery= session.createQuery("FROM User WHERE name = :name");
query.setParameter("name", name);
Category 6: Servlet Parameter Pollution
// VULNERABLE: Using getParameter when multiple values existStringrole= request.getParameter("role");
// If URL is ?role=user&role=admin, behavior depends on container!// SAFE: Be explicit about handling
String[] roles = request.getParameterValues("role");
Category 7: Runtime.exec Command Injection
// VULNERABLE: Single string to exec (uses shell on some platforms)
Runtime.getRuntime().exec("cmd /c dir " + userInput);
// SAFE: Array formnewProcessBuilder("dir", userInput).start();
// But still risky with cmd.exe — prefer direct binary execution
// VULNERABLE: Reflection bypasses access controlFieldfield= User.class.getDeclaredField(userInput);
field.setAccessible(true); // Bypasses private!
field.set(user, newValue);
// SAFE: Never use user input in reflection operations
Category 12: JDBC Connection String Injection
// VULNERABLE: User input in connection stringStringurl="jdbc:mysql://db:3306/" + userInput;
DriverManager.getConnection(url);
// User can inject: dbname?autoDeserialize=true&queryInterceptors=...// SAFE: Validate database name, use connection pool config
Category 13: SecureRandom vs Random
// VULNERABLE: java.util.Random is predictableRandomrandom=newRandom();
Stringtoken= Long.toHexString(random.nextLong());
// SAFE: SecureRandom for security-sensitive valuesSecureRandomrandom=newSecureRandom();
byte[] bytes = newbyte[32];
random.nextBytes(bytes);
Category 14: Gradle/Maven Supply Chain
Check for untrusted plugin repositories in build.gradle
Review custom Gradle plugins for code execution
Verify dependency checksums
Check for repository substitution attacks (internal→public)
Category 15: Thymeleaf SSTI
// VULNERABLE: User input in Thymeleaf template stringStringtemplate="Hello " + userInput;
templateEngine.process(template, context);
// userInput = "__${T(java.lang.Runtime).getRuntime().exec('id')}__::.x"// SAFE: User input as template variable
model.addAttribute("name", userInput);
templateEngine.process("hello", context); // hello.html: <span th:text="${name}">
Category 16: JSP Expression Language Injection
<!-- VULNERABLE: User input in EL expression -->
<c:out value="${param.name}" /> <!-- Generally safe with c:out -->
${param.name} <!-- Direct EL is NOT auto-escaped in JSP! XSS -->
<!-- SAFE: Use JSTL c:out or fn:escapeXml -->
<c:out value="${param.name}" escapeXml="true" />
Category 17: Spring Mass Assignment
// VULNERABLE: All fields bound from request@PostMapping("/users")public User create(@ModelAttribute User user) {
return repo.save(user); // role, isAdmin settable!
}
// SAFE: Use DTOpublic User create(@RequestBody CreateUserDTO dto) { /* map fields */ }
// Or use @InitBinder to exclude fields@InitBinderpublicvoidinitBinder(WebDataBinder binder) {
binder.setDisallowedFields("role", "isAdmin");
}