stop the creator dialing private/internal destinations (#175)

connectTCP and dialCreatorUDP dialed whatever address came over the tunnel, so a joiner could make the creator reach its own LAN, loopback or the metadata ip at 169.254.169.254. dc mode had the same hole so the check lives in common now, all three paths call it. i block everything that isn't global unicast plus RFC1918 and cgnat, and ":80" too - empty host dials the local machine. names get checked inside Dialer.Control, per resolved address right before connect, so a re-resolve can't rebind past it and the dialer keeps its address fallback. with an upstream socks the name is resolved proxy-side, so there only the literal is mine to check. --allow-private-dst brings the old behaviour back.
This commit is contained in:
Sbenazar authored and GitHub committed 2026-09-03 20:20:52 +02:00
1 parent 89d7a474b7
commit 747f8f2312
9 files changed
+108 -21

No files matched your search

+2
View File
@@ -26,8 +26,10 @@ func main() {
upstreamUser := flag.String("upstream-user", "", "upstream SOCKS5 username")
upstreamPass := flag.String("upstream-pass", "", "upstream SOCKS5 password")
debugFlag := flag.Bool("debug", false, "verbose debug logging")
allowPrivate := flag.Bool("allow-private-dst", false, "let the joiner reach private/internal addresses through this creator")
flag.Parse()
common.Debug = *debugFlag
common.AllowPrivateDst = *allowPrivate
var readBuf int
var memLimit int64