03 - DOM XSS in document.write sink using source location.search
To solve this lab, perform a cross-site scripting attack that calls the alert function.
Given - XSS in search functionality
End goal - call alert function
Start the lab, on hompage there would be a search functionality. If i search for the word hello -
After looking in the source code we get that our search keyword is directly getting added into image's href attribute. Now construct the payload that closes the tag and call the function.
Payload - "><script>alert(3)</script>
It popped up a alert
Lab solved :