crackmapexec
crackmapexec can reveal domain name:
With list of usernames and passwords, you can try bruteforcing:
crackmapexec smb manager.htb -u Desktop/user.txt -p Desktop/user.txt --no-brute --continue-on-success
smbclient
Check on non-default shares such as Replication or Users.
smbclient -N -L //10.10.10.100
NTLM Auth Disabled
In such case like HTB-Scrambled, NTLM authentication might be disabled for security purpose and you won’t be able to use standard tools and you won’t be able to access any any service by IP address if it requires authentication.
Using impacket’s smbclient.py you can access SMB:
smbclient.py -k scrm.local/ksimpson:ksimpson@dc1.scrm.local -dc-ip dc1.scrm.local
smbmap
smbmap -H 10.10.10.172 -u SABatchJobs -p SABatchJobs
Download Share
Recursively Download
Mount
Without Creds:
mount -t cifs //10.10.10.134/backups /mnt
With Creds:
sudo mount -t cifs -o 'username=audit2020,password=audit123~' //10.10.10.192/forensic /mnt
Password Hunting
First take a look at what files are in there:
find .ls
You can also list files only: find . -type f
Look for passwords:
grep -ir 'password' .
grep -ir 'pwd' .
grep -ir 'pass' .
Interaction On Windows
CMD
On CMD, we can list the share as such:
dir \\ip-addr\Finance
To connect to a share, we can use net use
as such:
net use n: \\ip-addr\Finance
If we need to authenticate, credentials can be provided as such:
net use n: \\ip-addr\Finance /user:user1 Password123
To find out how many files the share contains:
dir n: /a-d /s /b | find /c ":\"
We can look for files with certain names as such:
If we want to look for a specific word within a text file, we can use findstr
:
PowerShell
List the share:
To connect to the share:
To provide a username and password, we need to create PSCredential object:
To look for a file with certain name:
To look for a file that contains the certain keyword: