CVE-2021-32706
📋 TL;DR
CVE-2021-32706 is a code injection vulnerability in Pi-hole's web interface that allows attackers to execute arbitrary code, list directories, and overwrite sensitive files. The vulnerability exists in the domain validation filter where an unescaped period allows malicious character injection. All Pi-hole instances with web interface versions before 5.5.1 are affected.
💻 Affected Systems
- Pi-hole AdminLTE Web Interface
📦 What is this software?
Pi Hole by Pi Hole
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise with root-level code execution, allowing complete control over the Pi-hole server and potentially the entire network it manages.
Likely Case
Remote code execution leading to DNS manipulation, data exfiltration, or installation of persistent backdoors on the Pi-hole server.
If Mitigated
Limited impact if web interface is not exposed to untrusted networks and proper network segmentation is in place.
🎯 Exploit Status
Exploitation requires access to the web interface but no authentication. Public proof-of-concept code exists in security advisories.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 5.5.1
Vendor Advisory: https://github.com/pi-hole/AdminLTE/security/advisories/GHSA-5cm9-6p3m-v259
Restart Required: No
Instructions:
1. Update Pi-hole using: pihole -up
2. Alternatively, manually update AdminLTE: cd /etc/.pihole && git pull origin master
3. Clear browser cache to ensure new interface loads
🔧 Temporary Workarounds
Disable Web Interface
linuxTemporarily disable the Pi-hole web interface to prevent exploitation
sudo systemctl disable lighttpd
sudo systemctl stop lighttpd
Restrict Network Access
linuxConfigure firewall to only allow trusted IPs to access the web interface
sudo ufw allow from 192.168.1.0/24 to any port 80
sudo ufw allow from 192.168.1.0/24 to any port 443
🧯 If You Can't Patch
- Implement strict network segmentation to isolate Pi-hole from untrusted networks
- Deploy a web application firewall (WAF) with input validation rules to block exploitation attempts
🔍 How to Verify
Check if Vulnerable:
Check AdminLTE version: cat /etc/pihole/versions | grep AdminLTE
Check Version:
cat /etc/pihole/versions | grep AdminLTE
Verify Fix Applied:
Verify version is 5.5.1 or higher: cat /etc/pihole/versions | grep AdminLTE | grep -E '5\.5\.1|5\.([6-9]|[1-9][0-9]+)|[6-9]|([1-9][0-9]+)'
📡 Detection & Monitoring
Log Indicators:
- Unusual POST requests to /admin/scripts/pi-hole/php/* endpoints
- Suspicious characters in domain validation requests
- Lighttpd access logs showing exploitation patterns
Network Indicators:
- Unusual outbound connections from Pi-hole server
- DNS query patterns indicating compromise
SIEM Query:
source="lighttpd" AND (uri_path="/admin/scripts/pi-hole/php/*" AND request_method="POST" AND (query_string="*[malicious_pattern]*" OR post_data="*[malicious_pattern]*"))