Pi-hole 4.4.0 Remote Code Execution
An authenticated user could inject shell commands into the Pi-hole blocklist URL field, which were then executed when the gravity update script ran. This allowed the attacker to create a PHP backdoor and achieve remote code execution, potentially with root privileges.
packetstormsecurity.com
Published on packetstormsecurity.com
Change Mirror Download
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the blocklist URL input was passed to a shell command without proper sanitisation, allowing command injection.
Impact
An authenticated attacker could execute arbitrary commands on the Pi-hole server, potentially gaining root access and compromising the entire system.
What the attacker needed
Valid Pi-hole admin credentials; network access to the Pi-hole web interface; ability to host a listener on port 80
The fix
The vulnerability was fixed in later versions; users should upgrade to Pi-hole 4.4.0 or later.
How it was found
- Log in to the Pi-hole admin panel with valid credentials.
- Add a new blocklist with a URL that includes shell metacharacters and a command to write a PHP file.
- Trigger the gravity update by requesting the gravity.sh.php script.
- The injected command executes, creating a PHP backdoor file on the server.
- Access the backdoor PHP file to run arbitrary commands or get a reverse shell.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Pi-hole is a network-wide ad blocker with a web admin panel. A logged-in admin could add a malicious blocklist URL containing extra shell commands. When Pi-hole updated its blocklists, those commands ran on the server, letting the attacker take control.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.