This lab contains a DOM-based cross-site scripting vulnerability in the search blog functionality. It uses an
innerHTML
assignment, which changes the HTML contents of adiv
element, using data fromlocation.search
.To solve this lab, perform a cross-site scripting attack that calls the
alert
function.



As we can see here innerHTML sink used.
Checking BurpAcademy DOM based Cross Site Scripting documentation.
The
innerHTML
sink doesn’t acceptscript
elements on any modern browser, nor willsvg onload
events fire. This means you will need to use alternative elements likeimg
oriframe
. Event handlers such asonload
andonerror
can be used in conjunction with these elements. For example:
element.innerHTML='... <img src=1 onerror=alert(document.domain)> ...'
If we then try: '><img src=1 onerror=alert(document.domain)>

Lab is solved!