SMB (445, 139) / RPC

ko-fi

Nmap

 nmap 10.129.14.128 -sV -sC -p139,445
nmap --script smb-os-discovery.nse -p445 10.10.10.40
 nmap --script 'smb-vuln*' -Pn -p 139,445 {IP}
nmap -A -p445 10.129.42.253

SMB v3.1.1 which made Windows 10 versions 1903 and 1909 - SMBGhost - CVE-202-0796

Enumeration

Guest vs Null Session

Guest access

Source: https://mayfly277.github.io/posts/GOADv2-pwning-part2/

NXC - STATUS_NOT_SUPPORTED

List shares - Anonymously

SMBclient

SMBmap

smbmap with the -r or -R (recursive) option, one can browse the directories:

The permissions are set to READ and WRITE, which one can use to upload and download the files.

CME / NXC

NetExec - CME

NetScan - From Windows Host

List shares - Guest account

Spider shares

Anonymous login

With RPC

Access share guest user

Download files

Smbclient allows us to execute local system commands using an exclamation mark at the beginning (!<cmd>) without interrupting the connection.

Download Folder

Example:

Upload files

put <nom_de_fichier_local> [nom_de_fichier_distant]

Source: http://www.delafond.org/traducmanfr/man/man1/smbclient.1.html

Authenticated

List shares

Netexec - CME

NetExec - CME

smbmap

Access share

SMBClient-ng

PowerHuntShares

Samba Status

RPC

RPCclient - Enumeration

Query

Description

srvinfo

Server information.

enumdomains

Enumerate all domains that are deployed in the network.

querydominfo

Provides domain, server, and user information of deployed domains.

netshareenumall

Enumerates all available shares.

netsharegetinfo <share>

Provides information about a specific share.

enumdomusers

Enumerates all domain users.

queryuser <RID>

Provides information about a specific user.

querygroup <RID>

Provides information about a specific group.

RPC can also be use to create a user or change a user password. See:

Brute Forcing User RIDs

Bash

Impacket - Samrdump.py

Netexec - CME

Logged-on users

Check for Fake Potato or LeakedWallpaper

Enumeration

Impersonate logged-on users

Enum4Linux

Anonymous

Authenticated

Metasploit

Metasploit

Netexec - CME

NetExec - CME

Password Spraying

Password Spray

CME - NXC

Login equal password

Status of bruteforce

References

Sprayhound

References

STATUS_PASSWORD_MUST_CHANGE

Change password

Brute force

SMB Bruteforce

Hydra

Metasploit

Usage

Windows

1 - CMD

Mount share:

The command net use connects a computer to or disconnects a computer from a shared resource or displays information about computer connections. We can connect to a file share with the following command and map its content to the drive letter n.

With auth:

Search credz:

Credentials Hunting

2 - Powershell

Mount/Connect to share - Instead of net use, we can use New-PSDrive in PowerShell.

With auth:

Linux

cifs-util: sudo apt install cifs-utils

credential file content:

Credz:

Credentials Hunting

Get NTLMv2 Hashes

NTLM Relay - SMB Session Signing Disabled

LLMNR NBT-NS Poisoning

Not only for SMB protocol. Can also be use with HTTP (see AD CS), MSSQL, etc

No Signing

Ntlmrelayx

Suppose a user mistyped a shared folder's name \\mysharefoder\ instead of \\mysharedfolder\. In that case, all name resolutions will fail because the name does not exist, and the machine will send a multicast query to all devices on the network, including us running our fake SMB server.

These captured credentials can be cracked

Hashes

Or relay:

First, we need to set SMB to OFF in our responder configuration file (/etc/responder/Responder.conf).

By default, impacket-ntlmrelayx will dump the SAM database, but we can execute commands by adding the option -c.

We can create a PowerShell reverse shell (Shells - Reverse and Bind) using https://www.revshells.com/, set our machine IP address, port, and the option Powershell #3 (Base64).

Or

Go-Secdump

NTLM Relay Gat

ShadowCoerce

DFSCoerce

Coercer

Coercion over DCOM - RemoteMonologue

Netexec

Credits: https://x.com/al3x_n3ff/status/1844811200409780710?t=4uCeCsIsSsOpGbu2t0fRpg&s=03

Kerberos relay over SMB

Network Attacks

krbrelayx

KrbRelayEx

CVE-2025-33073 - NTLM Reflection

SAM & LSA secrets

PSexec

Interactive Shell and Command Execution over Named-Pipes

Invoke-SMBRemoting

Code Exec over RPC

Bruteforce RPC endpoint to perform code exec if you can't access EPM/SMB

Interesting Books

Interesting Books

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

  • Nmap Network Scanning The official guide to the Nmap Security Scanner, a free and open source utility used by millions of people for network discovery, administration, and security auditing. From explaining port scanning basics for novices to detailing low-level packet crafting methods used by advanced hackers, this book by Nmap's original author suits all levels of security and networking professionals.

  • The Art of Network Penetration Testing A guide to simulating an internal security breach. You’ll take on the role of the attacker and work through every stage of a professional pentest, from information gathering to seizing control of a system and owning the network.

  • Network Basics for Hackers The book offers one of the most complete and in-depth analyses of Wi-Fi and Bluetooth networks, then progresses through the various protocols such as DNS, ARP, SMTP, and others.

Support this Gitbook

I hope it helps you as much as it has helped me. If you can support me in any way, I would deeply appreciate it.

ko-fi

buymeacoffee

Last updated