The following are checks for old smb exploits, which I've seen a lot of times when doing old HTB boxes. Hence, have documented these for whenever I come across old smb version.
$nmap-p139,445--script-args=unsafe=1--script/usr/share/nmap/scripts/smb-os-discoveryIP# test for known smb vulns # cve2009-3103: ms09-050nmap--script=smb-vuln-cve2009-3103.nse-p139,445IPnmap--script=smb-vuln-ms06-025.nse,smb-vuln-ms07-029.nse,smb-vuln-ms08-067.nse,smb-vuln-ms10-054.nse,smb-vuln-ms10-061.nse,smb-vuln-ms17-010.nse-p139,445IP# exploit downnmap-Pn--scriptsmb-vuln-cve-2017-7494--script-argssmb-vuln-cve-2017-7494.check-version-p139,445IP# using NMAP lto enumerate shares:nmap-p139,445--script=smb-enum-shares.nse,smb-enum-users.nseIP
smbclient | smbmap
smbmap-HIP [-P PORT] [-d DOMAIN] [-u USER] [-p PASS] [-s TARGET_SHARE]smbclient//IP/TARGET_SHARE/PATH-UUSER%PASS-pPORT# -L LIST_SHARES# -c COMMAND_TO_EXECUTE;# -N NO_PASSWORD# copy entire share to local-disksmbclient'\\IP\TARGET_SHARE'-N-c'prompt OFF;recurse ON;mget *'smbget-Rsmb://IP/TARGET_SHARE--guest# to read file within smbmoreFILENAME# to copy outside of sharegetSHARE_FILEFILENAME
enum4linux
enum4linux-aIP# -U: get user-list# -M: get machine-list# -N: get name-list dump# -S: get share-list# -P: get password-policy info# -G: get group & member list# -a: get all.enum4linux-ng.py-AIP [-U USER] [-p PASS]# -C: enum services# -R: enum users via RID cycling# -S: enum shares
Shares (nfs, cifs)
Viewing
showmount-eIP# -a: List both the client IP and mounted directory in host:dir format.# -d: List only the directories mounted by some client.