githubEdit

3. SMB

SMB Basics

  • Function: Shared access to files, printers, etc.

  • Ports:

    • TCP/139, UDP/137-138 (NetBIOS)

    • TCP/445 (Direct over TCP/IP)

  • Samba: Unix/Linux implementation of SMB.

  • MSRPC: Microsoft Remote Procedure Call, often used with SMB.

Enumeration

  • Nmap:

nmap -sV -sC -p 139,445 <target_IP>
  • Information: SMB version, hostname, OS (guess).

Misconfigurations

  • Null Sessions (No Authentication Required):

smbclient -N -L //<target_IP>         # List available shares
smbmap -H <target_IP>                 # List shares with permissions
rpcclient -U '%' <target_IP>          # RPC enumeration
enum4linux-ng.py -A -C <target_IP>    # Comprehensive SMB enumeration

Protocol-Specific Attacks

  • Brute-Forcing/Password Spraying:

  • Windows Attacks:

    • Remote Code Execution (RCE):

  • Enumerate Logged-on Users:

  • Extract Hashes from SAM Database:

  • Pass-the-Hash (PtH):

Forced Authentication Attacks (Responder)

  • Hash Cracking:

Latest SMB Vulnerabilities (CVE-2020-0796 - SMBGhost)

  • Vulnerability: Compression mechanism flaw in SMBv3.1.1 allowing RCE by unauthenticated attacker.

  • Affected Systems: Windows 10 1903, 1909.

  • Exploitation: Public exploits are available for this vulnerability.

Last updated