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

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
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

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