kb/data/developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting-0.md

10 KiB

title chunk source category tags date_saved instance
Cross-site scripting (XSS) - Glossary | MDN 1/3 https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting reference web, html, css, javascript, documentation 2026-05-05T05:28:44.808147+00:00 kb-cron

MDN HTML HTML: Markup language

HTML reference

HTML guides

Markup languages

CSS CSS: Styling language

CSS reference

CSS guides

Layout cookbook

JavaScriptJS JavaScript: Scripting language

JS reference

JS guides

Web APIs Web APIs: Programming interfaces

Web API reference

Web API guides

All All web technology

Technologies

Topics

Learn Learn web development

Frontend developer course

Learn HTML

Learn CSS

Learn JavaScript

Tools Discover our tools

About Get to know MDN better

Blog

  1. Glossary
  2. Cross-site scripting (XSS)

Cross-site scripting (XSS)

A cross-site scripting (XSS) attack is one in which an attacker is able to get a target site to execute malicious code as though it was part of the website. The code can then do anything that the site's own code can do. For example, the attacker could:

  • Access and modify all the content of the site's loaded pages, and any content in local storage
  • Make HTTP requests with the user's credentials, enabling them to impersonate the user or access sensitive data

All XSS attacks depend on a website doing two things:

  1. Accepting some input that could have been crafted by an attacker
  2. Including this input in a page without sanitizing it: that is, without ensuring that it won't be executable as JavaScript

In this article

See also