XSS Payloads

← back to Payloads
// Cross-Site Scripting
Injection of malicious scripts into web pages viewed by other users — session theft, credential capture, page manipulation.
XSS
XSS — Basic JavaScript Payload
Understanding the fundamental JavaScript payload structure used in Cross-Site Scripting attacks — the foundation before moving to advanced XSS techniques.
xsscross-site-scriptingpayloadsjavascriptreflected-xssstored-xss
XSS
XSS — Encoded & Obfuscated Payloads
When WAFs and filters block raw XSS strings, Base64-encode your payload and use eval(atob()) or btoa(eval(atob())) to execute it — bypassing signature-based ...
xsscross-site-scriptingpayloadswaf-bypassobfuscationbase64
XSS
XSS — Escaping innerHTML: Cookie Steal via img onerror
When the injection point is inside innerHTML, script tags don't fire — but img onerror does. This one-liner exfiltrates localStorage without needing a script...
xsscross-site-scriptingpayloadsdom-xssinnerhtmlonerror-bypass
XSS
XSS — Keylogging via XSS
Attach a keydown event listener through an XSS payload to silently capture everything the victim types — passwords, search queries, form inputs — and stream ...
xsscross-site-scriptingpayloadskeyloggingcredential-capturejavascript
XSS
XSS — Moving the Payload to an External Resource
When inline script injection is blocked, host your payload externally and load it via a script src tag — bypassing length limits and WAF rules that filter in...
xsscross-site-scriptingpayloadsjavascriptwaf-bypassreflected-xss
XSS
XSS — Page-Replacement Phishing
Replace the entire page with a cloned login form via XSS — the URL stays legitimate, the victim trusts it, and credentials go directly to your server.
xsscross-site-scriptingpayloadsphishingcredential-theftdom-manipulation
XSS
XSS — Stealing Browser-Saved Passwords
Inject hidden username and password fields into the DOM — browsers auto-fill them with saved credentials. A delayed fetch sends those credentials to your ser...
xsscross-site-scriptingpayloadscredential-theftpassword-theftautofill-attack
XSS
XSS — Stealing Local & Session Storage Secrets
Many apps store JWTs, API keys, and user data in localStorage and sessionStorage. This XSS payload silently exfiltrates all of it to your server.
xsscross-site-scriptingpayloadslocalstoragesessionstoragejwt
XSS
XSS — Stealing Session Cookies
Use an XSS injection to exfiltrate the victim's session cookie to your server — achieving full account takeover without knowing their password.
xsscross-site-scriptingpayloadssession-hijackingcookie-theftaccount-takeover
XSS
XSS — Stored Keylogger with Error Handling
A production-grade XSS keylogger that handles network errors gracefully and logs each keystroke with confirmation — designed for stored XSS contexts where pe...
xsscross-site-scriptingpayloadskeyloggingstored-xsscredential-capture