Skip to content
arbitrary root file clobber / chmod / disclosure via updatecheck.sh cron following /etc/pihole/versions symlink

arbitrary root file clobber / chmod / disclosure via updatecheck.sh cron following /etc/pihole/versions symlink

github.com • October 20, 2026

The pihole updatechecker cron job runs as root and rewrites /etc/pihole/versions with truncate -s 0 and chmod 644 on a fixed path, following symlinks. The pihole user owns the /etc/pihole directory, so it can replace versions with a symlink to any root-owned file before the cron runs, and root's operations then act on the symlink target instead.

This lets the unprivileged pihole user truncate, permission-change, or create arbitrary-named (not arbitrary content) root-owned files anywhere on the system.

This was introduced recently: the version file used to be removed and recreated and was changed to truncate / chmod (which follow symlinks) in v6.4.2.

advanced/Scripts/updatecheck.sh runs as root from the daily/ @reboot cron and does:

None of these use O_NOFOLLOW / --no-dereference . Because pihole owns the (non-sticky, 0755 ) /etc/pihole directory, it can rm the versions file and replace it with a symlink. unlink/create is governed by directory ownership, not the file's owner. fs.protected_symlinks does not help here: it only restricts following symlinks inside world-writable sticky directories (like /tmp ), and /etc/pihole is neither.

Set up a root-owned canary to stand in for a sensitive file (e.g. /etc/shadow ):

As the pihole user (owns /etc/pihole , no root/capability needed), replace versions with a symlink to it:

The daily root cron then follows the symlink. To demonstrate immediately instead of waiting:

Root's truncate + chmod followed the pihole -planted symlink onto the canary - proving arbitrary root-owned files can be truncated, mode-changed, or created (pointing the symlink at a non-existent path makes truncate create it root-owned).

To achieve arbitrary file permission-change you have to race updatecheck.sh operations. But they are shellscript fork+exec and it's trivial. The steps:

Wait for updatechecker to read the current /etc/pihole/versions file

Replace /etc/pihole/versions with a symlink to /etc/shadow

Wait for updatechecker to chmod 644 the version file (symlink to /etc/shadow)

Replace the symlink with a real file so updatechecker appends its key=value data to /etc/pihole/versions like normal

I have created a python script that will race the symlink swap and result in a chmod 644 /etc/shadow-canary in 100% of my tests.

Setup the /etc/shadow-canary file:

Then either wait for the daily cron or fire immediately in another shell:

Chmod successful without truncating the file or appending lines meant for /etc/pihole/versions.

An unprivileged pihole user can, via the daily root cron:

Truncate any root-owned file: integrity/DoS (e.g. /etc/shadow , /etc/passwd , sudoers, cron files).

Create arbitrary root-owned files ( truncate creates a missing symlink target).

Weaken permissions: makes a root file world-readable. By racing the symlink so truncate lands on a decoy but chmod lands on the real target, the target is exposed without being truncated. This allows reading /etc/shadow -> offline crack -> root, or read ssh private keys, etc. This part is a race, but the truncate/create above are not. Easy race to win though due to it being a shellscript that fork+exec's multiple times.

It runs from any code execution as the pihole user (a compromised pihole account, or the separately-reported config->exec bugs) - no capability required. This is independent of the CAP_CHOWN issue.

Affected: Core v6.4.2 (introduced by ac370146 ).

Please let me know if you have any questions or I can do anything to help.

Should this lead to a CVE/advisory I would appreciate credit as Keith Linneman (LinnemanLabs).

Extracted Entities