CTF Arsenal
Boot2Root/Information Gathering & Enumeration

SMB Enumeration

Concept

SMB (ports 139/445) often allows anonymous ('null session') access to list shares, users, and OS/domain info, which is frequently enough to leak credentials, scripts, or a foothold on both Windows and Linux (Samba) boxes.

When to Use

  • Nmap shows 139 and/or 445 open.
  • Challenge hints at a Windows target or a 'file share' theme.

Workflow

  1. 1
    Test for a null/anonymous session

    smbclient -N or enum4linux-ng.

  2. 2
    List and mount accessible shares

    Pull every file you can reach.

  3. 3
    Enumerate users/groups/OS info

    Leaked usernames feed password spraying later.

  4. 4
    Grep share contents for credentials

    scripts, configs, .txt notes.

Commands

smbclient -N -L //TARGET_IP/
smbclient -N -L //10.10.11.25/

Lists available SMB shares using a null (anonymous) session.

  • -N — No password — attempt a null session.
  • -L — List shares on the target rather than connecting to one.

When to use: First SMB command to run once 445/139 is open.

Expected output:

Sharename  Type  Comment
---------  ----  -------
Share$     Disk
IPC$       IPC

Look for: Non-default share names (not just IPC$/ADMIN$/C$).

Next step: Connect to any non-default share: smbclient //TARGET_IP/Share$ -N.

enum4linux-ng -A TARGET_IP
enum4linux-ng -A 10.10.11.25

Runs a broad battery of SMB enumeration checks: shares, users, groups, policies, OS info.

  • -A — Run all basic enumeration modules.

When to use: After confirming SMB is reachable, to get a full picture in one command.

Expected output:

Users on 10.10.11.25:
  'Administrator' ... 
Shares:
  'Users' ...

Look for: Usernames (feed into Hydra/credential attacks), writable shares, password policy details.

Next step: Attempt listed usernames against found/leaked passwords; mount writable shares to look for upload-based access.

smbmap -H TARGET_IP -u anonymous
smbmap -H 10.10.11.25 -u anonymous

Shows share names with READ/WRITE permission levels for the given user.

  • -u anonymous — Attempt the anonymous account explicitly.

When to use: To quickly see which shares you can write to (upload a payload) vs only read.

Expected output:

Share           Permissions
Users           READ, WRITE

Look for: Any WRITE permission — a direct path to drop a webshell or payload if the share is web-exposed.

Next step: If WRITE is available and the share maps to a web root, upload a payload for code execution.

Tools

Enum4linux-ng

All-in-one SMB/Samba enumeration (shares, users, policies, OS).

When to use: Default SMB enumeration tool.

sudo apt install enum4linux-ng
enum4linux-ng -A TARGET_IP

Example workflow: Run -A, grep output for usernames, feed into password spraying.

smbclient

Interactive SMB client to list/browse/download from shares.

When to use: Once a share name is known and you need to pull files.

smbclient //TARGET_IP/SHARE -N

Example workflow: Connect -> ls -> get FILE_PATH to download interesting files.

Findings & Interpretation

Interesting

  • Non-default share names
  • Usernames matching real people (feed credential attacks)
  • Readable config/script files with hardcoded passwords

Suspicious

  • Shares writable by anonymous/guest — potential upload path

False Positives

  • Default admin shares (C$, ADMIN$, IPC$) are normal on Windows and rarely useful without credentials

How to Validate

  • Actually connect and 'ls' the share rather than trusting the listing alone — permissions can differ per share

Next Step

  • Download and grep every reachable file for 'password', 'pwd', connection strings.
  • Feed discovered usernames into SSH/FTP/credential attacks.

Troubleshooting

smbclient: NT_STATUS_ACCESS_DENIED

Likely cause: Null sessions disabled, or SMB signing/protocol mismatch.

Verify: Retry with -L to just list shares (less privileged than connecting), and check nmap smb-protocols script output.

Fix: Try enum4linux-ng, which attempts multiple auth methods, or supply a found username/empty password.

Recovery: Fall back to other services (FTP/HTTP) for a foothold if SMB stays locked.

Avoid repeating: Don't assume null sessions always work — modern Samba defaults often disable them.