From XSS at Wikipedia:
There are three distinct known types of XSS vulnerabilities to date. DOM-based or local (Type 0), non-persistent/reflected (Type 1) and persistent or stored (Type 2) cross-site scripting.
- Mallory sends a URL to Alice (via email or another mechanism) of a maliciously constructed web page.
- Alice clicks on the link.
- Mallory’s malicious script now may run commands with the privileges Alice holds on her own computer.
- Alice often visits a particular website, which is hosted by Bob. Bob’s website allows Alice to log in with a username/password pair and store sensitive information, such as billing information.
- Mallory observes that Bob’s website contains a reflected XSS vulnerability.
- Mallory crafts a URL to exploit the vulnerability, and sends Alice an email, making it look as if it came from Bob.
- Alice visits the URL provided by Mallory while logged into Bob’s website.
- The malicious script embedded in the URL executes in Alice’s browser, as if it came directly from Bob’s server. The script steals sensitive information (authentication credentials, billing info, etc) and sends this to Mallory’s web server without Alice’s knowledge.
- Bob hosts a web site which allows users to post messages and other content to the site for later viewing by other members.
- Mallory notices that Bob’s website is vulnerable to a type 2 XSS attack.
- Mallory posts a message, controversial in nature, which may encourage many other users of the site to view it.
- Upon merely viewing the posted message, site users’ session cookies or other credentials could be taken and sent to Mallory’s webserver without their knowledge.
- Later, Mallory logs in as other site users and posts messages on their behalf….