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





