Skip to content

Sensitive Files on SMB Shares

4 min read Created Mar 6, 2026 Last updated Mar 6, 2026

Once a share is readable, the next question is whether it contains anything that changes your path fast. Sensitive SMB content often turns a simple share exposure into credential theft, key recovery, database access, or access to internal systems without needing another vulnerability. SMBMap supports recursive review and pattern-based file hunting, and smbclient supports recursive listing and direct retrieval when you need to pull specific files.

Start with a recursive listing on the shares you can access. Shares labelled IT, Backup, Shared, Scripts, Config, or Software are worth prioritizing over generic ones. Writable shares matter less here than readable ones with content.

Finding SMB Sensitive Files

High-value file types to prioritize:

  • .kdbx KeePass databases and .ppk/.pem private keys
  • .rdp connection files with saved credentials
  • .ps1, .bat, .cmd scripts with hardcoded passwords
  • web.config, .env, .ini files with connection strings
  • .vhd, .vhdx disk images and .sql database dumps

If a share returns errors on listing, another account may have access to it, so note it and move on.

┌──(kali㉿kali)-[~]
└─$ smbmap -H $TARGET_IP -u "$USER" -p "$PASSWORD" -r
┌──(kali㉿kali)-[~]
└─$ smbmap -H $TARGET_IP -r

If you need direct inspection with smbclient, enumerate the share and pull only what matters. Anonymous access (-N) works on misconfigured shares and is worth trying even when you hold credentials. Some shares have guest-only permissions configured separately from authenticated access. Check both authenticated and unauthenticated listings to catch mismatches between intended and actual permissions.

┌──(kali㉿kali)-[~]
└─$ smbclient //$TARGET_IP/Shared -U "$USER%$PASSWORD" -c "recurse; ls"
┌──(kali㉿kali)-[~]
└─$ smbclient //$TARGET_IP/Public -N -c "recurse; ls"

Search for names that regularly change the next move. The pattern covers the most common high-value extensions: password managers (.kdbx), private keys (.pem, .ppk), remote desktop connection files (.rdp), virtual disk images (.vhd, .vhdx), archived backups (.bak, .zip, .7z), database dumps (.sql, .mdb, .accdb), and scripts (.ps1, .bat, .cmd) that may contain hardcoded credentials or network paths. XML, INI, and TXT files frequently hold connection strings, API tokens, or deployment configuration. SMBMap prints matches with the full share path, so you can retrieve them directly without re-browsing the tree.

┌──(kali㉿kali)-[~]
└─$ smbmap -H $TARGET_IP -u "$USER" -p "$PASSWORD" -A "(?i)(pass|cred|secret|config|kdbx|key|pem|ppk|rdp|vhd|vhdx|bak|zip|7z|sql|mdb|accdb|ps1|bat|cmd|xml|ini|txt)$"
┌──(kali㉿kali)-[~]
└─$ smbmap -H $TARGET_IP -A "(?i)(pass|cred|secret|config|kdbx|key|pem|ppk|rdp|vhd|vhdx|bak|zip|7z|sql|mdb|accdb|ps1|bat|cmd|xml|ini|txt)$"

If you find a likely target, pull it for offline review. Use get for individual files and inspect locally. Encrypted archives confirm something worth protecting was there even if you cannot open them immediately. Note the full path and revisit after gaining a higher-privilege session if needed.

┌──(kali㉿kali)-[~]
└─$ smbclient //$TARGET_IP/Shared -U "$USER%$PASSWORD" -c "get config.xml"
┌──(kali㉿kali)-[~]
└─$ smbclient //$TARGET_IP/Public -N -c "get backup.zip"

What matters is not file count. It is whether the share gives you configuration files, scripts, backups, exported databases, password manager files, keys, certificates, or connection profiles that support credential reuse, VPN access, database access, or trusted script review.

If SMBMap returns no pattern matches but you know the share is accessible, try lowercasing the pattern or removing the case-insensitive flag. Some SMB server configurations handle filename case differently. On large or heavily loaded shares, recursive listing may time out. Narrow the scope by specifying a subdirectory path with -r, or browse the subtree directly using smbclient. PowerShell scripts and batch files on accessible shares are especially useful when they contain credentials, paths to other systems, or logic that reveals how the environment is structured.

References