mirror of
https://github.com/pi-hole/pi-hole.git
synced 2026-11-23 16:48:52 +00:00
updatecheck.sh writes the versions file into /etc/pihole, which is owned by the unprivileged pihole user. When it ran as root (the installer, `pihole -up`, `pihole checkout`, `sudo pihole updatechecker`, the Docker start-up check, ...) the pihole user could watch the directory, swap the script's temporary file for a symlink and have root chmod/chown/append to whatever it pointed at. Reproduced: a root-only file ended up owned by pihole. - When started as root, hand over to the pihole user (`su`) and exit with its result. This covers every caller, including future ones, and the pihole user can only damage what it already owns. The "reboot" argument is forwarded. - Drop the chown of the temporary file; it is no longer needed and was the dangerous part. - Use `mv -fT` so that a symlink to a directory at the target path is replaced rather than having the temporary file moved into the directory. Tests (fresh install): started as root the script must do its work as the pihole user and write a pihole-owned 0644 versions file; a symlink (to a file or to a directory) at the target path must be replaced rather than followed. Note: running as the pihole user needs git to trust the root-owned Core and Web repositories (safe.directory). The installer sets that up (see the following commit); other installers of this script, such as the Docker image, need the equivalent. Reported-by: Keith Linneman (LinnemanLabs) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Adam Warner <me@adamwarner.co.uk> |
||
|---|---|---|
| .. | ||
| database_migration | ||
| api.sh | ||
| COL_TABLE | ||
| list.sh | ||
| piholeCheckout.sh | ||
| piholeDebug.sh | ||
| piholeLogFlush.sh | ||
| piholeNetworkFlush.sh | ||
| query.sh | ||
| update.sh | ||
| updatecheck.sh | ||
| utils.sh | ||
| version.sh | ||