CEH Web Application and Injection Attacks Practice Question
A security analyst observes that after a user submits a comment on a blog, the comment is displayed immediately on the page without sanitization. Another user visits the page and the comment's JavaScript executes in their browser. Which type of XSS attack is this?
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
✓
Stored XSS
The comment is stored on the server and executed when other users view the page, which is the definition of stored (persistent) XSS.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
DOM-based XSS
Why it's wrong here
DOM-based Cross-Site Scripting (XSS) occurs entirely on the client-side, where the malicious payload is executed by the browser as a result of modifying the Document Object Model (DOM) environment. This typically happens when client-side script reads data from a controllable source, such as the URL fragment, and writes it into an unsafe sink within the DOM. Unlike stored XSS, the server never processes or stores the malicious script, making it harder to detect with server-side scanning.
- ✗
Reflected XSS
Why it's wrong here
Reflected Cross-Site Scripting (XSS) involves injecting malicious script into a web application's HTTP request, which is then immediately 'reflected' back in the server's HTTP response to the user's browser. The payload is not persistently stored on the server; instead, it executes only once for the user who makes the crafted request. This type of XSS often relies on social engineering to trick a victim into clicking a malicious link containing the payload.
- ✗
Self-XSS
Why it's wrong here
Self-XSS is a form of Cross-Site Scripting that requires the victim to manually paste and execute malicious JavaScript code into their own browser's developer console. This attack vector primarily relies on social engineering tactics to convince a user to compromise their own session, rather than exploiting a vulnerability in how the application handles and renders user input. Since it demands explicit user action within their browser's debugging tools, it does not automatically affect other users viewing a submitted comment.
- ✓
Stored XSS
Why this is correct
Stored Cross-Site Scripting (XSS), also known as Persistent XSS, occurs when a malicious script is permanently saved on the target server, typically within a database, message board, or comment section. When any user subsequently accesses the affected web page, the server retrieves and delivers the stored malicious payload along with the legitimate content. This script then executes automatically in the victim's browser, impacting all users who view the compromised data without requiring any specific interaction from them beyond page access.
Go deeper
Related to this question
About these practice questions
One of 870 original CEH practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CEH practice question is part of Courseiva's free EC-Council 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 CEH exam.