
Descripción
This lab is vulnerable to DOM XSS via client-side prototype pollution. To solve the lab:
- Find a source that you can use to add arbitrary properties to the global
Object.prototype
. - Identify a gadget property that allows you to execute arbitrary JavaScript.
- Combine these to call
alert()
.
You can solve this lab manually in your browser, or use DOM Invader to help you.
DOM XSS via client-side prototype pollution writeup
Realizaremos este laboratorio de forma manual, dividiéndolo en varios pasos:
Encontrar dónde hacer el prototype pollution
En la URL insertaremos el siguiente código:
/?__proto__[test]=valortest
Para añadir al objeto __proto__ el atributo ‘test’ con el valor ‘valortest’. Si al acceder llamamos al objeto ‘Object.prototype’, veremos que lo hemos inyectado correctamente:

Encontrar qué propiedad modificar
Exploraremos el JavaScript de la página, en el archivo ‘searchLogger.js’ existe el siguiente código:
async function searchLogger() {
let config = {params: deparam(new URL(location).searchParams.toString())};
if(config.transport_url) {
let script = document.createElement('script');
script.src = config.transport_url;
document.body.appendChild(script);
}
}
Este código se encarga de crear un elemento ‘<script>’ en la página y coloca como fuente ‘src’ la propiedad ‘transport_url’ del objeto ‘config’. Intentaremos inyectar aquí nuestro ‘alert()’:
Inyectar el código
Añadiremos a la URL el siguiente fragmento:
/?__proto__[transport_url]=data:,alert(1);
Añadiendo a todos los objetos la propiedad »transport_url’ con el valor ‘data:,alert(1);’. Ahora la entrar se ejecutará un alert() y completaremos el laboratorio:
