Descripción

This lab is built on Node.js and the Express framework. It is vulnerable to server-side prototype pollution because it unsafely merges user-controllable input into a server-side JavaScript object.

Due to the configuration of the server, it’s possible to pollute Object.prototype in such a way that you can inject arbitrary system commands that are subsequently executed on the server.

To solve the lab:

  1. Find a prototype pollution source that you can use to add arbitrary properties to the global Object.prototype.
  2. Identify a gadget that you can use to inject and execute arbitrary system commands.
  3. Trigger remote execution of a command that deletes the file /home/carlos/morale.txt.

In this lab, you already have escalated privileges, giving you access to admin functionality. You can log in to your own account with the following credentials: wiener:peter

Remote code execution via server-side prototype pollution writeup

Entraremos en el laboratorio e iniciaremos sesión con el usuario ‘wiener’ y la contraseña ‘peter’. Al hacerlo volveremos a ver el formulario de los laboratorios anteriores:

Enviamos el formulario y capturamos la petición con el ‘Logger’ de Burp Suite:

Esta vez tendremos la propiedad ‘isAdmin’ en ‘true’, si intentamos modificar su valor con un prototype injection no dará resultado, por lo que añadiremos una propiedad inventada y veremos si la acepta:

Esto nos dice que la página sí que es vulnerable a ‘prototype pollution’. Como sabemos por la descripción del laboratorio que la aplicación web está hecha en NodeJS, insertaremos el siguiente código:

"__proto__": {
    "execArgv":[
        "--eval=require('child_process').execSync('rm /home/carlos/morale.txt')"
    ]
}

Este código realiza lo siguiente:

Ahora, para ejecutarmo iremos a ‘Admin panel’ y pulsaremos en ‘Run maintenance jobs’, finalizando así el laboratorio:

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *