easyMultiple Choice
PT0-002 Practice Question: Refer to the exhibit
Exhibit
Refer to the exhibit.
GET /search?q=<script>alert('XSS')</script> HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
HTTP/1.1 200 OK
Content-Type: text/html
<html><body>
<p>You searched for: <script>alert('XSS')</script></p>
</body></html>Refer to the exhibit. A penetration tester sends the request and receives the response shown. Which vulnerability is confirmed?
⚠ Common exam trap
Test-takers frequently confuse reflected XSS with stored XSS or CSRF, but the key indicator is that the input appears only in the response to that specific request (reflected), not stored on the server, and the GET method with no state change rules out CSRF.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Reflected cross-site scripting
The response includes the parameter value 'John' reflected directly in the HTML body without sanitization or encoding, and the request uses an HTTP GET method. This confirms a reflected cross-site scripting (XSS) vulnerability, as the tester can inject arbitrary JavaScript by modifying the 'name' parameter, which will execute in the victim's browser.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Server-side request forgery
Why it's wrong here
Server-side request forgery (SSRF) is fundamentally a server-side vulnerability where an attacker controls a URL that the vulnerable server fetches, often to reach internal systems or metadata endpoints. In this exhibit, the request parameter is reflected directly into the HTML response and executes client-side; there is no indication that the server makes any outbound connection based on user input. The observable script execution occurs in the browser, not in a server-initiated fetch, so SSRF is conclusively ruled out.
- ✗
Cross-site request forgery
Why it's wrong here
Cross-site request forgery (CSRF) tricks an authenticated victim's browser into sending a crafted request that causes a state-changing action, relying on the victim's session and cookies. In this case, the penetration tester sends the request themselves and receives the reflected payload in the response; no victim is involved, no forged submission occurs, and there is no session-dependent side effect. The vulnerability manifests immediately in the response as script execution, which is the opposite of CSRF's asynchronous, forged-request model.
- ✗
SQL injection
Why it's wrong here
SQL injection (SQLi) occurs when user-supplied input is incorporated into a SQL query without proper parameterization, resulting in syntax errors or unintended database operations. The request shown produces an HTML response that echoes the submitted input as markup, with no evidence of SQL error messages, altered query behavior, or any database interaction. The payload is treated as HTML/JavaScript by the browser, not as a SQL clause within a database query, so SQLi is an incorrect classification.
- ✓
Reflected cross-site scripting
Why this is correct
Reflected cross-site scripting (XSS) is confirmed because the tester's input is echoed back unharmed within the HTML response, and the response contains the script execution—typically the payload becomes part of the DOM and runs in the victim's browser. Unlike stored XSS, this reflected variant requires the user to click a crafted link with the payload in a parameter, and the server does not filter or encode the value before embedding it in the HTML. This direct reflection and subsequent client-side execution are the definitive markers of reflected XSS, not of SSRF, CSRF, or SQLi.
Go deeper
Related to this question
About these practice questions
This PT0-003 question is part of Courseiva's 777-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PT0-003 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PT0-003 exam.