SP.II · Security+ SY0-701 practice question
A web application allows users to input a username into a text field, which is then immediately displayed back on the same page to confirm the entry (e.g., "Hello, [Username]"). If the input handling is flawed, an attacker might manipulate this input to execute unauthorized code or view sensitive information. Which type of vulnerability is most likely present in this scenario?
Check answer and explanation
Correct answer: Cross-Site Scripting (XSS)
Explanation
> The scenario describes user input being reflected back to the browser without proper sanitization or encoding, allowing an attacker to potentially inject client-side scripts (like JavaScript) into the page. This is the classic definition of Cross-Site Scripting (XSS).
Common trap
The prompt mentions input being "executed or echoed unsafely." While injection applies to SQLi (which targets the backend database), the direct echoing of user input onto a web page where it could run as code points specifically to XSS. SQLi targets database queries, not typically rendering on the page like this.
Source: OWASP Top Ten - Injection (as a broad category covering XSS and SQLi, but XSS is the direct fit for client-side echoing) https://owasp.org/www-project-top-ten/
Checked against the cited text on 2026-11-27.