Security

A forum stores a comment containing a script, and the script runs in other users' browsers and sends their session cookies to the attacker. Which attack is this?

Show the answer

Correct answerC. Cross-site scripting

AWhy not this: Spoofing forges a trusted identity or address and does not run script in a browser.

BWhy not this: An on-path attack intercepts traffic in transit and does not plant script in a web page.

CWhy this is right: Attacker script stored in a page runs in visitors' browsers and steals cookies, which defines XSS.

DWhy not this: SQL injection runs commands in the database; nothing here is executed by a database.

Cross-site scripting injects script into a web page so it runs in other visitors' browsers, here stealing session cookies. SQL injection also abuses unvalidated input, but its commands run in the back-end database, not in a victim's browser.