Description
A Secure Printer is now in use. I'm confident no one can leak the message again... or can you?
Setup
sudo apt install smbclientSolution
Want to try it yourself first?
The guided walkthrough reveals hints one step at a time.
Step 1Enumerate shares and read the public share anonymously
ObservationThis follows the earlier Printer Shares over SMB, so start the same way: enumerate shares without credentials and see what the more secure server still hands to a guest.Start by listing all SMB shares without credentials. The server exposes two shares: a public 'shares' folder (guest-accessible) and a restricted 'secure-shares' folder for internal use only. Connect anonymously to the public share and list its files. You will find several text files, including notification.txt.bash# List all shares (no credentials needed):bashsmbclient -L //<HOST> -p <PORT_FROM_INSTANCE> -Nbash# Connect to the public share as guest:bashsmbclient //<HOST>/shares -p <PORT_FROM_INSTANCE> -Nbash# Inside smbclient, list and download all files:bashlsbashprompt OFFbashmget *bashexitbash# Read the notification file:bashcat notification.txtExpected output
NOTICE: Secure printer share updated. User: joe Please remind joe to update his default password.
What didn't work first
Tried: Trying smbclient with -U guest or -U '' to authenticate instead of using -N for a null session
Some servers reject the literal username guest while still allowing null sessions. -N skips authentication rather than submitting a credential, and many CTF SMB servers accept only that path. Supplying a guest username produces a logon failure that makes a public share look closed.
Tried: Using enum4linux or smbmap to enumerate shares instead of smbclient
enum4linux and smbmap work well on the standard port and need coaxing, or fail quietly, on a non-standard one. smbclient takes the port directly. enum4linux wraps several tools whose port handling can misreport accessibility, making a populated server look empty.
Learn more
SMB (Server Message Block) is a network protocol for file and printer sharing. It supports multiple authentication levels: null sessions (no credentials), guest access, and authenticated users. A server can expose some shares publicly while keeping others restricted - but placing sensitive information in a public share defeats the purpose of the restriction.
Information disclosure is one of the most common and underappreciated vulnerability classes. notification.txt reveals the username "joe" and hints that his default password is still in use. This is a classic operational security failure: internal communications left in a world-readable location hand attackers exactly the recon they need.
The
-Nflag tells smbclient to skip authentication entirely (null session).mget *withprompt OFFdownloads every file in the current directory without asking for confirmation per file.Step 2Brute-force joe's password against the restricted share
Observationnotification.txt in the public share names the user joe and says his default password was never changed. That is a wordlist attack against the restricted share.notification.txt tells you the username is 'joe' and that he is still using a default password. Standard tools like Hydra struggle with non-standard ports here, but NetExec (nxc) handles it cleanly. Run nxc with the rockyou.txt wordlist against the SMB service using joe's username. The password will be found after a few minutes of brute-forcing.bash# Install NetExec if needed:bashsudo apt install netexecbash# Brute-force joe's password (takes ~10 min against rockyou):bashnxc smb <HOST> --port <PORT_FROM_INSTANCE> -u 'joe' -p /usr/share/wordlists/rockyou.txt --ignore-pw-decodingbash# Look for a line marked [+] in the output - that line shows the cracked password.What didn't work first
Tried: Using Hydra instead of NetExec to brute-force SMB on a non-standard port
Hydra's SMB module does not pass a custom port through reliably and often falls back to 445 regardless of the flag, so every attempt hits the wrong endpoint and is refused. NetExec wires the port through cleanly, which is why this step calls for it rather than the more commonly recommended tool.
Tried: Skipping the wordlist and trying common defaults like 'password', 'joe', '123456' manually with smbclient before running a full brute-force
The notification says default password without naming the product, so there is no single obvious guess. A handful of manual attempts will not beat rockyou.txt, which holds nearly every common default in frequency order. Manual guessing can also trip a lockout policy and block the real run afterwards.
Learn more
NetExec (nxc) is the actively maintained successor to CrackMapExec. It supports SMB, WinRM, RDP, SSH, and other protocols and handles non-standard ports via the
--portflag. The--ignore-pw-decodingflag prevents crashes when rockyou.txt contains non-UTF-8 byte sequences.Credential brute-forcing against SMB is noisy in real networks (failed logins fill event logs and can trigger lockouts), but effective when a user genuinely has a dictionary password. The "default password still in use" hint in notification.txt almost guarantees the password is near the top of rockyou.txt, keeping the runtime manageable.
If nxc is unavailable, Metasploit's
auxiliary/scanner/smb/smb_loginmodule also accepts a customRPORTand wordlist, and is a reliable fallback for non-standard ports.Step 3Connect as joe and retrieve the flag
ObservationNetExec marks one attempt as a success and names the password. Those credentials open the restricted share.With joe's cracked password in hand, connect to the restricted 'secure-shares' share using smbclient with explicit credentials. List the directory, download flag.txt, and read it locally.bash# Connect to the restricted share as joe:bashsmbclient //<HOST>/secure-shares -p <PORT_FROM_INSTANCE> -U 'joe'bash# Inside smbclient (enter the cracked password when prompted):bashlsbashget flag.txtbashexitbash# Read flag.txtbashcat flag.txtWhat didn't work first
Tried: Connecting to the 'shares' public share as joe instead of the 'secure-shares' restricted share
With the password cracked it is tempting to revisit the public share, and the connection does succeed, since joe can read it too. But the directory holds the same notification file and decoys. The flag is only in the restricted share.
Tried: Attempting to mount the share with mount.cifs rather than using smbclient interactively
mount.cifs wants root and a local mount point, and its non-standard port syntax hides in the options field where it is easy to get wrong. The interactive smbclient path is faster and needs no sudo. mount.cifs also struggles with older SMB dialects that smbclient negotiates on its own.
Learn more
SMB access control lists (ACLs) restrict share access per user. The "secure-shares" share denies anonymous and guest connections but allows authenticated users in the printer group. Once joe's credentials are valid, smbclient authenticates normally and the share behaves identically to any other.
This challenge teaches a critical lesson: locking down a share with authentication only raises the bar if the credentials themselves are strong. Weak or default passwords combined with information disclosure (notification.txt naming the account) reduce the "secure" share to one wordlist run away from full exposure. The attack chain - anonymous recon, information disclosure, credential brute-force, authenticated access - is a textbook lateral movement pattern in real enterprise breaches.
Interactive tools
- Hex ViewerView text or raw hex bytes as a xxd-style hex dump with byte offset, hex columns, and ASCII sidebar. Highlights printable characters and null bytes.
- Strings ExtractorPull printable text from any binary, library, or image. ASCII and UTF-16 detection, configurable minimum length, flag-like highlight, no command line needed.
Flag
Reveal flag
picoCTF{5mb_pr1nter_5h4re5_5ecure_...}
The flag is inside flag.txt in the secure-shares share, accessible only after brute-forcing joe's password from the username hint in notification.txt.