📘
OSCP Exam Prep
OSCP Exam Prep
OSCP Exam Prep
  • Reference List
  • Guideline
  • Commons
    • Basic Scans
    • Service Enumeration
      • HTTP(S) (80 / 443)
      • SMB (139 / 445)
      • FTP (21)
      • DNS (53)
      • SSH (22)
      • LDAP (389/636/3268)
      • Kerberos (88)
      • SNMP (161)
      • SMTP (25)
      • RDP (3389)
      • Evil-WinRM (5985/5986)
      • MYSQL (3306)
      • MSSQL (1433)
    • Default/Common Credentials
    • Shells
      • TTY Shell
    • File Transfer
    • KeePass Database
    • Port Forwarding
    • File Metadata
  • Attacks
    • Run a command x times
    • Public Exploits
    • User Creation
    • Password Cracking
      • Using custom wordlists
    • LFI/RFI
    • SQLi
    • PwnKit
    • SAM and SYSTEM files
    • Phishing for Access (Requires MailSVR)
    • GitDumper
  • Enumeration
    • Linux
    • Windows
  • Privilege Escalation
    • Linux
    • Windows
  • Port Forwarding Extras
    • Linux
    • Windows
  • Active Directory
    • Enumeration
    • Lateral Movement
    • Privilege Escalation
Powered by GitBook
On this page
  • 1. Identify SMB Version
  • 2. Common Scans/Enumeration
  • nmap
  • enum4linux
  • smbclient
  • smbget
  • crackmapexec
  • nxc
  • impacket
  • hydra
  1. Commons
  2. Service Enumeration

SMB (139 / 445)

PreviousHTTP(S) (80 / 443)NextFTP (21)

Last updated 3 months ago

1. Identify SMB Version

sudo nmap -p 139,445 -sV -Pn <IP>
tcpdump -i tun0 port <Port> and src <IP> -s0 -A -n 2>/dev/null & crackmapexec smb <IP> --shares --port <Port> 1>/dev/null 2>/dev/null

2. Common Scans/Enumeration

nmap

nmap --script "safe or smb-enum-*" -p 445 <IP>
nmap --script "smb-vuln*" -p 139,445 <IP>

enum4linux

enum4linux -a <IP>
enum4linux -a <IP> -u <username> -p <password>

smbclient

Null Session: smbclient -N -L \\\\<IP>

Listing share contents: smbclient -L \\\\<IP>\\
Connecting to share: smbclient \\\\<IP>\\<share>\\ -U [domain\]<username>

Listing share permissions: smbmap -H <IP>

smbget

Download target file: smbget smb://<IP>//<share>/<file> [--user <username%password>]
Download target share: smbget -R smb://<IP>//<share>

crackmapexec

crackmapexec smb <IP> [--users | --shares]

Null/Guest Logins
    crackmapexec smb <IP> --shares -u ' ' -p ''
    crackmapexec smb <IP> --shares -u '' -p ''
    crackmapexec smb <IP> -u ' ' -p ''
    crackmapexec smb <IP> -u 'guest' -p ''

Checking authentication
    crackmapexec smb <IP> -u <user> -p <pass> --local-auth
    crackmapexec smb <IP> -u <user> -p <pass>

nxc

nxc smb <IP> -d <domain name> -u users.txt -p passwords.txt --continue-on-success
nxc smb <IP> -d <domain name> -u users.txt -H hashes.txt --continue-on-success

impacket

impacket-smbexec [domain/]<username>[:password]@<IP>
impacket-psexec [domain/]<username>[:password]@<IP>
impacket-wmiexec [domain/]<username>[:password]@<IP>

hydra

hydra -L <users list> -P <password list> -f smb://<IP> [-p <port>]
hydra -l <username> -p <password> -f smb://<IP> [-p <port>]

Refer to , for a reverse shell via MS17-010 exploit

https://github.com/3ndG4me/AutoBlue-MS17-010
GitHub - irgoncalves/smbclient_cheatsheet: Useful commands/tricks using smbclient/nmap in a pentesting/auditing/redteamingGitHub
Logo