DOM‑based XSS occurs when the client‑side script processes user input and writes it directly back to the DOM. In Juice Shop, the search function reflects HTML without sanitisation, allowing attackers to execute arbitrary JavaScript in the browser.
Sample payloads:
<svg/onload=alert('DOMXSS')>
<img src="x" onerror="document.body.innerHTML='Hacked!'">
innerHTML or similar APIs to insert untrusted content.textContent, append()) to handle user input.