Contrast reflected versus stored XSS. Reflected comes from URL parameters, stored is…
- User
Contrast reflected versus stored XSS. Reflected comes from URL parameters, stored is saved in DB. Which is more dangerous and why?
- Assistant
Explaining reflected vs. stored XSS risks
Reflected XSS occurs when malicious scripts come from user-supplied data in a URL and affect only users who click a crafted link, while stored XSS involves malicious code saved in a database and served to multiple users persistently. Stored XSS is generally more dangerous because it can impact many users over time without requiring them to click a specific link. Cross‑site scripting is about getting the browser to execute untrusted script in the context of a trusted origin, but there are a couple of patterns in how that script gets to the page:
-
In a reflected XSS scenario the malicious payload is part of the current request, e.g. a query string or form field that the application immediately reflects back into the HTML without encoding. Only the user who follows or crafts that URL sees the script execute, and it only runs for the lifetime of that response.
-
In a stored (or persistent) XSS, the payload is written to some back‑end store – a database, comment table, user profile, etc. – and later read back out and rendered for other users. Anyone who views the affected content will have the script executed in their browser until it is cleaned up.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.