Featured image of post Talos: a read-only certificate that reboots your server

Talos: a read-only certificate that reboots your server

Ecrit par ~ zwindler ~

TL;DR

  • On Talos Linux <= 1.14.2, the TimeService/TimeCheck API validated PTP device paths with a simple strings.HasPrefix(server, "/dev/"). A .. was therefore enough to make machined open any file, as root. You can’t exfiltrate the file, only get it opened.
  • This API was available to the os:reader role, the read-only role you hand out to monitoring tools.
  • Opening /dev/watchdog arms the hardware timer. Closing the file without the magic V byte leaves it armed. If nobody feeds it: hard reset of the server. A read-only account can therefore reboot a physical server.
  • Published on October 19, 2026 as GHSA-vpfm-35qx-jhvw (Moderate, 5.9), fixed in 1.13.11 and 1.14.3. And it’s my first advisory where I’m the only credited finder.

Context

In my previous article, I explained how I’ve been hunting vulnerabilities in open source software with LLMs since this summer. Since then, some of these findings have gone public: two Argo CD CVEs co-credited with 7 other reporters each, and one KEDA CVE, also co-credited. There are others pending, but it doesn’t taste the same when you’re not the “first”.

This one is my first solo GHSA: a single name in the credits, mine (even if it was actually Devin/SWE that made the initial discovery, see the previous article). Beyond the personal pride, it’s also a really fun one to tell. Martial will give me the side-eye because it’s “yet another” DoS (he nicknamed me DoSnis), but I happen to like DoS.

It came out of a full audit of Talos (the immutable Linux distribution dedicated to Kubernetes), during a pass where I was looking for something specific: which API methods are reachable by the weakest roles, and what do they really do?

Talos and its roles in two minutes

Talos has no SSH, no shell, no package manager. All administration goes through a gRPC API (apid, port 50000), authenticated with client certificates. The role is embedded in the certificate (O: field). From most to least powerful:

  • os:admin: everything, including reboot, wipe, machine config
  • os:operator: day-to-day operations (upgrade, reboot…)
  • os:reader: read-only. Node state, logs, metrics, configuration. It’s the role you give to dashboards, probes and observability tools, thinking “worst case, they look”.

Except that TimeService/TimeCheck, the API that asks the node to check its time sync against a given source, was open to all three roles, reader included (internal/app/machined/pkg/system/services/machined.go:160).

On paper, it makes sense: querying a time source is a read. The catch is that this “time source” can be either an NTP server or a PTP device path (Precision Time Protocol, the /dev/ptp* hardware clocks).

The bug: a HasPrefix that protects nothing

Here is the entire check:

// internal/pkg/ntp/ntp.go
func IsPTPDevice(server string) bool {
    return strings.HasPrefix(server, "/dev/")
}

Yes, that’s all. No filepath.Clean, no rejection of .., no restriction to /dev/ptp*. The handler (v1alpha1_time.go) then passes the string as is to QueryPTPDevice, which does:

fd, err := os.Open(device)  // machined runs as root

So /dev/../dev/watchdog, /dev/../etc/shadow or /dev/../dev/sda all pass the filter and get opened as root by machined.

First question that comes to mind: “OK, so what does it read?”. Well… nothing. The file descriptor goes into PTP ioctls, which fail on anything that isn’t a PTP clock, and the content is never sent back to the client. We do not get arbitrary file read.

The problem is elsewhere: open() is not a harmless operation.

open() is not a read: the watchdog case

A watchdog is a hardware timer present on most servers: it restarts the machine if the OS stops showing signs of life, typically when the kernel freezes.

On Linux, opening /dev/watchdog arms the hardware watchdog. That’s the driver contract: the open starts the countdown, and if nobody writes to it regularly (“feeding” the watchdog), the hardware resets the machine. No application log, no clean shutdown, and the OS has no say in it: the hardware pulls the plug.

There is a way out: writing the magic character V to the file before closing it (the “magic close”), which disarms the timer. Here, Talos does open(), the PTP ioctls fail, then close()… without V. The timer keeps running, nobody feeds it. Reboot.

Note: this only works if Talos has not already opened the watchdog itself (no WatchdogTimerConfig in the machine config, so the vast majority of cases). In other words, the nodes that don’t use the watchdog are precisely the vulnerable ones: the attack arms it, and nobody is there to feed it (poor doggy 🐶).

Repro on my lab

I verified everything end to end on September 29, 2026, on my Talos lab nodes, with a talosconfig whose client certificate is strictly O: os:reader.

First, let’s check that this role can’t reboot the normal way:

talosctl -n <node-vm> reboot
# rpc error: code = PermissionDenied desc = not authorized

Then, a harmless test to prove that the traversal goes through:

talosctl -n <node-vm> time --check "/dev/../proc/version"
# rpc error ... error querying PTP device "/dev/../proc/version": invalid argument
# open() succeeded (the file exists), the PTP ioctl is what fails

talosctl -n <node-vm> time --check "/dev/../nonexistent"
# rpc error ... "/dev/../nonexistent": no such file or directory
# open() failed: the file doesn't exist

Two different error messages make an oracle: you can tell whether any path exists on the node, including outside /dev. And the .. showing up as is in the error also confirms there’s no filepath.Clean.

Now, on a bare-metal server with an actual hardware watchdog:

talosctl -n <node-bm> time --check "/dev/../dev/watchdog"
# rpc error ... invalid argument   (open() as root OK, PTP ioctl fails)

And in the kernel console, at the same moment:

kern: crit: watchdog: watchdog0: watchdog did not stop!

That’s exactly the message you get when the fd is closed without the V: the watchdog stays armed, and the node hard resets at the timeout. A certificate that was supposed to only read things just physically rebooted a server.

Other impacts

To be honest, it remains limited: no content read, no write. What you actually get:

  • Forced reboot through the watchdog, which you can trigger again every time the node comes back up.
  • File existence oracle on the node (the two error messages). But really, there’s almost nothing on a Talos Linux node (that’s the whole beauty of it).
  • Stuck goroutines: some devices and FIFOs block in open(2), so each call can freeze a machined handler.
  • More exotic side effects of open() on some drivers (tape rewind, terminal state…), but that’s purely theoretical.

The maintainer scored it higher than I did

A small anecdote about how subjective CVSS is.

I had estimated the vulnerability at 5.4 (AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:L): A:L for the reboot, and AC:L because once you hold the os:reader certificate, the attack is deterministic.

The maintainer (smira, from Sidero Labs) published 5.9 (AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:H): A:H because a hard reset of a physical server is more than a mere degradation, and AC:H because it requires a hardware watchdog that is present and not managed by Talos.

And honestly, both choices are defensible. CVSS 3.1 leaves a lot of room for interpretation, especially on AC (conditions beyond the attacker’s control) and on how to count impact when the attacker already has part of the rights. A CVSS score is an argued opinion, not a measurement. And when a maintainer takes the time to justify their vector in the advisory, I’m not going to complain.

The fix: three layers, defense in depth

The fix (merged in main, backported to 1.13.11 and 1.14.3) takes the three ideas I had suggested in the report, and does them better:

  1. Device check: before any open(), the path must point to an actual PTP clock and the kernel must confirm that the device does belong to the PTP subsystem. Opening anything else therefore has no side effect anymore. Error messages have also become generic, which removes the oracle.
  2. Machine config validation: PTP paths must be clean paths, directly under /dev, with a name starting with ptp (/dev/ptp0, /dev/ptp_kvm, /dev/ptp_hyperv). If you have exotic configs, watch out: they may be rejected after the upgrade.
  3. RBAC: TimeService/TimeCheck is now restricted to os:admin and os:operator. TimeService/Time (reading the configured time, without --check) remains available to os:reader.

Affected versions: from 1.10.0 (first release where TimeCheck accepts PTP paths), up to 1.13.11 / 1.14.3 excluded.

If you can’t upgrade right away:

  • don’t hand out os:reader certificates to clients you don’t fully trust;
  • filter network access to the apid port (50000);
  • on nodes with a hardware watchdog, declare a WatchdogTimerConfig so that Talos keeps the device open itself.

Takeaways

  • open() is not a read. A call that “returns nothing” can still arm hardware, block a goroutine or act as an oracle. When auditing a “read-only” API, the question isn’t “what does it return?” but “what does it do?”.
  • A HasPrefix is not path validation. Without filepath.Clean, without rejecting .. and without an allowlist, it’s purely decorative. If you want to look for the same pattern elsewhere, grep for HasPrefix(x, "/dev/"), HasPrefix(x, "/proc/") or HasPrefix(x, "/sys/"). I’ve found it in many other OSS projects.
  • “Does this give the attacker something they don’t already have?” That’s the question I systematically ask during the counter-review (see the previous article), and here the answer is clear-cut: the reader role can’t reboot (PermissionDenied), but it can arm the watchdog, which does reboot. Hard for a maintainer to reply “working as intended”.
  • “Read-only” roles are worth a look. Everybody audits admin paths. Observability APIs get less scrutiny, are distributed much more widely, and nobody looks at their side effects. In the same audit, this “reader + side effect” pattern actually gave me other leads.
  • Sidero Labs was exemplary. Report accepted in less than an hour, three-layer fix merged less than 3 hours after my report (with hardening I hadn’t suggested), CVE requested, and a transparent advisory published less than three weeks later. If every project handled reports like this, a hunter’s life would be much simpler.

It all started with a subagent doing exactly what it had been asked to do: read the code file by file and write down everything that looked “even vaguely weird”. The rest (repro, write-up, submission) follows the pipeline described in the previous article. It feels good to finally be able to tell a concrete case from start to finish!

Licensed under CC BY-SA 4.0

Vous aimez ce blog ou cet article ? Partagez-le avec vos amis !   Twitter Linkedin email Facebook

Vous pouvez également vous abonner à la mailing list des articles ici

L'intégralité du contenu appartenant à Denis Germain (alias zwindler) présent sur ce blog, incluant les textes, le code, les images, les schémas et les supports de talks de conf, sont distribués sous la licence CC BY-SA 4.0.

Les autres contenus (thème du blog, police de caractères, logos d'entreprises, articles invités...) restent soumis à leur propre licence ou à défaut, au droit d'auteur. Plus d'informations dans les Mentions Légales

Built with Hugo
Theme Stack designed by Jimmy