The answer is reflected cross-site scripting (XSS). This is correct because the server response echoes the 'name' parameter value 'John' directly into the HTML body without any sanitization or encoding, and the request uses an HTTP GET method, allowing an attacker to inject arbitrary JavaScript by modifying that parameter. On the CompTIA PenTest+ PT0-002 exam, reflected XSS detection questions often present a raw HTTP request and response pair, testing your ability to spot unsanitized user input reflected in the output—a common trap is confusing this with stored XSS, but remember that reflected XSS appears immediately in the response and is not persisted on the server. For a quick memory tip, think of a mirror: reflected XSS bounces the payload right back in the response, just like a reflection in a mirror.
PT0-002 Attacks and Exploits Practice Question
This PT0-002 practice question tests your understanding of attacks and exploits. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
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?
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.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
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
No server making outbound request.
✗
Cross-site request forgery
Why it's wrong here
No forged request; response shows script execution.
✗
SQL injection
Why it's wrong here
No SQL syntax or error indication.
✓
Reflected cross-site scripting
Why this is correct
The input is echoed back in the HTML without sanitization, allowing script execution.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may 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.
Trap categories for this question
Command / output trap
No forged request; response shows script execution.
Detailed technical explanation
How to think about this question
Reflected XSS occurs when user input is immediately included in the HTTP response without proper output encoding, typically via URL parameters or form inputs. In this case, the parameter 'name=John' is placed into the HTML body, and if an attacker replaces 'John' with a script tag like '<script>alert(1)</script>', the browser will execute it. Real-world exploitation often uses URL shortening or phishing to trick victims into clicking a crafted link that triggers the XSS payload.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A security team runs a vulnerability scan on a web application and discovers an unpatched SQL injection flaw. The team prioritises remediation by CVSS score — critical flaws are patched within 24 hours, high within 7 days. Questions like this test whether you understand vulnerability management processes, scanning tools, and remediation prioritisation.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this PT0-002 question in full detail.
Attacks and Exploits — This question tests Attacks and Exploits — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: 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.
What should I do if I get this PT0-002 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This PT0-002 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-002 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.