Skip to main content

Glossary

What Is XSS

XSS is an attack where malicious code is injected into a website and runs in visitors' browsers. Plain-English definition for business owners.

Definition

XSS (Cross-Site Scripting) is a type of security vulnerability where an attacker manages to inject malicious code, usually JavaScript, into a website that other people visit. When a visitor loads the affected page, the injected code runs in their browser as if it were a legitimate part of the site. This can allow the attacker to steal login sessions, redirect users to fake pages, capture form data, or deface the website. XSS exploits the trust a user's browser places in the website it is visiting.

Why It Matters

XSS is consistently ranked among the most common web security vulnerabilities, and it can affect any website that displays user-generated content without properly sanitising it. Comment sections, search boxes, contact forms, and review pages are all potential entry points. If your website is vulnerable, an attacker could steal your customers’ session data and impersonate them, harvest personal information entered into forms, or damage your brand by altering what visitors see. Fixing XSS vulnerabilities is a fundamental part of web development, and any competent development team should be testing for them routinely.

Example

Your website has a search feature that displays “You searched for: [search term]” on the results page. An attacker crafts a special link containing malicious code in the search parameter and shares it in an email. When someone clicks the link, the search page renders the malicious code as part of the page. That code silently sends the visitor’s session cookie to the attacker, who can then log in as that visitor. Proper input sanitisation would have stripped the malicious code before displaying it. XSS sits in our glossary alongside SQL injection and the broader idea of a vulnerability.

Portrait of Alexander De Sousa, founder of Digital Royalty
Founder-led
“I’ve put everything I know into how this company works — the standards, the method, the care on every project. It runs through the whole team, and I hold us all to it.”

Alexander De Sousa · Founder LinkedIn

Featured on BBC Radio Solent

Get started

Tell us what you need

A few quick questions, then a straight answer from a real person — usually within a few hours.

Tell us what you're working on

Whether it's a new site, a platform, or a process that shouldn't be manual any more — we'll tell you honestly if we can help.