Add sensitive_files SMB module - enumerate shares for sensitive file extensions - #1331
Add sensitive_files SMB module - enumerate shares for sensitive file extensions#1331Char0n1507 wants to merge 7 commits into
Conversation
|
Hi and thanks for the PR. However, this is pretty much the exact same that would be able to do with |
|
Hi @NeffIsBack, thanks for the review! I understand the overlap with --spider --pattern. The key differences I was trying to add were:
Would it be worth keeping as a convenience module, or would you prefer |
Hi, yes, I think we should not duplicate functionality here, but rather add missing functionality to |
So I personally use manspider for that usage but I believe we can have this on NXC as well. The easier would be to have a text file in nxc/data with each default extensions we are looking for. Then add a boolean such as --default-extensions that will load these extensions. Later we'll even be able to implement a "search by keyword" option based on the same text files And obviously the --output-dir to store all found items :P |
|
Hi @Dfte, @NeffIsBack — that's a great direction! I love the idea of:
I can implement this approach instead. This would make it Would you be open to me updating this PR with that implementation? |
|
To me that looks like a great addition! And then we will be able to replicate these files for others protocols such as winrm, nfs. Afterall, it's all about looping over directories and files! The only question I have is rather how we will manage these "words/extensions list". How do we allow people contributing ? Do we add anythng ? For the extensinos for examples, may be we could somehting like:
|
|
Hi @Dfte great question on managing the extensions list! Here's what I've implemented and validated: How
For community contributions anyone can PR new extensions directly to Live SMB test (all 3 files detected): [*] Scanning share: TESTSHARE
[TESTSHARE] \app.config
[TESTSHARE] \server.pfx
[TESTSHARE] \passwords.kdbx
[+] Found 3 sensitive file(s) on 127.0.0.1Unit tests: 8/8 pass (default load, custom file, comma list, MAX_DEPTH, OUTPUT_DIR, SHARE filter) Before I push do you prefer the option named
|
… OUTPUT_DIR - Fix _crawl path: use r'\*' so subdirs list correctly - Fix extension loading: ship sensitive_extensions.txt with module via DATA_PATH - Fix options/run: write config to tempfile to survive NXC double-instantiation - OUTPUT_DIR now writes per-host result files correctly
|
Hi @Dfte, great question on managing the extensions list! Here's what I've implemented and validated: How
For community contributions anyone can PR new extensions directly to Additional validation — extension filtering confirmed working (commit # Single extension — returns only matching files
$ nxc smb 127.0.0.1 -u '' -p '' -M sensitive_files -o EXTENSIONS=.pfx
[*] Scanning share: TESTSHARE
[TESTSHARE] \backup.pfx
[+] Found 1 sensitive file(s) on 127.0.0.1
# Non-existent extension — returns no findings
$ nxc smb 127.0.0.1 -u '' -p '' -M sensitive_files -o EXTENSIONS=.xyz
[*] Scanning share: TESTSHARE
Open to feedback on naming conventions or adjustments to the default extension list. Happy to revise based on review. |
|
Alright! That looks great but as @NeffIsBack mentionned, I'd rather have these options in the core alongside --spider |
- Removes standalone sensitive_files module - Adds --spider-sensitive as native --spider flag - Curated extensions: .kdbx .pfx .p12 .pem .key .ppk .ovpn .rdp .config .conf .cfg .env .xml .ini .id_rsa .vnc - Compatible with --pattern and --regex flags - Addresses review feedback from NeffIsBack and Dfte
Updated per review feedbackReplaced the standalone Changes:
Test output:
|
|
Thank you! I will have some times this week to check that out and benchmark speed with other tools such as Manspider for example!! |
Actually that's a great idea. We should probably - one day - merge |
|
Thanks @NeffIsBack — really glad the direction landed well! The idea of unifying --spider and -M spider_plus into one protocol-agnostic crawling layer makes a lot of sense. A single crawl engine that works across SMB, WinRM, NFS etc. would be much cleaner than per-protocol duplicates. Happy to help with that consolidation if you decide to pursue it. For now I'll keep this PR focused on the --spider-sensitive flag so it's reviewable and mergeable on its own. @Dfte looking forward to the Manspider benchmark — let me know if you want me to set up a reproducible test environment to make the comparison fair. |
|
Hi @Dfte @NeffIsBack — just following up on this PR when you get a chance. I’ve kept the implementation focused on the No rush just wanted to check in and see if there’s anything else needed from my side to move this forward. Thanks! |



Description
Adds a new SMB enumeration module
sensitive_filesthat crawls all accessibleshares on a host and flags files with sensitive extensions.
Default extensions hunted: .kdbx, .pfx, .p12, .pem, .key, .ppk, .ovpn,
.config, .conf, .cfg, .xml, .ini, .env, .rdp, .id_rsa, .vnc
Module options:
No new dependencies required.
AI assistance: Module structure and debugging assisted by Claude (claude.ai).
Design, testing, and decisions were human-driven and verified against a live
impacket smbserver test environment.
Type of change
Setup guide for the review
Test steps:
sudo impacket-smbserver testshare /tmp/smb-test -smb2support &
touch /tmp/smb-test/passwords.kdbx /tmp/smb-test/server.pfx /tmp/smb-test/app.config
nxc smb 127.0.0.1 -u '' -p '' -M sensitive_files
Expected: 3 sensitive files flagged with full UNC paths.
Screenshots (if appropriate):
[paste your terminal screenshot from the successful test]
Checklist: