Abstract security visualization, representing cross-site scripting.

When a site runs an attacker's script in your browser.

What cross-site scripting is

Cross-site scripting, often abbreviated XSS, is a type of web security vulnerability in which an attacker injects malicious scripts into web pages that are then viewed by other users. When a victim loads the affected page, the injected script runs in their browser as though it came from the trusted site. This lets the attacker carry out actions or access information in the context of that site.

How the attack works

XSS typically occurs when a website includes untrusted input in its pages without properly handling it. An attacker supplies input containing a script, and if the site inserts that input into a page without neutralizing it, the script becomes part of the page. Other users who view the page then unknowingly run the attacker's script in their own browsers, which is the core of the attack.

Why XSS is dangerous

Because the injected script runs in the victim's browser with the trusted site's privileges, it can do things the user did not intend. It might access information the site has, perform actions on the user's behalf, or manipulate what the user sees. This makes XSS a serious vulnerability, since it undermines the trust between a user and a website and can compromise user data or accounts.

Different forms of XSS

Cross-site scripting can take different forms depending on how the malicious script reaches the victim. In some cases the script is stored on the site and served to many users; in others it is reflected back from a request, or introduced through the page's own scripts. Despite these variations, the common thread is that untrusted input ends up executing as a script in users' browsers.

Preventing XSS

Preventing cross-site scripting centers on properly handling untrusted input and output. By treating user-supplied data carefully, for example by neutralizing it so it cannot be interpreted as a script when placed into a page, sites can stop injected content from running. Careful handling of what goes into web pages is the main defense, which is why input and output handling are emphasized in web security.

Why it matters

Cross-site scripting is one of the most important web security vulnerabilities to understand. Knowing what XSS is - injecting scripts that run in other users' browsers - clarifies a common class of web attacks and why careful handling of data in web pages matters. For anyone interested in web security, it is a valuable concept to understand.

See also: What is a cookie? Explained, What is a content security policy? Explained.

Sources

Published date reflects the original event date (2026-04-14). This article is original Skillo editorial written from the sources above; facts were verified in September 2026.

Skillo Staff

Skillo Staff

All stories by: Skillo Staff

Leave a Reply