Skip to content

fix: prevent direct traffic leaks during profile transitions - #1768

Open
4RH1T3CT0R7 wants to merge 5 commits into
throneproj:devfrom
4RH1T3CT0R7:fix/1611-kill-switch
Open

fix: prevent direct traffic leaks during profile transitions#1768
4RH1T3CT0R7 wants to merge 5 commits into
throneproj:devfrom
4RH1T3CT0R7:fix/1611-kill-switch

Conversation

@4RH1T3CT0R7

@4RH1T3CT0R7 4RH1T3CT0R7 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The existing profile switch path stops the current core before starting the next one. Closing the core also removes the TUN adapter, routes, DNS handling, and sing-tun's dynamic WFP filters. During that gap, Windows can use the physical default route again.

This adds an opt-in Windows kill switch in Tun Settings. It installs fail-closed Windows Filtering Platform policy before any profile is torn down and keeps direct traffic blocked while Throne is connecting, switching, reconnecting, disconnected, or in an error state. The setting is disabled by default.

Implementation

  • Adds persistent IPv4 and IPv6 block filters at the ALE connect and receive/accept layers.
  • Uses dynamic allowances for ThroneCore bootstrap traffic and for the active TUN interface only.
  • Removes the TUN allowance before stopping or restarting the core.
  • Keeps the persistent block after manual disconnect, failed start, normal exit, and unexpected GUI/core termination.
  • Reconciles stale Throne-owned policy at startup and modifies only objects carrying Throne's deterministic ownership markers.
  • Adds an explicit --disable-kill-switch recovery path and runs it during uninstall.
  • Constrains endpoint bootstrap DNS to an encrypted resolver with a numeric IPv4 or IPv6 address.
  • Forces ordinary DNS and routing through the proxy while the kill switch is active.
  • Rejects profiles and routing modes whose direct behavior cannot be safely audited, including opaque full configs, ExtraCore, direct/SOCKS4/Tailscale profiles, auto-selector, and immutable raw routes.
  • Blocks LAN access in the first version, apart from loopback and narrowly scoped DHCP/IPv6 control traffic.

Fixes #1611

Classify routing-profile outbounds and every chain hop while collecting dependencies. This keeps the fail-closed policy explicit where these additional egress paths enter the build and protects against later build-order changes bypassing shared chain validation.

Also clarify that the rejection applies to profiles selected by routing rules.
@Mahdi-zarei
Mahdi-zarei force-pushed the dev branch 2 times, most recently from 9988348 to 7d96d9e Compare August 17, 2026 20:10
@Mahdi-zarei

Copy link
Copy Markdown
Member

These changes are too intrusive and hard to maintain, i need more time to review and see if such a feature as you have proposed is feasible to have.

@4RH1T3CT0R7

Copy link
Copy Markdown
Contributor Author

These changes are too intrusive and hard to maintain, i need more time to review and see if such a feature as you have proposed is feasible to have.

I can break this down into several logical parts if this will help

@Mahdi-zarei

Copy link
Copy Markdown
Member

I can break this down into several logical parts if this will help

No not really, I will try to get back to you as soon as i can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

behavior like nekoray

2 participants