Ports 139 | 445 | SMB

Enumeration

Identify SMB running on a host. List only open ports.

sudo nmap -sT -sU -sV -p135,137,138,139,445 --open <IP>

Nmap Scripts

# Enumerate shares
nmap --script smb-enum-shares -p 445 <IP>
# OS Discovery
nmap --script smb-os-discovery -p 445 <IP>
# Enumerate Users
nmap --script=smb-enum-users -p 445 <IP>
# All
nmap --script=smb-enum-users,smb-enum-shares,smb-os-discovery -p 139,445 <IP>

NULL / Anonymous Login

# On some configuration omitting '-N' will grant access.
smbclient -U '' -L \\\\<IP> 

smbclient -U '' -N -L \\\\<IP> 
smbclient -U '%' -N -L \\\\<IP>
smbclient -U '%' -N \\\\<IP>\\<Folder>

# Enter a random username with no password and try for anonymous login.
crackmapexec smb <IP> -u 'anonymous' -p ''

crackmapexec smb <IP> -u '' -p ''
crackmapexec smb <IP> -u '' -p '' --shares

Authenticated

Download Files

Tools

Enum4Linux

Run batch commands against a target.

Crackmapexec

Command execution and enumeration from Linux

PsMapExec

Command execution and enumeration from Windows

User Enumeration

Nmap

Exploits

Samba

Platform
Link

Metasploit

auxiliary/admin/smb/samba_symlink_traversal

Last updated