Research publication Client security
Kill switches compared: firewall-based vs route-based enforcement
A VPN kill switch stops traffic leaving outside the tunnel while the tunnel is unavailable. Firewall-based designs use default-deny filters that outlive tunnel restarts; route-based designs depend on routes the OS can remove or override. We compare both, list failure modes and give a test.
Abstract
“Kill switch” names a property — no traffic outside the tunnel while the tunnel is down — that VPN clients implement in fundamentally different ways. Route-based enforcement steers traffic into the tunnel interface through routing-table entries; firewall-based enforcement drops every packet that is not destined for the tunnel or an explicit exception; a reactive pattern terminates selected applications after a failure is detected; and some platforms provide enforcement of their own. We describe each design with reference to documented mechanisms — policy routing, network namespaces, the Windows Filtering Platform, nftables, Apple’s Network Extension and Android’s always-on VPN — and analyse how each behaves during reconnects, sleep and wake, network changes, helper-process crashes, updates and start-up. We then examine the exceptions every kill switch needs, which is where most published bypasses operate, including the LocalNet and ServerIP attack classes and routes injected through DHCP option 121 (CVE-2024-3661). We close with a test procedure that forces each failure condition while observing traffic on the physical side.
What a kill switch must guarantee
A kill switch is a mechanism that prevents a device’s traffic from leaving by any path other than the VPN tunnel when the tunnel is not available — before it is established, while it is being re-established, and after it has failed.
The guarantee is about state, not about the tunnel: a kill switch earns its name only in the moments when the tunnel is not working. A design is fail-closed if every failure it may encounter — server loss, interface removal, a crashed helper process, a network change — leaves traffic blocked, and fail-open if some failure leaves traffic flowing over the physical interface. Most real designs are fail-closed for some failures and fail-open for others, which is why testing must enumerate failures rather than check a setting.
A kill switch addresses the path of packets. It does not, by itself, address resolver divergence inside the tunnel (see How DNS leaks happen in VPN clients: a technical taxonomy (VPNL-R-2026-001)) or address-family gaps where IPv6 is neither tunnelled nor blocked (see IPv6 and WebRTC: the overlooked leak paths (VPNL-R-2026-005)).
Four designs
Route-based enforcement
Route-based clients install routes that make the tunnel interface the preferred path for all destinations. Common techniques are replacing the default route; adding the two half-routes 0.0.0.0/1 and 128.0.0.0/1, which are more specific than 0.0.0.0/0 and therefore win without deleting it; and, on Linux, policy routing in which packets that are not marked as tunnel traffic are looked up in a separate table that contains only the tunnel route, as WireGuard’s wg-quick does with a firewall mark and a suppress_prefixlength rule [1]. In every variant, the VPN server’s own address keeps a route via the physical gateway, or the encrypted packets would loop back into the tunnel.
The weakness is that routes are mutable state owned by the operating system. When the tunnel interface goes down, the routes attached to it are removed and, unless the client has left a blocking (unreachable or blackhole) route behind, the original default route via the physical gateway becomes active again: the design fails open. Other actors add routes too — DHCP, Router Advertisements, virtualisation software, other VPN clients — and longest-prefix matching means any route more specific than the tunnel’s wins. Sockets explicitly bound to the physical interface, for instance with SO_BINDTODEVICE on Linux or interface-scoped sockets on Apple platforms, may not consult the VPN’s routes at all.
The WireGuard project documents a stronger variant that removes the fallback altogether: the physical interfaces are moved into a separate network namespace, and processes in the main namespace see only the tunnel interface [1]. With no physical interface available to them, there is nothing to fail open to.
Firewall-based enforcement
Firewall-based clients install packet-filter rules that drop all traffic except traffic on the tunnel interface, the encrypted packets to the VPN server’s address and port, and narrowly defined local exceptions. On Windows this uses the Windows Filtering Platform (WFP) [2]; on Linux, nftables or iptables [3]; on macOS, the pf packet filter or, for clients built on the Network Extension framework, the system itself. The security policy database of IPsec, with its PROTECT, BYPASS and DISCARD actions, is the standards-track ancestor of the same idea [4], and NIST’s guide to IPsec VPNs discusses how such policies are configured in practice [5].
Because filtering does not depend on which routes exist, a route change cannot reopen the path: a packet steered to the physical interface is simply dropped. The trade-off is lifecycle. The rules must exist whenever the tunnel is down, including while the client process is not running. WFP distinguishes dynamic sessions, whose filters are deleted automatically when the session closes — for example when the process that opened it exits or crashes — from persistent filters, which survive restarts, and boot-time filters, which are enforced before the Base Filtering Engine starts [2]. A client that installs its kill-switch filters in a dynamic session gets clean-up for free, and loses its protection the moment its service crashes.
Persistent filtering has its own cost: if the client is uninstalled badly or its configuration is corrupted, the user can be left without connectivity. Designs that are fail-closed therefore need a documented, deliberate recovery path.
Reactive application termination
Some clients offer an “application kill switch” that terminates selected programs when the tunnel drops. This is detection followed by reaction: the client must first notice the failure, often by missed keep-alives, which can take seconds, and then terminate the processes. Anything the applications send in between leaves through the physical interface, and system services are not covered at all. It is a useful complement to enforcement, never a substitute for it.
Platform-provided enforcement
Android offers always-on VPN with an option to block connections without VPN; with it enabled, the system — not the app — blocks traffic that does not use the VPN [6]. Apple’s Network Extension framework provides the includeAllNetworks property on VPN configurations, which directs the system to send all traffic through the tunnel, with related properties governing exceptions such as local networks [7]. Platform enforcement has the advantage of surviving app crashes; its limits are those the platform documents and implements, and must be tested like any other design.
Failure modes
Table 1 summarises how the two main designs typically behave under the events that matter. Individual clients often combine techniques — routes for steering, filters for enforcement — so the table describes tendencies, and only testing establishes what a particular version does. Figure 1 shows the reconnect case as a timeline.
| Event | Route-based | Firewall-based | How to trigger it |
|---|---|---|---|
| Reconnect after server loss | Routes leave with the interface; default route active until rebuilt | Rules unaffected; traffic dropped until the tunnel returns | Block the server address upstream for 30 s |
| Change of server | As above, for every switch | Window if old endpoint rules are removed before new ones are added | Switch servers repeatedly |
| Sleep and wake | DHCP renewal may reinstall a default route before the client resumes | Kernel rules persist through sleep | Suspend for several minutes with traffic queued |
| Network change | New interface brings its own default route | Protected only if rules are not tied to specific interfaces | Switch Wi-Fi ↔ Ethernet; join a new network |
| Helper crash or kill | No protection against later route changes | Dynamic rules vanish; persistent rules remain | Terminate the helper process forcibly |
| Client update | Depends on uninstall order | Depends on whether rules are removed during the upgrade | Install an update while connected |
| Start-up | No routes until the client starts | Only persistent or boot-time rules apply | Reboot with auto-connect enabled |
Two observations follow. First, the leak windows sit at transitions, which is why a test of the connected state finds nothing. Second, the decisive question for a firewall-based design is not whether rules exist while the client runs, but who owns them when it does not.
Exceptions: where kill switches are bypassed
Every working kill switch is a default-deny rule plus exceptions, and most published bypasses target the exceptions rather than the rule.
- The VPN endpoint. The client must let encrypted packets reach the server. If the exception is by address, and the address came from an unauthenticated DNS lookup, an attacker who controls DNS on the local network can make the exception cover an address of their choosing. Xue and colleagues describe this as the ServerIP attack, one of the two attacks they published under the name TunnelCrack [8]. Shipping server addresses in authenticated configuration and limiting the exception to the tunnel’s protocol and port narrow it.
- The local network. “Allow LAN access” typically exempts the subnets of the physical interface. A hostile network can declare a subnet that includes public addresses, so that traffic to those destinations is treated as local — the LocalNet attack in the same study [8]. Restricting the exception to private ranges (RFC 1918 for IPv4, unique local and link-local addresses for IPv6) closes most of it [9, 10].
- Routes from DHCP. DHCP option 121 lets a DHCP server push classless static routes [11]. Published in 2024 as CVE-2024-3661 [12] and publicly described under the name TunnelVision, the technique lets a hostile local network install routes more specific than the tunnel’s for chosen destinations; clients that rely on routing alone then send that traffic outside the tunnel. Firewall rules that drop non-tunnel traffic turn the attack into a loss of connectivity to those destinations rather than a leak.
- Infrastructure traffic. DHCP, ARP and IPv6 neighbour discovery must keep working on the local link. Exceptions for them should be limited to link-local scope and their specific protocols.
- Captive portals and split tunnelling. Both are deliberate holes. Split tunnelling rules and portal sign-in exceptions should be as narrow and short-lived as possible, and tested as part of the kill switch, not separately from it.
How to test a kill switch
Testing follows the structure of NIST SP 800-115: plan the conditions, execute, and record evidence for each [13]. For mobile clients, the network requirements of OWASP MASVS and the corresponding test cases in the MASTG provide a complementary checklist [14].
- Observe from the physical side. Capture on the device’s physical interface, or better on a tap or the lab router, so that traffic is recorded even if the device’s own capture is affected by the failure being tested.
- Generate continuous, attributable traffic. Unique DNS names, ICMP echo to a fixed external host and HTTPS requests at fixed intervals (for example every 100 ms), from a user application and from a background service.
- Force each failure in Table 1 while the traffic runs, and note the time of each trigger.
- Filter out the tunnel. Exclude the encrypted traffic to the server’s address and port and link-local infrastructure traffic; every remaining packet is a leak candidate.
- Repeat. Run each condition many times — 20 runs is a reasonable starting point — and report, per condition, the number of runs with leaks, the packets leaked and the time from trigger to first and last leaked packet.
- Vary the environment. Repeat with IPv6 available, with LAN access enabled and disabled, after restarting the helper service, and on a lab network whose DHCP server pushes option 121 routes and a public-range local subnet.
# Lab router interface facing the client. 198.51.100.7 = VPN server, UDP 51820 = tunnel.
tcpdump -n -i eth1 -w ks-run-04.pcap \
'not (host 198.51.100.7 and udp port 51820) and not arp and not net fe80::/10 and not (udp port 67 or udp port 68)'
Our leak-testing methodology applies these steps to every client we examine, and findings are rated with the severity scheme used in our security audits.
Limitations
This publication describes designs at the level of documented operating-system mechanisms. Clients combine them in ways that cannot be inferred from the outside, and platform behaviour changes between releases, so every claim about a particular client must come from testing that version on that platform. The attack classes cited are published research; whether a given client is affected is an empirical question.
References
All sources are publicly available primary documents. Numbers correspond to the bracketed citations in the text.
- 1Donenfeld, J. A. (n.d.). Routing & Network Namespace Integration. WireGuard. https://www.wireguard.com/netns/
- 2Microsoft. (n.d.). Windows Filtering Platform. Microsoft Learn. https://learn.microsoft.com/en-us/windows/win32/fwp/windows-filtering-platform-start-page
- 3The Netfilter Project. (n.d.). nftables wiki. https://wiki.nftables.org/
- 4Kent, S., & Seo, K. (2005). Security Architecture for the Internet Protocol (RFC 4301). RFC Editor. https://www.rfc-editor.org/rfc/rfc4301
- 5Barker, E., Dang, Q., Frankel, S., Scarfone, K., & Wouters, P. (2020). Guide to IPsec VPNs (NIST Special Publication 800-77 Rev. 1). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-77r1
- 6Google. (n.d.). VPN. Android Developers. https://developer.android.com/guide/topics/connectivity/vpn
- 7Apple Inc. (n.d.). includeAllNetworks — NEVPNProtocol. Apple Developer Documentation. https://developer.apple.com/documentation/networkextension/nevpnprotocol/includeallnetworks
- 8Xue, N., Malla, Y., Xia, Z., Pöpper, C., & Vanhoef, M. (2023). Bypassing Tunnels: Leaking VPN Client Traffic by Abusing Routing Tables. In 32nd USENIX Security Symposium (USENIX Security 23). USENIX Association. https://www.usenix.org/conference/usenixsecurity23/presentation/xue
- 9Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G. J., & Lear, E. (1996). Address Allocation for Private Internets (RFC 1918). RFC Editor. https://www.rfc-editor.org/rfc/rfc1918
- 10Hinden, R., & Haberman, B. (2005). Unique Local IPv6 Unicast Addresses (RFC 4193). RFC Editor. https://www.rfc-editor.org/rfc/rfc4193
- 11Lemon, T., Cheshire, S., & Volz, B. (2002). The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4 (RFC 3442). RFC Editor. https://www.rfc-editor.org/rfc/rfc3442
- 12CVE Program. (2024). CVE-2024-3661. The MITRE Corporation. https://www.cve.org/CVERecord?id=CVE-2024-3661
- 13Scarfone, K., Souppaya, M., Cody, A., & Orebaugh, A. (2008). Technical Guide to Information Security Testing and Assessment (NIST Special Publication 800-115). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-115
- 14OWASP Foundation. (n.d.). OWASP Mobile Application Security Testing Guide (MASTG). https://mas.owasp.org/MASTG/
Cite this publication
APA style
VPN Network Research Labs. (2026, July 28). Kill switches compared: Firewall-based vs route-based enforcement (Research Publication No. VPNL-R-2026-003, Version 1.1). https://vpn.com.de/research/kill-switches-firewall-vs-route-based
BibTeX
@techreport{vpnl-r-2026-003,
author = {{VPN Network Research Labs}},
title = {{Kill switches compared: firewall-based vs route-based enforcement}},
institution = {VPN Network Research Labs},
type = {Research Publication},
number = {VPNL-R-2026-003},
year = {2026},
month = jul,
date = {2026-07-28},
version = {1.1},
url = {https://vpn.com.de/research/kill-switches-firewall-vs-route-based},
langid = {en},
note = {Version 1.1, updated 2026-09-22}
}
Download citation
Cite the document ID and the version you read. Document IDs are permanent; substantive changes receive a new version number and an entry in the revision history below.
Revision history
| Version | Date | Change |
|---|---|---|
| 1.1 | Clarified the lifetime of dynamic, persistent and boot-time WFP filters; added a helper-restart step and a lab DHCP option 121 step to the test procedure. | |
| 1.0 | Initial publication. |
Found an error? Write to support@vpn.com.de. Corrections are handled under our corrections and retractions policy and are never applied silently.
Methodology and definitions
Terms used in this publication
Test records
This publication contains no results about specific products. Product tests, audits and their evidence are published in the Report Registry and the Evidence Database.