πŸ”—SMB Attacks

🎯 Overview

This document covers exploitation techniques against SMB services, focusing on practical attack methodologies from HTB Academy's "Attacking Common Services" module. SMB attacks can lead to remote code execution, credential theft, lateral movement, and complete system compromise.

"To attack an SMB Server, we need to understand its implementation, operating system, and which tools we can use to abuse it. We can abuse misconfiguration or excessive privileges, exploit known vulnerabilities or discover new vulnerabilities."

πŸ—οΈ SMB Attack Methodology

Attack Chain Overview

Service Discovery β†’ Misconfiguration Analysis β†’ Authentication Attacks β†’ Privilege Escalation β†’ Lateral Movement

Key Attack Vectors

  • Anonymous Authentication (Null Sessions)

  • Brute Force & Password Spraying

  • Remote Code Execution (PsExec, SMBExec, atexec)

  • Credential Extraction (SAM Database)

  • Pass-the-Hash Attacks

  • Forced Authentication (Responder, NTLM Relay)


πŸ“ Service Discovery & Enumeration

Basic SMB Scanning

Key Information to Extract

  • SMB Version (Samba vs Windows)

  • Hostname (NetBIOS name)

  • Operating System (Linux/Windows detection)

  • Message Signing status

  • SMB Dialect support


πŸ”“ Misconfiguration Attacks

1. Anonymous Authentication (Null Sessions)

Target: SMB servers that don't require authentication

File Share Enumeration

Permission Analysis

Directory Browsing

2. RPC Exploitation

Null Session RPC Access

Advanced RPC Operations

  • Change user passwords

  • Create new domain users

  • Create shared folders

  • Modify system attributes

3. Automated Enumeration


βš”οΈ Protocol Specific Attacks

1. Brute Force & Password Spraying

⚠️ WARNING: Brute forcing can lock accounts. Use password spraying for safer approach.

Password Spraying with CrackMapExec

Best Practices

  • 2-3 password attempts max

  • 30-60 minute delays between attempts

  • Monitor account lockout policies

  • Use --continue-on-success for complete enumeration

2. Metasploit SMB Login Scanner


πŸ’» Remote Code Execution

1. PsExec Family Tools

Impacket PsExec

Alternative Impacket Tools

2. CrackMapExec RCE


🏷️ Credential Extraction & Lateral Movement

1. SAM Database Extraction

2. Pass-the-Hash (PtH) Attacks

3. Logged-on Users Enumeration


��️ Forced Authentication Attacks

1. Responder - LLMNR/NBT-NS Poisoning

Setup Responder

Attack Scenario

Captured Credentials Example

2. Hash Cracking

3. NTLM Relay Attacks

Setup NTLM Relay

Advanced Relay with Commands


πŸ“ Skills Assessment Examples

Example 1: Share Discovery

Task: Find shared folder with READ permissions

Example 2: Password Brute Force

Task: Find password for username "jason"

Example 3: SSH Key Extraction

Task: Login via SSH and find flag


πŸ›‘οΈ Defense & Mitigation

SMB Security Hardening

  • Disable SMBv1 protocol

  • Enable SMB signing (mandatory)

  • Restrict anonymous access

  • Implement strong authentication

  • Monitor SMB traffic

  • Segment network properly

Detection Strategies

  • Monitor failed authentication attempts

  • Alert on suspicious SMB connections

  • Track administrative share access

  • Log RPC operations

  • Detect LLMNR/NBT-NS traffic



πŸ“š References

  • HTB Academy - Attacking Common Services Module

  • Impacket Documentation - Python SMB tools

  • CrackMapExec Wiki - Advanced SMB testing

  • Responder Documentation - LLMNR/NBT-NS poisoning

  • Microsoft SMB Protocol - Official specifications

Last updated