Summary
Pi-hole FTL supports a CLI password feature (webserver.api.cli_pw) that creates “CLI” API sessions intended to be read-only for configuration changes. While /api/config correctly blocks
CLI sessions from mutating configuration, /api/teleporter allowed Teleporter imports for CLI sessions, enabling a CLI-scoped session to overwrite configuration via a Teleporter archive
(authorization bypass).
Details
- CLI sessions are flagged via
session->cli (set when authenticating with the CLI password).
/api/config blocks CLI sessions by returning HTTP 403 when api->session->cli is true.
/api/teleporter did not perform the same check before processing an uploaded Teleporter archive (e.g., ZIP imports can overwrite etc/pihole/pihole.toml; legacy Teleporter TAR.GZ
imports can restore additional config files).
- Expected behavior: Teleporter import should be restricted to fully privileged sessions, not CLI sessions.
PoC (local lab)
Prereqs: API password set; CLI password feature enabled (webserver.api.cli_pw=true / FTLCONF_webserver_api_cli_pw=true).
- Obtain the CLI password (in a lab it is stored at
/etc/pihole/cli_pw) and authenticate to get a sid:
POST /api/auth with the CLI password
- Confirm CLI sessions are blocked from config changes (expected behavior):
- Try any config-changing request to
/api/config and observe HTTP 403 forbidden
- Demonstrate the bypass via Teleporter import:
- Download a Teleporter archive:
GET /api/teleporter
- Import it back using the same CLI session:
POST /api/teleporter with the archive as multipart form field file
- Observe the import succeeds (and triggers a restart) despite being a CLI session
Impact
An attacker who obtains CLI-scoped API credentials can modify Pi-hole configuration through the Teleporter import endpoint, bypassing intended authorization restrictions for CLI sessions.
This can be used to change settings (e.g., disable blocking, alter upstream DNS, change DHCP settings), impacting integrity/availability.
Suggested fix
Add the same CLI-session restriction used by /api/config to /api/teleporter (reject when api->session->cli is true).
Summary
Pi-hole FTL supports a CLI password feature (
webserver.api.cli_pw) that creates “CLI” API sessions intended to be read-only for configuration changes. While/api/configcorrectly blocksCLI sessions from mutating configuration,
/api/teleporterallowed Teleporter imports for CLI sessions, enabling a CLI-scoped session to overwrite configuration via a Teleporter archive(authorization bypass).
Details
session->cli(set when authenticating with the CLI password)./api/configblocks CLI sessions by returning HTTP 403 whenapi->session->cliis true./api/teleporterdid not perform the same check before processing an uploaded Teleporter archive (e.g., ZIP imports can overwriteetc/pihole/pihole.toml; legacy Teleporter TAR.GZimports can restore additional config files).
PoC (local lab)
Prereqs: API password set; CLI password feature enabled (
webserver.api.cli_pw=true/FTLCONF_webserver_api_cli_pw=true)./etc/pihole/cli_pw) and authenticate to get asid:POST /api/authwith the CLI password/api/configand observe HTTP 403forbiddenGET /api/teleporterPOST /api/teleporterwith the archive as multipart form fieldfileImpact
An attacker who obtains CLI-scoped API credentials can modify Pi-hole configuration through the Teleporter import endpoint, bypassing intended authorization restrictions for CLI sessions.
This can be used to change settings (e.g., disable blocking, alter upstream DNS, change DHCP settings), impacting integrity/availability.
Suggested fix
Add the same CLI-session restriction used by
/api/configto/api/teleporter(reject whenapi->session->cliis true).