Pi-Hole versions 3.0 - 5.3 allows for command line input to the removecustomcname, removecustomdns, and removestaticdhcp functions without properly validating the parameters before passing to sed. When executed as the www-data user, this allows for a privilege escalation to root since www-data is in the sudoers.d/pihole file with no password.
Linux,Unix
cmd
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/linux/local/pihole_remove_commands_lpe
msf exploit(pihole_remove_commands_lpe) > show targets
...targets...
msf exploit(pihole_remove_commands_lpe) > set TARGET < target-id >
msf exploit(pihole_remove_commands_lpe) > show options
...show and set options...
msf exploit(pihole_remove_commands_lpe) > exploit
Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.
– Jim O’Gorman | President, Offensive Security