Local listeners bind 0.0.0.0 with no access control #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium
Client (and DNS, and typical server examples) listen on all interfaces with no access control on the local forwarded ports. Anyone who can reach that host can use the tunnel.
What happens
net.Listen("tcp", fmt.Sprintf(":%d", rule.LocalPort))→0.0.0.0(internal/client/client.go).:%d.Addr: fmt.Sprintf(":%d", cfg.DNSServer.ListenPort)(pkg/dns/dns.go).listen_address: :9000/:8080(all interfaces). Docs talk about connecting tolocalhost:8080as if it were loopback-only.So if you forward SSH as
tcp://22:2222on a homelab box, every machine on the LAN (or the internet, if the port is forwarded) can hit remote SSH through your key and your tunnel. Same for databases. There is no allowlist, no local auth, no bind-host field.The server side of the tunnel only checks that decryption of the handshake succeeds (shared key). Combined with all-interfaces bind, a leaked or guessed key plus an exposed listen port is a full proxy.
Suggested fix
127.0.0.1:<port>, not:port.bind_address: 127.0.0.1(or per-ruletcp://22:127.0.0.1:2222).listen_addressexamples to127.0.0.1:9000unless the operator is intentionally publishing the server.0.0.0.0.Triaged as medium. Default listeners to 127.0.0.1, add bind host, fix README. Same stream as #2, not PR #1.