π¦Fawn
π¦ HTB Fawn β Solution Notes
Platform: Hack The Box β Starting Point (Tier 0) Machine: Fawn OS: Linux Difficulty: Very Easy Vulnerability Type: Misconfiguration β SMB Null Session (Unauthenticated Access)
πΊοΈ Attack Chain
Nmap β SMB (Port 445) discovery β List shares via Null Session β Connect to WorkShares β Download flag.txt β Read it
π§ How Does a Hacker Think? β Before You Begin
When port 445 shows up in a scan, immediately ask yourself: "Does this SMB service require authentication?"
1οΈβ£ Reconnaissance
Port Scanning
bash
nmap -p- --min-rate 5000 -sV <TARGET_IP>
Findings:
Port 445 = SMB. This protocol is used for file and printer sharing on Windows systems. It can also run on Linux via Samba.
π§ How Does a Hacker Think? β First Look at SMB
When you see SMB, these questions should be running through your head:
2οΈβ£ Enumeration β Listing Shares
π‘ What is SMB (Server Message Block)?
bash
smbclient -L <TARGET_IP>
# Password: (leave blank, just press Enter)
π‘ Parameter Explanation:
Example Output:
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
WorkShares Disk
WorkSharesdoes not end in$β it may contain user data. This is our first target.
3οΈβ£ Exploitation β Connecting to a Share
π‘ What is smbclient?
bash
smbclient //<TARGET_IP>/WorkShares
# Password: (leave blank, press Enter)
4οΈβ£ Navigation Inside the SMB Client
π‘ SMB Client Commands
bash
smb: \> ls
smb: \> cd Amy.J
smb: \> ls
smb: \> get worknotes.txt
smb: \> cd ..
smb: \> cd James.P
smb: \> get flag.txt
smb: \> exit
5οΈβ£ Reading the Flag
π‘ Why Can't We Read It on the Server?
bash
cat flag.txt
π§ How Does a Hacker Think? β Why Did This Vulnerability Exist?
The SMB Null Session vulnerability is not a technical bug β it's a configuration error. The sysadmin either:
6οΈβ£ Remediation
bash
# The following settings should be applied in smb.conf:
# 1. Disable guest access
map to guest = Never
guest ok = no
# 2. Enforce SMB signing
server signing = mandatory
# 3. Disable old and insecure SMB versions
min protocol = SMB2
π Concepts Learned
- SMB: Port 445, Windows/Linux file sharing protocol
- Null Session: Unauthenticated SMB connection β most common misconfiguration
smbclient -L: Listing available shares- Shares ending in
$: System shares, require admin privileges getcommand: Downloading a file to the local machine- SMB = File System: Can't
caton the server β mustgetfirst
π General Hacker Mindset Summary
- When you see port 445, try Null Session first:
smbclient -L <IP>β leave password blank and press Enter. - Shares not ending in
$are your first target: These are user-created and likely contain data. catdoesn't work in SMB, useget: Download the file first, then read it in your local terminal.- Misconfiguration = human error: Configuration mistakes open more doors than technical vulnerabilities.
- "I'll close it later" is never a safe plan: The most common security holes come from decisions made "just for now."