CVE-2020-12620

7.8 HIGH

📋 TL;DR

CVE-2020-12620 is a command injection vulnerability in Pi-hole 4.4 that allows authenticated users with write access to /etc/pihole/dns-servers.conf to execute arbitrary commands with elevated privileges. This affects Pi-hole administrators and users with local access to the Pi-hole system. The vulnerability stems from improper neutralization of shell metacharacters in DNS server configuration.

💻 Affected Systems

Products:
  • Pi-hole
Versions: Version 4.4
Operating Systems: Linux
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems where users have write access to /etc/pihole/dns-servers.conf, which typically requires administrative privileges.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with root privileges, allowing attacker to install malware, exfiltrate data, pivot to other systems, or disrupt DNS services.

🟠

Likely Case

Local privilege escalation leading to unauthorized configuration changes, DNS manipulation, or installation of backdoors on the Pi-hole system.

🟢

If Mitigated

Limited impact if proper file permissions restrict write access to /etc/pihole/dns-servers.conf to only trusted administrators.

🌐 Internet-Facing: LOW - This requires local access or authenticated access to the Pi-hole web interface.
🏢 Internal Only: HIGH - Any user with local access or compromised web interface credentials can exploit this vulnerability.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires authenticated access to modify DNS server configuration. Public proof-of-concept demonstrates command injection via DNS server IP field.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Pi-hole 4.4.1 and later

Vendor Advisory: https://github.com/pi-hole/pi-hole/releases/tag/v4.4.1

Restart Required: No

Instructions:

1. Update Pi-hole using: pihole -up
2. Verify update with: pihole -v
3. The update patches the command injection vulnerability in DNS server configuration handling.

🔧 Temporary Workarounds

Restrict file permissions

linux

Change permissions on /etc/pihole/dns-servers.conf to prevent unauthorized writes

sudo chmod 644 /etc/pihole/dns-servers.conf
sudo chown root:root /etc/pihole/dns-servers.conf

Disable DNS server configuration changes

linux

Remove write access to DNS configuration for non-admin users

sudo chmod 600 /etc/pihole/dns-servers.conf

🧯 If You Can't Patch

  • Implement strict access controls to limit who can modify /etc/pihole/dns-servers.conf
  • Monitor for suspicious modifications to DNS server configuration files

🔍 How to Verify

Check if Vulnerable:

Check Pi-hole version: pihole -v | grep 'Pi-hole version' - if it shows 4.4, the system is vulnerable.

Check Version:

pihole -v | grep 'Pi-hole version'

Verify Fix Applied:

Verify Pi-hole version is 4.4.1 or later: pihole -v | grep 'Pi-hole version'

📡 Detection & Monitoring

Log Indicators:

  • Unusual commands in Pi-hole logs
  • Unexpected modifications to /etc/pihole/dns-servers.conf
  • Suspicious DNS configuration changes

Network Indicators:

  • Unexpected outbound connections from Pi-hole system
  • DNS queries to unusual domains

SIEM Query:

source="pihole" AND (event="config_change" OR file_path="/etc/pihole/dns-servers.conf")

🔗 References

📤 Share & Export