1. Home
  2. Knowledge Center
  3. Glossary
  4. Cross-site scripting (XSS)
Application vulnerabilities

Cross-site scripting (XSS)

XSS · cross site scripting · stored XSS · reflected XSS · DOM-based XSS · script injection · faille XSS

A web application flaw that lets an attacker inject JavaScript into a page viewed by other users, and so act inside their browser on their behalf.

In practice

The injected script runs with the victim’s rights on the site: it can hijack their session, alter what they see (a fake login form) or carry out actions in their name. There are three main kinds: stored XSS (the code is saved, for instance in a comment, and hits every visitor), reflected XSS (delivered through a malicious link) and DOM-based XSS (entirely in the browser). It is one of the most widespread flaws: the OWASP Top 10:2025 counts more than 30,000 XSS CVEs, within the Injection category (A05).

Example

Fictional case: on a supplier’s extranet, the “company name” field is not encoded when displayed. An attacker plants a script there; every time an administrator views the list of accounts, the script sends their session to the attacker, who takes over the admin interface.

How to protect yourself

  • Encode all displayed data for its context (HTML, attribute, JavaScript, URL).
  • Rely on the framework’s automatic escaping and ban its bypass functions.
  • Sanitise user-supplied HTML with a proven library.
  • Add a Content Security Policy (CSP) and HttpOnly cookies as additional layers.

Sources

The whole glossary

From theory to practice

So how does your system measure up?

Create your account and get an A+ to F grade for your domains’ encryption in minutes, with every finding explained and the fix to apply.

Run the audit from your account: an A+ to F grade for your domains’ encryption in minutes, with every finding explained and the fix to apply.

Belinda

Contact us

A question, a project, a partnership? Write to us: the team answers by email, usually within one business day.

Your details are only used to answer you. Do not include passwords or vulnerability details.