🔐Cross-Site Scripting (XSS)
Also known as XSS, XSS Attack, Script Injection, Stored XSS, Reflected XSS, DOM-based XSS
An attack that hides a script in a page. It runs for everyone who visits.
Think of it like
Think of it like a fake note pinned on a shop's board. Every shopper thinks it is real.
Example
Emma's blog shows comments as raw HTML. Someone posts a comment with a script tag, and it runs for every reader who opens the post.
Why it matters
A script on your page can do anything the user can. One comment box can expose every account.
Definition
Example code
html
<p>Great post! <script>alert(1)</script></p>Common mistake
Key takeaways
- 1Text becomes code. In the browser.
- 2Runs as the site. Steals or acts as users.
- 3Escape on output. Every piece of user text.