Skip to content
RCE Write-up Intermediate

What is Pi-hole?

The Pi-hole web interface did not properly validate MAC address input before using it in a shell command, allowing an authenticated user to execute arbitrary commands on the server. An attacker could exploit this to run commands with the privileges of the web service user.

natedotred.wordpress.com

Published on natedotred.wordpress.com

Pi-hole is affected by a Remote Code Execution vulnerability. An authenticated user of the Web portal can execute arbitrary command with the underlying server with the privileges of the local user executing the service.

The author, on natedotred.wordpress.com

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

The application used a weak regular expression to validate the MAC address, which allowed shell metacharacters to pass, and then passed the unescaped input to a shell command via exec().

Impact

An authenticated user could execute arbitrary commands on the server with the privileges of the web service user, potentially leading to full compromise.

What the attacker needed

Authenticated access to the web interface

The fix

The vulnerability was fixed in Pi-hole Web interface version 4.3.3 by improving input validation.

How it was found

  1. Log in to the Pi-hole web interface.
  2. Navigate to the DHCP settings page.
  3. Enter a crafted MAC address containing shell metacharacters and a payload.
  4. Submit the form to add the static lease.
  5. The payload executes on the server, giving 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 tool that blocks ads on your network. Its web interface lets you add static DHCP leases, which map a device's MAC address to an IP address. The web interface took the MAC address you typed and passed it directly to a system command without checking it properly. This meant someone logged in could type special characters that tricked the system into running their own commands.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.