liveBook · Manning

Cross-site scripting attack

Also called XSS

Cross-site scripting is a web security vulnerability in which attacker-controlled content causes executable script to run in another user’s browser within a trusted application context.

How 6 Manning books explain it

Acing the Frontend Interview

Cross-site scripting is an injection attack in which untrusted content causes scripts to execute in a user’s browser.

How it is used
Frames XSS as a security risk to address when handling HTML form input.
How deep it goes
Explains server-side sanitization as removing or encoding harmful content, without an attack walkthrough or sanitization code.
Examples
Uses potentially harmful scripts and HTML tags as input to remove or encode; provides no XSS payload.
What you can do after
Practice/perform server-side sanitization of form input and distinguish it from validation and other security safeguards.

Read how Acing the Frontend Interview explains cross-site scripting attack →

The Well-Grounded Python Developer: How the pros use Python and Flask

Cross-site scripting is a web security attack in which injected script content executes in another user's browser.

How it is used
Frames a security risk when a blog accepts user-written posts or comments and displays them to other visitors.
How deep it goes
Defines the attack through a stored-script scenario and shows a form-filter defense, without detailing browser execution internals.
Examples
Uses a blog post containing an embedded script and a post-content field configured with a sanitizing filter.
What you can do after
Apply it via Bleach by filtering user-entered form text before it is saved.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains cross-site scripting attack →

Grokking Web Application Security

Cross-site scripting (XSS) is a web vulnerability in which attacker-controlled script code is injected into content rendered for other users.

How it is used
Protects users of trusted web applications from attacker-supplied JavaScript running in their browsers.
How deep it goes
Explains the request-to-rendering attack path, stored XSS, concrete consequences, HTML escaping, template behavior, and CSP.
Examples
Uses a malicious comment, script-tag rendering, cookie redirection, and a stored-comment scenario to demonstrate the attack.
What you can do after
Apply output escaping for dynamic HTML and set a Content Security Policy to protect users against XSS.

Read how Grokking Web Application Security explains cross-site scripting attack →

ASP.NET Core in Action, 3e

Cross-site scripting is a web security vulnerability in which attacker-controlled content is injected into pages and executed in a victim's browser.

How it is used
Protects web applications and users from injected JavaScript during page rendering.
How deep it goes
Explains the attack flow, Razor's automatic encoding, raw output, and context-specific HTML versus JavaScript encoding.
Examples
Uses submitted names, @Html.Raw(), Razor expressions, JavaScriptEncoder, script variables, and HTML data attributes.
What you can do after
Apply it via Razor Pages by encoding unsafe output and selecting HTML or JavaScript encoding for each rendering context.

Read how ASP.NET Core in Action, 3e explains cross-site scripting attack →

Fundamentals of Cybersecurity

Cross-site scripting is an attack that injects executable client-side code into content served to users by a trusted website or application.

How it is used
Explains how attackers exploit weak input handling in web applications to inject scripts into pages users receive.
How deep it goes
Traces an input payload through page response and browser execution, then gives possible impacts without detailing defenses.
Examples
Uses a form-injected JavaScript alert to demonstrate execution and contrasts it with cookie theft, phishing redirects, and malware delivery.
What you can do after
Understand how weak input handling can make a browser execute injected code and expose users to account compromise.

Read how Fundamentals of Cybersecurity explains cross-site scripting attack →

Web Component Development with Modern Libraries and Tooling

A security attack in which injected script executes in a user's web context through insufficiently sanitized content.

How it is used
Uses cross-site scripting attacks to motivate safe DOM rendering in custom elements.
How deep it goes
Contrasts unsafe innerHTML interpolation with textContent and limits innerHTML to trusted HTML.
Examples
Uses a hello-world custom element whose name attribute becomes either textContent or interpolated innerHTML.
What you can do after
Apply DOM APIs to render attribute values as text and recognize when interpolated HTML creates an XSS risk.

Read how Web Component Development with Modern Libraries and Tooling explains cross-site scripting attack →

Also covered in

What to know first

Related concepts

Questions about cross-site scripting attack

What is cross-site scripting attack?

Cross-site scripting is a web security vulnerability in which attacker-controlled content causes executable script to run in another user’s browser within a trusted application context.

Which Manning books explain cross-site scripting attack?

Acing the Frontend Interview, The Well-Grounded Python Developer: How the pros use Python and Flask, Grokking Web Application Security, ASP.NET Core in Action, 3e, Fundamentals of Cybersecurity and Web Component Development with Modern Libraries and Tooling.

What should I know before learning cross-site scripting attack?

Manning books that teach cross-site scripting attack usually introduce HTML, JavaScript, cookie and Document Object Model first.

What kinds of cross-site scripting attack are there?

Kinds of cross-site scripting attack include dom-based injection.

What is cross-site scripting attack a kind of?

Cross-site scripting attack is a kind of injection attack. An injection attack is a security attack in which crafted or untrusted input is interpreted as commands, code, or query structure by a target system.

What is cross-site scripting attack also called?

Cross-site scripting attack is also called XSS.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.