Summary
Insufficient input sanitization leads to reflected XSS on the 404 error page in version 6.2.1.
Details
If a path does not exist on the pi-hole web server, a 404 error page is shown and the path is included in the class attribute of the body tag. Because the path is not properly sanitized or escaped, an onload attribute can be added to the body tag which will trigger javascript code execution in the browser.
PoC
Visit the following URL, where 192.168.1.1 is the pi-hole IP:
https://192.168.1.1/%22onload=alert(1);%3E
Impact
If an attacker sends a crafted pi-hole link to a victim and the victim visits it, attacker controlled javascript code is executed in the browser of the victim.
Countermeasure
Properly sanitize the path of the URL, or in the best case, do not reflect the path on the website at all.
Best Regards
Vincent Heinen
AWARE7
Summary
Insufficient input sanitization leads to reflected XSS on the 404 error page in version 6.2.1.
Details
If a path does not exist on the pi-hole web server, a 404 error page is shown and the path is included in the
classattribute of thebodytag. Because the path is not properly sanitized or escaped, anonloadattribute can be added to thebodytag which will trigger javascript code execution in the browser.PoC
Visit the following URL, where
192.168.1.1is the pi-hole IP:https://192.168.1.1/%22onload=alert(1);%3EImpact
If an attacker sends a crafted pi-hole link to a victim and the victim visits it, attacker controlled javascript code is executed in the browser of the victim.
Countermeasure
Properly sanitize the path of the URL, or in the best case, do not reflect the path on the website at all.
Best Regards
Vincent Heinen
AWARE7