GCIH · Question #767
A victim visits a website that allows authenticated users to upload articles for other users to read. The victim logs in and clicks a link on the website's home page for a newly posted article. When…
The correct answer is B. Stored XSS. Stored XSS occurs when malicious scripts are persisted on the server and executed in the browser of any user who views the affected content.
Question
A victim visits a website that allows authenticated users to upload articles for other users to read. The victim logs in and clicks a link on the website's home page for a newly posted article. When the article's page opens, malicious code embedded in the uploaded article runs in the victim's browser, sending sensitive information to the malicious code's author. What web application vulnerability allowed this attack to happen?
Options
- ASQL injection
- BStored XSS
- CCross-Site Request Forgery
- DSession hijacking
How the community answered
(23 responses)- B91% (21)
- C4% (1)
- D4% (1)
Why each option
Stored XSS occurs when malicious scripts are persisted on the server and executed in the browser of any user who views the affected content.
SQL injection manipulates database queries through unsanitized input; it does not cause script execution in a victim's browser.
In a stored XSS attack, the attacker uploads malicious JavaScript as part of content (here, an article) that the application saves to the database. When any authenticated user later loads that page, the server delivers the malicious script as part of the page, the browser treats it as legitimate, and the script executes with access to the victim's session cookies and DOM - allowing exfiltration of sensitive data to the attacker.
Cross-Site Request Forgery tricks a victim's browser into making authenticated requests to a site, but does not involve injecting and executing malicious code within the site itself.
Session hijacking involves stealing an existing session token after it is obtained by other means; it is not a vulnerability that causes malicious code to run in the victim's browser.
Concept tested: Stored XSS persistent script injection attack
Source: https://owasp.org/www-community/attacks/xss/
Topics
Community Discussion
No community discussion yet for this question.