Skip to content

fix: don't listen on every interface in createTunnel - #675

Merged
VojtaM39 merged 4 commits into
masterfrom
fix/fix-tunnel-connect-vulnerability
Aug 26, 2026
Merged

fix: don't listen on every interface in createTunnel#675
VojtaM39 merged 4 commits into
masterfrom
fix/fix-tunnel-connect-vulnerability

Conversation

@VojtaM39

@VojtaM39 VojtaM39 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

createTunnel() called server.listen(0) without a host, so the tunnel bound the
unspecified address (:: / 0.0.0.0). Any peer that could reach the host could tunnel
to targetHost using those credentials.

GHSA-5vwf-g8jp-pgj3, #660.

Changes:

  • createTunnel() listens on 127.0.0.1 by default. The port and hostname options
    documented in the README work again — they were dropped from the implementation in v2.0.0.
    Pass hostname: '0.0.0.0' to opt back into the old binding.
  • Warns when bound to a non-loopback address.
  • Tests for the listener address.
  • additional change - anonymizeProxy has optional port and defaults to 0 (random port)

Behavior change: the returned endpoint is 127.0.0.1:<port> instead of 0.0.0.0:<port>.

I have also pushed a branch tmp/tunnel-connect-fix-with-repro with repro, that demonstrates that the fix works.

@github-actions github-actions Bot added t-unblocking Issues with this label are in the ownership of the unblocking team. tested Temporary label used only programatically for some analytics. labels Aug 24, 2026
@VojtaM39
VojtaM39 marked this pull request as draft August 24, 2026 16:39
@VojtaM39 VojtaM39 added the adhoc Ad-hoc unplanned task added during the sprint. label Aug 24, 2026
@VojtaM39
VojtaM39 marked this pull request as ready for review August 25, 2026 06:15
@VojtaM39
VojtaM39 requested a review from bliuchak August 25, 2026 07:42

@bliuchak bliuchak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

Comment thread examples/apify_proxy_tunnel.js
Comment thread src/anonymize_proxy.ts
Comment thread src/tcp_tunnel_tools.ts
Comment thread src/tcp_tunnel_tools.ts
@bliuchak
bliuchak requested a review from jirimoravcik August 26, 2026 07:59
@bliuchak

bliuchak commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@jirimoravcik could you please take a look at it (just in case we're not missing something)? 🙏

Comment thread README.md Outdated
Comment thread src/utils/validate_listen_port.ts
Comment thread src/tcp_tunnel_tools.ts
@VojtaM39
VojtaM39 merged commit 1c74b5e into master Aug 26, 2026
9 checks passed
@VojtaM39
VojtaM39 deleted the fix/fix-tunnel-connect-vulnerability branch August 26, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-unblocking Issues with this label are in the ownership of the unblocking team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants