High severityJavaInjectionHIGH confidence
XSS Servlet Reflected
Untrusted request input is written directly into an HTTP response body without output encoding, enabling reflected cross-site scripting (CWE-79).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.3 (L1)
Vulnerable vs. safe
Flagged by this check
resp.getWriter().print(req.getParameter("q"));Passes - the safe pattern
resp.getWriter().print(org.owasp.encoder.Encode.forHtml(req.getParameter("q")));Why it matters & how to fix it
Untrusted request input is written directly into an HTTP response body without output encoding, enabling reflected cross-site scripting (CWE-79). HTML-encode the value before writing it (e.g. OWASP Java Encoder Encode.forHtml), set a restrictive Content-Type, and prefer a templating engine with contextual auto-escaping.
References
Rule ID integsec-java-xss-servlet-reflected - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - InjectionCode Injection Tainted Input
- JavaScript / TypeScript - InjectionEval Dynamic Argument
- JavaScript / TypeScript - InjectionNoSQL Query From Request
- JavaScript / TypeScript - InjectionNoSQL Where Operator
- JavaScript / TypeScript - InjectionOS Command Injection Tainted Input
- JavaScript / TypeScript - InjectionSQL Injection String Concatenation