SMB

Server Message Block

Check for SMB vulnerablities with Nmap:

$ sudo nmap -sV --script-args=unsafe=1 --script smb-os-discovery 10.10.13.37 -p139,445
$ sudo nmap -n -Pn -sV --script 'smb-vuln*' 10.10.13.37 -p445

Check if SMB Signing is enabled with CME:

$ cme smb smb.txt | grep -a 'signing:False'

Fingerprint

Enumerate SMB version for old versions of Samba (for security reasons modern clients will not initiate connection with legacy protocols in use):

$ sudo ngrep -i -d eth0 's.?a.?m.?b.?a.*[[:digit:]]' port 139
$ echo exit | smbclient -N -L 10.10.13.37 --option='client min protocol=LANMAN1'

Mounting

Mount:

$ sudo mount -t cifs '//127.0.0.1/Users' /mnt/smb -v -o user=snovvcrash,[pass='Passw0rd!']

Status:

$ mount -v | grep 'type cifs'
$ df -k -F cifs

Unmount:

SMB Share with Null Authentication

Create an SMB share allowing null authentication.

Linux

Windows

Hunt for Shares & Content

Toy Example

Collect listing of files with size < 10 Mb:

Filter only files of interest based on their extensions, print the stats as a Python dict:

Generate a list of wanted files (Python) and copy them locally preserving original directory structure (PS):

Tools

rpcclient

Check for null authentication:

With user creds:

Local users info:

smbclient(.py)

Check for null authentication:

With user creds:

Get all files recursively:

Local admin spray:

smbmap

Last updated