Operator On The Wire
Join
← Back to Knowledge Base
RED TEAM / PIVOTING / TUNNELING

Socat

Prerequisites

  • socat installed on the host where you are forwarding traffic.
  • Appropriate firewall rules allowing listening ports.

Forward From Local Listen Port to Attack Host

socat TCP4-LISTEN:8080,fork TCP4:<IPaddressofAttackHost>:80
  • Listens on local port 8080.
  • For each connection (fork), connects to <IPaddressofAttackHost>:80.

Forward From Local Listen Port to Target Host

socat TCP4-LISTEN:8080,fork TCP4:<IPaddressofTarget>:8443
  • Listens on 8080.
  • Forwards to <IPaddressofTarget>:8443.

Great for simple TCP relays when you can’t run more complex tunneling tools.