Cross-Site Scripting
Cross-site scripting (XSS) is a web security vulnerability that lets an attacker inject malicious code into an otherwise legitimate or trusted website. When a victim's browser loads the affected page, that injected code runs as though it were a genuine part of the site, which can allow the attacker to interfere with how users interact with the website.
Cross-site scripting (XSS) is a class of web application vulnerability in which an attacker injects malicious scripts into content served by a benign or trusted site, causing the target site to execute that code in a victim's browser as though it originated from the site itself. The injected script acquires the permissions and origin context of scripts legitimately served by the site, enabling the attacker to compromise the interactions users have with the application. Recognized variants include reflected XSS, in which attacker-supplied input is reflected back to the user (for example, via a malicious link that, when clicked, causes the payload to be returned and executed). The specific impact and exploitation path depend on implementation details and the context in which untrusted data is rendered.
Why it matters
Cross-site scripting matters to payment and e-commerce environments because a checkout page, account portal, or hosted payment form is exactly the kind of trusted website where injected script can do the most damage. When code the attacker controls runs in the victim's browser with the origin and permissions of the legitimate site, it can interfere with how users interact with that application at the precise moment they are entering cardholder data. This is a browser-side execution problem, so it can affect data as it is captured, before any server-side encryption or tokenization is applied.
For teams operating payment applications, XSS is significant because it targets the front end rather than the back-end datastore, meaning controls focused on stored-data protection do not address it. A vulnerability that allows an attacker to inject script into pages served by an otherwise benign site can undermine the confidentiality and integrity of user interactions regardless of how well downstream systems are hardened. The specific impact depends on implementation details and the context in which untrusted data is rendered, so the same flaw class can range from limited to serious depending on where and how the page mishandles input.
Because the impact and exploitation path vary by implementation, XSS should be understood as a class of vulnerability rather than a single fixed threat. Exact prevalence, cost, and breach figures depend on the source, period, and methodology of any given study and should not be assumed; the concept is best treated qualitatively as a persistent, high-priority category of web application risk.
Who it's relevant to
Inside XSS
Common questions
Answers to the questions practitioners most commonly ask about XSS.