VeilNet
Blog

Tailworm: when the agent that secures your network becomes the way in

On Sunday, a researcher showed how one compromised laptop with an SSH grant could take root on a server in a Tailscale network, and then on the next one. Tailscale is fixing it fast. The lesson goes well past one product, though. The agents we install to secure access now hold some of the most powerful positions on our machines. Here's what went wrong, what we can learn from it, how VeilNet is designed to avoid it, and how to move across.

YOUR SERVERUSER SPACEVEILNET ANCHOR · RUNS WITHOUT ROOTKNOCKCHECKVIRTUAL KERNELTCP/IPIN THE PROCESSvNICTHE HOST'S OWNsshd :22SIGN-IN UNCHANGED127.0.0.1:22HOST KERNELNO TUN · NO ROUTES · NO OVERLAY ADDRESSESONE UDP PORTSCANNERGETS NO REPLYMEMBERSIGNED KNOCKTHE INTERNETlogin:

What went wrong

On Sunday 25 October, Erica Windisch of Cyberdione Labs published Tailworm, a report on eleven security problems in Tailscale and in headscale, the open-source control server some people run in place of Tailscale's own. The testing ran in a lab over three days, against Tailscale 1.104.2 and headscale 0.29.5.

The finding everyone noticed is in Tailscale SSH. Take an SSH rule that allows port forwarding, and one machine on the network that you already control. With those two things, you can end up as root on the server the rule lets you into. Then you can do the same again from there. In the lab, the chain ran on its own at under a second per hop, which is how the report got its name.

Tailscale took it seriously straight away. Mike Shaver, its VP of Engineering, acknowledged the report on Reddit, and by Monday there was an investigation page saying that “most of the Tailscale SSH issues we've identified concern privilege escalation”. Fixes are in testing, aimed at a release by the end of Tuesday 27 October, and Tailscale hasn't yet said which versions are affected. Until the fix lands, it suggests turning off SSH forwarding, and says it's “not recommending that everyone disable Tailscale SSH”.

We're not writing this to pile on. It's a failure worth learning from, because it comes from how these agents are built rather than from a one-off slip.

How one Tailscale SSH grant became root

Tailscale SSH is a clever idea. Instead of handing out SSH keys, you write a rule saying who may SSH to which machines, and Tailscale's own identity does the rest. To make that work, connections to port 22 on a machine's Tailscale address are, in the words of Tailscale's announcement, “rerouted to an SSH service inside the Tailscale daemon instead of to your standard SSH server.”

That daemon, tailscaled, usually runs as root. It creates the network card the tailnet uses, and it edits the machine's routes and DNS, which are root's jobs. So the SSH server lives inside a root process.

Now add port forwarding. SSH can forward a Unix socket as well as a TCP port, with ssh -L and a socket path on the far end. OpenSSH does this after it has switched to the user you signed in as, so the kernel checks that user's right to open the socket, the same as anything else they do. According to the report, Tailscale SSH had the root daemon connect instead, “on the peer's behalf”. A short list of allowed paths was meant to keep that away from anything sensitive. A race between checking the path and using it got around the list.

Fig. 01 — One grant to root01 / 04
LAPTOPFOOTHOLDROOT ON ASERVER ATAILSCALEDRUNS AS ROOTSSH server/tmp/xALLOWED PATHROOT ONLYdocker.sockSERVERBSERVERCSSH RULEDIALLED AS ROOTSWAPPED AFTER THE CHECKUNDER A SECONDPER HOP

The attacker already controls one laptop on the network, through some ordinary route: a phishing email, a poisoned package, a stolen password. The policy lets that laptop open SSH sessions on server A, with forwarding allowed.

Over that session, the laptop asks for a Unix socket to be forwarded, at a path the allow-list accepts. The SSH server is part of the agent, and the agent runs as root. So it's root that connects to the socket, not the user who logged in.

Between the check and the connect, the attacker swaps what's at that path for Docker's socket. Docker's socket only lets root in, and root is the one asking.

Docker's socket is as good as root on server A. From there, the same steps work on every machine the policy lets A reach. In the lab, each hop took under a second.

Simplified from the Tailworm report's first and third findings. The report also shows a reverse forward replacing root-owned sockets outright. Every step relies on the forward being made by root.

The lab demo forwarded Docker's socket, which on most Linux machines is as good as root, and read /etc/shadow without sudo. Another finding used a reverse forward, ssh -R, to replace root-owned sockets outright.

Nobody broke any crypto or stole a key here. The socket's file permissions even did their job. The question they were asked was “can root open this?”, and the answer to that is nearly always yes.

If you run Tailscale today

Tailscale's own guidance is the place to start, and it will change once the patched release is out. At the time of writing, on 27 October, it comes down to this:

  • Turn off SSH forwarding. Set TS_SSH_DISABLE_FORWARDING=1 in the tailscaled service's environment and restart it. Tailscale says this leaves Tailscale SSH running and deals with several of the more serious findings. On headscale 0.29.5, where forwarding can't be turned off per rule, it's the switch you have.
  • Narrow your SSH rules. Give access only to the people and machines that need it, ideally one source and one destination per rule.
  • Update when the fix ships, and read the advisory that follows it.
  • Delete any machine you're unsure of from the tailnet. Reimaging it doesn't revoke keys that were already copied.

What we can learn from it

Tailworm is one product's bug, but the conditions behind it are common. Each lesson below applies to any mesh VPN or zero-trust agent, whoever makes it.

An agent's rights reach every feature it has

Every mesh VPN and zero-trust agent strikes the same bargain. To give you a network that just works, it sits in the middle of each machine, creating a network device and editing routes and DNS, and it usually runs as root to do that. While the agent only moves packets, that's a reasonable trade.

The trouble is that these agents keep picking up more jobs: SSH servers, web proxies, file sharing, connectors into cloud networks. Each is handy, and each runs with the agent's rights, reachable from every other machine on your network.

Tailworm wasn't the first warning, either. Before October, Tailscale had already published four security bulletins about Tailscale SSH this year:

BulletinWhat it allowed
TS-2026-004 · JuneReaching a root-only Unix socket through a symlink and an SSH forward
TS-2026-006 · JuneLogging in as root, despite rules against it, by asking for user 0
TS-2026-009 · JulyA root session for the username -i, which was read as a flag
TS-2026-010 · JulyForwarded environment variables, secrets included, showing up to other local users and in logs

Tailscale published each one openly and fixed it fast, which is what you want from a vendor. But two of the four handed out root sessions, a third reached a root-only socket, and all four live in the same place: an SSH server inside a root process. That's a lot of security-critical code, and small slips in it are expensive.

Getting onto the network shouldn't mean being logged in

When network identity doubles as your SSH login, as it does with Tailscale SSH, one lock stands between a compromised laptop and a shell on your servers. With ordinary OpenSSH, those are two separate checks: the network decides who can reach port 22, and sshd decides who can sign in. A stolen device that passes the first still has to get past the second.

The mesh is also the worm's path

Machines reaching each other directly is the whole point of a mesh, and it's exactly what a worm needs. In Tailworm's lab, the thing that stopped the spread was rules written as single source-to-destination pairs. Broad rules, such as a tag that can reach every server, turn one foothold into many.

Whatever answers strangers is where zero-days land

The bugs that keep people up at night are the ones you can hit before logging in. regreSSHion (CVE-2024-6387) let anyone who could reach OpenSSH on a glibc-based Linux box run code as root. Ten years earlier, Heartbleed leaked server memory to anyone who could open a TLS connection. When one of those drops, the machines that are safe on day zero are the ones the attacker can't reach.

An agent that answers every packet with a handshake, a banner or an error is telling every scanner on the internet that it's there, and what it is.

Questions to ask of any network agent

Whether you run Tailscale, another mesh VPN, a ZTNA product or something your own team built, the lessons above come down to six questions worth putting to whoever looks after it. None of them needs a pentest to answer.

AskWhy it matters
What does the agent run as, and what does it need those rights for?Every feature it ships inherits those rights, including the ones you never turn on.
Does it run its own servers, such as SSH or a web proxy?Each is more code running with the agent's rights, reachable from the network.
Is getting onto the network the same as logging in?If it is, one stolen device is one step from a shell.
If one machine is compromised, what else can it reach?Broad rules turn one foothold into many. Look for per-pair rules or hard compartments.
What does a stranger's packet get back?A handshake, a banner or even an error tells a scanner there's something to attack.
How fast can you cut a machine off for good?Reimaging a machine doesn't revoke keys that were already copied off it.

How VeilNet is designed around it

VeilNet's agent, conflux, runs an anchor on each machine, doing the same job as tailscaled. Here's how its design deals with each of those lessons.

The network lives in a micro virtual kernel

Most agents deliver traffic through a TUN device, a virtual network card in the host's kernel. It works well, and every program on the machine can use it without changes. But creating that card takes root, CAP_NET_ADMIN or Administrator, so the agent usually runs with them.

Our anchor carries its own network stack instead, a micro virtual kernel inside the anchor's own process, with its own virtual network card and its own TCP/IP. In proxy mode, that's where the overlay lives, all of it. The host kernel never gets a TUN device or a route for it. As far as the host can tell, the anchor is just a program with a few sockets open.

Fig. 02 — Where the network lives
A TUN DEVICEUSER SPACEFROM THE WIREA VIRTUAL KERNELUSER SPACEFROM THE WIREMESH AGENTROOTSERVICEsshdHOST KERNELUDPtun0ROUTESNEEDS ROOT OR CAP_NET_ADMINANCHORNO ROOTVIRTUAL KERNELvNICSERVICEsshdHOST KERNELUDPORDINARY SOCKETS ONLYNO DEVICE · NO ROUTESNO CAP_NET_ADMIN

The packet on the left crosses the host kernel twice. The one on the right only ever touches ordinary sockets.

Since nothing gets created in the kernel, the network side needs no special rights, so in proxy mode the anchor doesn't run with any. It runs as its own unprivileged account, with no root and no capabilities. You can run it in a container without CAP_NET_ADMIN, or on a locked-down host where you'd never be allowed to add an interface.

Peers only reach the ports you publish, and each one points at a host and port the machine can already reach, like 5432=127.0.0.1:5432. Never a Unix socket. With no socket path in the picture, there's nothing to swap between a check and a connect.

Root comes in once, when you set conflux up: registering the boot service and writing its configuration under /etc are root's jobs. The anchor, the process that actually talks to the network, never runs as root in proxy mode. So if something in it ever went wrong, it would go wrong with an ordinary account's rights. (There's also a TUN mode, conflux up, for laptops where you want every program on the overlay. That one does create a real interface, with the rights that come with it. Servers that only publish services can skip it.)

SSH belongs to sshd

VeilNet doesn't ship an SSH server, and there isn't one hiding in the anchor. When you SSH to a machine over VeilNet, you reach that machine's own sshd. In TUN mode, you ssh to its overlay address, as you would on any network. In proxy mode, you publish port 22:

$ sudo conflux proxy 22=127.0.0.1:22

The sudo is only there to register conflux as a boot service, so the anchor comes back after a reboot, and to write its configuration under /etc. The anchor itself then runs without root.

After that, the anchor just carries bytes. Everything to do with SSH stays with OpenSSH, so whatever you've already set up for keys, certificates or MFA keeps working. OpenSSH has also had privilege separation for over twenty years. By the time a session asks to forward a socket, it's running as you, and the kernel checks your rights.

Fig. 03 — Who answers SSH
AN SSH SERVER INSIDE THE AGENTPEERMESH AGENTROOTSSH serverYOUR IDENTITY IS THE LOGINDIALS AS ROOTROOT ONLYdocker.sockTHE HOST'S OWN SSHDPEERANCHORKNOCKSIGN INsshdSESSIONaliceROOT ONLYdocker.sockTHE KERNEL CHECKS ALICE, NOT ROOTOPENEDPERMISSION DENIED

Same forward, same socket. What changes is whose rights the kernel checks.

Getting onto the network and getting a shell also stay separate. The overlay decides who can connect, and sshd still decides who can sign in. A compromised machine that's allowed to reach your server gets a login prompt, and that's all.

Tailscale SSH joins the two on purpose: your network identity is your login. That's lovely when you're juggling keys across twenty machines, and it's also why one grant was all Tailworm needed.

Silent until the right packet arrives

A VeilNet anchor doesn't answer anyone it doesn't know. The first packet a peer sends is a knock. It carries the peer's identity key, its credential chain and an ML-DSA signature that names the anchor it expects to answer and the address it's dialling. The whole knock is encrypted with a key only members of your tree can derive, and it records the hour it was made.

The anchor runs the cheapest checks first, and stops at the first one that fails. Is the knock from your tree? Is its clock within an hour of ours? Was it made for this anchor and this address? Is it a copy of a knock we've already seen from somewhere else? Are we being flooded (the limit is 64 knocks a second for each core)? And last, the expensive one: do the signature and the chain verify against your root?

Fig. 04 — Silent to strangers
SCANNERREPLAYED KNOCKMEMBERTHE ANCHOR'S PORTCHECKS, CHEAPEST FIRST1FROM YOUR TREE2CLOCK WITHIN AN HOUR3FOR THIS ANCHOR AND ADDRESS4NOT A REPLAY5UNDER THE FLOOD LIMIT6SIGNATURE AND CHAINNO REPLYNO REPLYTLS 1.3 · ML-KEM HANDSHAKE

A scanner fails the first check and a replayed knock the fourth. Neither gets anything back.

A knock that fails gets nothing back, not even a reset. Only after a knock passes does the anchor start the TLS 1.3 handshake over QUIC, with the hybrid post-quantum group SecP384r1MLKEM1024.

This is how we think about zero-days. Nobody knows where the next one will turn up, so rather than betting there isn't one, we make sure strangers can't talk to anything behind the knock. A scanner hears nothing and can't tell what's there, and an exploit for the next regreSSHion has nothing to land on. Put sshd behind the overlay and take port 22 off the internet (binding sshd to 127.0.0.1 does it in proxy mode), and only your own members can reach it.

Silent isn't quite the same as closed, though. The anchor's UDP port is open, so a scan reports it as open or filtered. If your firewall rejects unsolicited UDP, the anchor's port ends up as the one quiet port among the rejections, so set the firewall to drop instead. On a host that faces the internet, drop the local discovery port, UDP 4747, from outside as well. The admission docs have the details.

A compromised member stays in its compartment

A member that's been compromised is a different story. It's still a member, so it can reach whatever its compartment allows. Taints keep it inside that compartment, and because they're signed into its credential, it can't talk its way into another. sshd still wants it to sign in, and there's no root daemon on the far end offering to open sockets for it.

Moving from Tailscale to conflux

If you'd like to try the other approach, you don't have to move everything in one go. Proxy mode creates no interface and touches no routes, and the overlay has addresses of its own: an IPv6 address under fd00::/8 that comes from each machine's identity, and an IPv4 address you choose. Neither overlaps Tailscale's 100.64.0.0/10, so tailscaled can keep running beside conflux while you move one server at a time.

The free network VeilNet hosts is all you need for this, and there's no account to make. Here's roughly how the pieces line up:

On TailscaleWith conflux
An auth keyYour network's taint, passed with --taint
tailscaled and its TUN deviceconflux up on laptops, conflux proxy on servers
Tailscale SSHThe server's own sshd, published with 22=127.0.0.1:22
tailscale serveconflux proxy PORT=BACKEND
A subnet router--subnet 192.168.1.0/24
An exit node--serve-exit on one machine, --use-exit on the others
DERP relaysMembers of your network relay for each other
MagicDNSNot needed. Addresses don't change, so any DNS server works
Fig. 05 — Moving a server across01 / 04
LAPTOPSCANNERSERVERTAILSCALEDTailscale SSHTAILSCALE DOWNANCHOR · PROXY22=127.0.0.1:22THE HOST'S OWNsshdLISTENS ON 0.0.0.0:22BOTH RUN · NOTHING CLASHESlogin:NOTHING ON PORT 22

Install conflux next to tailscaled and run it in proxy mode. It creates no interface and no routes, so the two stay out of each other's way.

Connect over VeilNet. The anchor hands the connection to the server's own sshd, so you sign in with the keys you already have.

Once that works, take Tailscale down, uninstall it and delete the machine from Tailscale's admin console.

Bind sshd to 127.0.0.1. Now it answers only through the anchor, and a scanner on the internet finds nothing listening on port 22.

Tailscale keeps working for the servers you haven't moved yet.

1. Install conflux

Conflux is a single binary for Linux, macOS, Windows, FreeBSD and OpenBSD. Get the install command from the get-started page, and run it on your laptop and on the server you're moving. It starts nothing until you ask it to.

2. Start the network from your laptop

Your laptop runs conflux up, which gives it a network interface, so every program on it can use the overlay, ssh included. Here sudo does two jobs: it lets conflux create that interface, and it registers the boot service. The first run mints a taint for your new network, then asks for the laptop's IPv4 address:

your laptop
$ sudo conflux up

Minted a taint for this network:

    brhk-2mq9-tzva-6pjs-k4xe-nw7d-qf

…
  IPv4 [e.g. 10.128.0.7/24, blank for none]: 10.128.0.1/24

Starting.
…
  overlay      fd80:c4b9:99ae:4411:c531:fd4f:754f:f08a/48
  ipv4         10.128.0.1/24
  interface    anchor0
  taint        brhk-2mq9-tzva-6pjs-k4xe-nw7d-qf
…

Copy the taint. It's the only thing another machine needs to join, so treat it like an auth key and share it only with machines that should be on the network. For the IPv4 range, pick one nothing else on your network uses.

3. Bring a server across, next to tailscaled

On the server, run conflux in proxy mode with the taint, an IPv4 address of its own and a spec for each service you reach over Tailscale today. Port 22 goes to the server's own sshd:

the server
$ sudo conflux proxy --taint brhk-2mq9-tzva-6pjs-k4xe-nw7d-qf --ipv4 10.128.0.2/24     22=127.0.0.1:22 5432=127.0.0.1:5432

Here sudo is only for the boot service and its configuration. Proxy mode creates no interface, and the anchor runs as its own unprivileged account. The command publishes SSH and a Postgres database, and nothing else. Add a spec for each further service, or add --subnet 192.168.1.0/24 to reach the network behind the server, the way a subnet router does. Meanwhile, tailscaled carries on as before.

4. SSH in over VeilNet

Give the two machines a minute to find each other, then SSH from your laptop to the server's overlay address:

your laptop
$ ssh alice@10.128.0.2

It's the same sshd as always, so your keys just work. If it doesn't connect, sudo conflux peers on the server should list your laptop, with yes in the DATA column. (It needs sudo because conflux keeps its state where ordinary users can't read it.)

There's no MagicDNS, and you won't miss it. Overlay addresses don't change (the IPv6 one comes from the machine's identity, and you picked the IPv4 one), so any DNS server anywhere will do: your internal one, a record in a public zone, or a line in /etc/hosts.

5. Switch Tailscale off

Once SSH over VeilNet works, Tailscale has nothing left to do on that server. Take it down, uninstall it, and delete the machine in Tailscale's admin console too:

the server
$ sudo tailscale down
$ sudo apt remove tailscale    # or your platform's equivalent

Last, take port 22 off the internet. The anchor reaches sshd on 127.0.0.1, so sshd doesn't need to listen anywhere else:

/etc/ssh/sshd_config
ListenAddress 127.0.0.1

Restart sshd (the service is ssh on Debian and Ubuntu, and sshd on most others), and keep your current session open until a new one connects over VeilNet. After that, nothing on the internet can reach sshd, and the only way in is through the knock.

Repeat steps 3 to 5 for each server. When you'd rather hold the root yourself, with your own console, revocation and compartments you assign, that's what the guardian is for.

Further reading

The docs go deeper on everything above: TUN and proxy modes, how the knock works, publishing services and taints. For the findings themselves, read the Tailworm report and Tailscale's investigation page. If you have questions about any of it, write to sovereign@veilnet.net.