Concepts / Web injection and scripting

Web injection and scripting

Cross-site scripting

Also called XSS, stored XSS, reflected XSS

Getting a web app to serve your JavaScript to other users, so it runs in their browser as the site itself.

The site serves the attacker's script
The site serves the attacker's script

In stored XSS the script is saved once and served to every later visitor. Their browser runs it as the site's own code, so it can read the session cookie and send it away.

Cross-site scripting (XSS) is getting a web app to serve your JavaScript to other users, so it runs in their browser as the site itself. It happens when input is put into HTML unescaped. Reflected XSS echoes a script from the URL; stored XSS saves it and serves it to every later visitor. The script can read cookies (document.cookie, unless HttpOnly) and send them away. The fix is [[output-encoding]].

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab