liveBook · Manning

Cross-site scripting attack

As explained in 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.

Cross-site scripting (XSS) occurs when a web application fails to validate or sanitize user input and includes an attacker’s script or HTML in a page. The user’s browser then executes the injected code. section 12.3.2

From input to impact

A form accepts <script>alert('XSS')</script> and returns it in a page; the browser runs it and displays a popup. A real attack could steal session cookies, hijack an account, redirect users to phishing sites, or deliver malware. section 12.3.2

Figure 12.2 Illustration of a Cross-Site Scripting (XSS) attack.

Follow how weak input validation lets an injected script reach a response page and run in the browser. section 12.3.2

How Fundamentals of Cybersecurity covers it

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.
How it connects
Connects XSS to scripting attacks, web applications, input validation, JavaScript, session cookies, phishing, and malware.

Also explained in

Compare how 6 books explain cross-site scripting attack →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fundamentals of Cybersecurity. The section links point to the parts of the book it draws on.