Security Notes
  • Whoami
  • Pentesting
    • WEP-Pen
      • Reconnaissance
      • Enumeration
      • OWSAP TOP 10
        • Injection
          • Cross Site Scripting
            • Cross Site Scripting
            • Exploitation
            • Protections
          • SQL Injection
            • SQL Injection Overview
          • NoSQL Injection
          • CRLF Injection
          • XML Injection
        • Broken Access Control
          • Path Traversal
          • Sensitive Cookie with Improper SameSite Attribute
          • Link Following
          • Incorrect Default Permissions
          • Information disclosure
          • CSRF
            • csrf checklist
          • 403 bypass
          • Exposure of WSDL File Containing Sensitive Information
          • bussiness logic checklist
          • 2FA bypass checklist
          • admin panal checklist
          • idor checklist
          • Authentication checklist
          • reset_password_checklist
          • ATO
        • Cryptographic Failures
          • Cryptographic Failure
          • Weak Encoding for Password
          • Improper Following of a Certificate's Chain of Trust
            • Understanding Digital Certificates : Self-Signed and CA-Signed Certificate **
            • Transport Layer Security (TLS) and SSL **
          • Clear Text Transmission Of Sensitive Data
            • SSLStripping **
        • Insecure Design
        • Security Misconfiguration
          • CORS Miscofigration
          • Mail Server Misconfiguration
        • Vulnerable and Outdated Components
          • Using Components with Known Vulnerabilities
        • Identification and Authentication Failures
          • JWT Hacking
          • SAML Authentication bypass
        • Software and Data Integrity Failures
          • mass assignment
          • PostMessage Vulnerabilities
            • PostMessage Vulnerabilities
            • Blocking main page to steal postmessage
            • Bypassing SOP with Iframes - part 1
            • Bypassing SOP with Iframes - part 2
            • Steal postmessage modifying iframe location
        • Security Logging and Monitoring Failures
        • Server-Side Request Forgery (SSRF)
          • SSRF
      • Checklists
        • aem misconfiguration
        • exif_geo
        • xss
        • Session Management
        • Authorization
        • cookie
        • Django
        • Symfony
        • json
        • bypass rate limit
        • Rce
        • Register Page
      • eWPTXv2 Preparation
        • Encoding & Filtering
        • Evasion Basics
        • Cross-site scripting (XSS)
        • XSS Filter Evasion
        • Cross-site request forgery (CSRF
        • HTML5
      • API-Pen
        • API Discovry
        • Reverse Engineering API Documentation
        • Excessive Data Exposure
        • Vulnerability Scanning
        • API Authentication Attacks
          • Classic Authentication Attacks
          • API Token Attacks
        • API Authorization Attacks
          • Broken Object Level Authorization (BOLA)
          • Broken Function Level Authorization
        • Improper Assets Management
        • Mass Assignment
        • SSRF
        • Injection Attacks in API
        • Evasive Maneuvers
        • GraphQL Vulnerabilities
    • NET-Pen
      • Active Directory Pentesting
        • Active Directory Components
        • Initial Attack Vectors
          • LLMNR Poisoning
          • SMB Relay Attacks
          • IPv6 Attacks ( IPv6 DNS Takeover )
          • Printer Hacking
          • Methodology
          • Some Other Attacks
            • Zerologon (CVE-2020-1472)
            • PrintNightmare (CVE-2021-1675)
        • Post-Compromise Attacks
          • Pass Attacks
          • Kerberoasting Attack
          • Token Impersonation Attack
          • LNK File Attack
          • GPP / cPassword Attacks
          • Mimikatz
          • Methodology
        • We've Compromised the Domain
          • Dumping the NTDS.dit
          • Golden Ticket Attacks
          • Methodology
        • Case Study
        • Password Attacks
      • Attack Vectors by Port
        • FTP 21
        • SSH 22
        • Telnet 23 - 2323
        • SMTP 25
        • DNS 53
        • Kerberos 88
        • POP 110-995
        • RPC 111
        • Ident 113
        • NNTP 119
        • NetBIOS 137-138
        • SMB / Samba 135-139, 445
        • MSRPC 135
        • SNMP 161
        • LDAP 389,636
        • Modbus 502
        • OpenSSL 1337
        • Ms-SQL 1433
        • Oracle Listener 1521 1522 1529
        • NFS 2049
        • MySql 3306
        • RDP 3389
        • ADB Android Debug Bridge 5555
        • WinRM 5985 5986
        • VNC 5800 5900
        • Redis 6379
        • Unreal IRC 6667
        • Tomcat 8080
        • MongoDB 27017
        • http 80
      • Network basics
      • Information Gathering
      • Privilege Escalation
        • Windows Privilege Escalation
        • Linux Privilege Escalation
    • write-ups
      • How i found a Privilege Escalation via Impersonation Features feature
      • How I was able to discover ATO Via IDOR vulnerability
      • Easy full Account Takeover via Facebook OAuth Misconfiguration
Powered by GitBook
On this page
  • Nmap SMB Enumeration Commands
  • Metasploit SMB Enumeration
  • Banner Grabbing
  • CrackMapExec (CME) for SMB
  • RPCClient (Null Session)
  • Ridenum - SMB Brute-Force (Dictionary-based)
  • Null Session
  • Smbmap
  • Bruteforce SMB Login
  • Smbget for Downloading SMB Shares
  • EternalBlue Exploit (MS17-010)
  • Mounting SMB Shares
  1. Pentesting
  2. NET-Pen
  3. Attack Vectors by Port

SMB / Samba 135-139, 445

Nmap SMB Enumeration Commands

SMB Security Mode:

nmap --script=smb2-security-mode.nse -p 445 192.168.10.0/24

Basic SMB Scan:

sudo nmap -v -p 139,445 -oG smb.txt 10.11.1.8

NetBIOS Stats and SMB OS Discovery:

sudo nmap --script nbstat.nse 10.11.1.5
sudo nmap --script smb-os-discovery 10.11.1.5

Enumerating SMB Shares:

nmap --script smb-enum-shares -p139,445 10.11.1.5

Scanning for SMB Vulnerabilities:

sudo nmap --script smb-vuln* 10.11.1.5
sudo nmap -v -p 139,445 --script=smb-vuln* --script-args=unsafe=1 10.11.1.5

Scan for SMB Shares with Credentials (if known):

nmap -T4 -v -oA shares --script smb-enum-shares --script-args smbuser=username,smbpass=password -p 445 10.11.1.0/24

One-liner to Check Multiple SMB Vulnerabilities:

nmap -p 445 -vv --script=smb-vuln-cve2009-3103.nse,smb-vuln-ms06-025.nse,smb-vuln-ms07-029.nse,smb-vuln-ms08-067.nse,smb-vuln-ms10-054.nse,smb-vuln-ms10-061.nse,smb-vuln-ms17-010.nse 10.10.10.10

Full SMB Scan with OS Detection:

sudo nmap -A -p 135 --open 10.11.1.0/24 -oG nmap135

Metasploit SMB Enumeration

Enumerating SMB Shares:

use auxiliary/scanner/smb/smb_enumshares

Lookup SID Information:

use auxiliary/scanner/smb/smb_lookupsid

Banner Grabbing

Using Netcat (nc) to Banner Grab on Port 135:

nc -nv 10.11.1.5 135

CrackMapExec (CME) for SMB

Basic Command:

crackmapexec smb 10.11.1.128

Using Credentials:

crackmapexec smb 10.11.1.128 -u 'username' -p 'password'

Brute-Force SMB Login Using a Wordlist:

crackmapexec smb 10.11.1.128 -u "DJ" -p /usr/share/dirb/wordlists/mutations_common.txt
crackmapexec smb 10.11.1.136 -u root -p /usr/share/wordlists/rockyou.txt

Null Session (No Username/Password):

crackmapexec smb 10.11.1.146 -u 'guest' -p ''  # Null session

Listing Shares without Credentials:

crackmapexec smb 10.11.1.146 -u '' -p '' --shares

RPCClient (Null Session)

Connecting with Null Session:

rpcclient -U "" -N 10.11.1.5

Ridenum - SMB Brute-Force (Dictionary-based)

Bruteforce SMB Users with Dictionary:

ridenum.py 10.10.10.10 500 50000 dict.txt

Null Session

Windows Command (Net Use):

net use \\10.10.10.10\ "" /u:""

inux Command (Smbclient):

smbclient -L //10.10.10.10

Smbmap

Basic SMB Mapping Command:

smbmap -H 10.11.1.5 -P 135

Login and Access Shares:

smbmap -u "root" -p "123456" -R Bob -H 10.11.1.136 -P 445

Listing Shares:

smbclient -L 10.11.1.5

Accessing a Share (guest access):

smbclient //10.11.1.5/guest

Upload a File to Share:

smbmap -H //10.10.10.10/ --upload test.txt /SHARENAME/test.txt

Bruteforce SMB Login

Using Medusa for SMB Bruteforce:

medusa -h 10.11.1.111 -u redcliff -P /usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt -M smbnt

Using Nmap for SMB Bruteforce:

nmap -p445 --script smb-brute --script-args userdb=user.txt,passdb=/usr/share/seclists/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt 10.11.1.111 -vvvv

Smbget for Downloading SMB Shares

Recursive Download from SMB Share:

smbget -rR smb://192.168.101.83/sambashare -U guest

EternalBlue Exploit (MS17-010)

Run EternalBlue Checker: Clone the repository from GitHub and run eternal_checker.py against the target:

https://github.com/3ndG4me/AutoBlue-MS17-010/blob/master/eternal_checker.py

Mounting SMB Shares

Creating a Temporary Share Folder on Linux:

sudo mkdir /tmp/share

Mount the SMB Share:

sudo mount -t cifs //10.11.1.146/SusieShare /tmp/share
PreviousNetBIOS 137-138NextMSRPC 135

Last updated 5 months ago