Skip to content

[V5] Command Injection Vulnerability in Pi-hole Web Interface

Critical
PromoFaux published GHSA-828h-5x96-rqx7 Mar 24, 2026

Package

No package listed

Affected versions

<= v5.21

Patched versions

v6.0

Description

Recently, our team found a Command Injection vulnerability in Pi-hole Web Interface (up to v5.21). The vulnerability logic is present in the file:

https://github.com/pi-hole/web/blob/v5.21/scripts/pi-hole/php/savesettings.php#L428
image

A critical OS Command Injection vulnerability exists in the savesettings.php file. The application takes the user-controlled $_POST['webtheme'] parameter and concatenates it directly into a system command executed via PHP's exec() function. Since the input is neither sanitized nor validated before being passed to the shell, an attacker can append arbitrary system commands to the intended pihole command. Furthermore, because the command is executed with sudo privileges, the injected commands will run with elevated (likely root) privileges.

PoC: webtheme=default; id > /tmp/hacked.txt

Severity

Critical

CVE ID

CVE-2026-33765

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

Credits