Problems/XSS Attack & Prevention#86MediumWeb Attacks· XSSXSS Attack & PreventionDemonstrate 3 types of XSS: (1) Reflected: search parameter echoes <script>alert(1)</script>, (2) Stored: comment with malicious script, (3) DOM-based: innerHTML injection. For each: show vulnerable code, craft payload, show fix (output encoding, CSP, HttpOnly cookies). Implement a simple XSS filter that sanitizes HTML.#security#xss#web-attacks