Attacks and Exploits

A product review field is saved by the server and shown unencoded to every visitor of the page. Which input BEST demonstrates stored cross-site scripting?

Show the answer

Correct answerA. <script>alert(document.domain)</script>

AWhy this is right: Stored unencoded, the script runs in each visitor's browser in the site's origin, which shows stored XSS.

BWhy not this: This is a command injection payload; it needs a shell on the server and does not run in browsers.

CWhy not this: This is a template injection probe; it is evaluated by a server-side template engine, not by the browser.

DWhy not this: This is a SQL injection payload; it targets a database query and does not execute in a visitor's browser.

The script tag is stored and then runs in each visitor's browser because the output is not encoded, which is stored XSS. The UNION payload attacks a database query, not the browser rendering the page.