---
title: "What is cross-site scripting?"
term: "cross-site scripting"
description: "Cross-site scripting (XSS) is a web security vulnerability that lets an attacker inject malicious scripts into pages viewed by other users, where the scripts run with the trust and access of the vulnerable site."
url: "https://glossary.io/cross-site-scripting/"
published: "2026-11-22T20:33:27.587Z"
updated: "2026-11-22T20:33:27.587Z"
aliases:
  - "XSS"
topics:
  - "Privacy and security"
  - "Web development"
wikidata: "https://www.wikidata.org/wiki/Q371199"
---

# What is cross-site scripting?

**Definition:** Cross-site scripting (XSS) is a web security vulnerability that lets an attacker inject malicious scripts into pages viewed by other users, where the scripts run with the trust and access of the vulnerable site.

**Also known as:** XSS

XSS happens when a site includes untrusted input, such as a comment, a search term or a URL parameter, in a page without properly escaping or sanitizing it. In stored XSS the malicious script is saved on the server and served to every visitor, in reflected XSS it arrives through a crafted link, and in DOM-based XSS the site's own [JavaScript](https://glossary.io/javascript/) writes the input into the page. Once running, the script can steal session data, change content or act as the user.

XSS is one of the most common web vulnerabilities and a frequent reason for security releases in platforms such as [WordPress](https://glossary.io/wordpress/) and its plugins. Defenses include escaping output for its context, sanitizing any HTML that users can submit, using frameworks that escape by default, and adding a [Content Security Policy](https://glossary.io/content-security-policy/) and Trusted Types to limit which scripts can run.

## cross-site scripting resources

- [Cross-site scripting on Wikipedia](https://en.wikipedia.org/wiki/Cross-site_scripting)
- [WordPress releases version 5.2.3 with several security fixes](https://coywolf.com/news/web-development/wordpress-5-2-3-update/)

## Related terms

- [Content Security Policy](https://glossary.io/content-security-policy/)
- [WordPress](https://glossary.io/wordpress/)
- [JavaScript](https://glossary.io/javascript/)
- [SVG](https://glossary.io/svg/)
- [Twig](https://glossary.io/twig/)
- [web application firewall](https://glossary.io/web-application-firewall/)

**Topics:** [Privacy and security](https://glossary.io/topics/privacy-security/), [Web development](https://glossary.io/topics/web-development/)

## Cite this definition

- APA: What is cross-site scripting? (2026, November 22). Glossary. https://glossary.io/cross-site-scripting/
- MLA: “What Is Cross-Site Scripting?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/cross-site-scripting/.
- Chicago: “What Is Cross-Site Scripting?” Glossary. Coywolf. November 22, 2026. https://glossary.io/cross-site-scripting/.

Published November 22, 2026.
