Blind OS command injection with output redirection writeup

Descripción

This lab contains a blind OS command injection vulnerability in the feedback function.

The application executes a shell command containing the user-supplied details. The output from the command is not returned in the response. However, you can use output redirection to capture the output from the command. There is a writable folder at:

/var/www/images/

The application serves the images for the product catalog from this location. You can redirect the output from the injected command to a file in this folder, and then use the image loading URL to retrieve the contents of the file.

To solve the lab, execute the whoami command and retrieve the output.

Blind OS command injection with time delays writeup

Para completar este laboratorio hay que explotar 2 vulnerabilidades:

OS command injection

Entraremos al laboratorio e iremos directamente a ‘Submit feedback’. Ahí veremos un formulario que podemos rellenar. Encenderemos el ‘Logger’ y enviaremos un mensaje de prueba. Enviaremos la petición al ‘Repeater’ con Ctrl + R o Click derecho -> Send to Repeater. Allí realizaremos las pruebas:

En este caso inyectaremos el siguiente comando en el campo email:

Tendremos que codificarlo como URL con Ctrl + U. Este comando tomará el nombre del usuario (whoami) y redigirá su salida (el nombre del usuario) al archivo ‘salida.txt’ en la carpeta ‘/var/www/images/’, que es la que nos ha dicho la descripción del laboratorio que es accesible directamente.

||whoami > /var/www/images/salida.txt||

Lectura de archivos del servidor

Entraremos ahora en un artículo cualquiera, veremos que se realiza una petición para obtener su imagen:

Enviaremos esta petición al ‘Repeater’ con Ctrl + R o Click derecho -> Send to Repeater. Allí cambiaremos el ’36.jpg’ por ‘salida.txt’:

Al enviar la petición obtendremos el nombre del usuario y habremos completado el laboratorio:

Deja una respuesta

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