gravity.sh splices files.gravity unescaped into SQL
Key facts
- Attack vector
- Network
- Privileges required
- High
- User interaction
- None
- Attack complexity
- Low
- Impact type
- SQL injection
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-cq9w-mv93-mxh7. Fix status from GitHub. Impact type from CWE-89.
Summary
Pi-hole Core up to and including 6.5 contains an SQL injection flaw (CWE-89) in gravity.sh. The script inserts the gravity database path into gravity_copy.sql without escaping single quotes, so a quote ends the SQL string and appends attacker-chosen statements. An admin who sets the path through the API can run these statements as the pihole user, because Pi-hole FTL v6.8 accepts quotes in file paths.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
Core counterpart of FTL GHSA-pj9m-9623-2g75. `gravity.sh` replaces the default gravity database path in `gravity_copy.sql` with `files.gravity` as is. A single quote in the value closes the `ATTACH DATABASE` literal and appends arbitrary statements, which `pihole-FTL sqlite3` runs as the `pihole` user, including `edit()` and thereby `system()`. FTL v6.8 accepts a quote in file paths, so an admin can set such a value through the API. The fix doubles single quotes before the substitution; FTL rejects quotes and shell/SQL metacharacters in paths again. One CVE covers this vulnerability in both Pi-hole FTL and Pi-hole Core. It is requested on FTL GHSA-pj9m-9623-2g75, which lists both packages; this advisory gets no CVE of its own.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | pi-hole | <= 6.5 | 6.6 | Patch available | GHSA-cq9w-mv93-mxh7 |
- pi-hole Vendor— Affected <= 6.5 Fixed in 6.6 Patch available GHSA-cq9w-mv93-mxh7
Remediation
Update Pi-hole Core to version 6.6, which doubles single quotes before inserting the path. The sources list no advisory identifier for this fix.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-cq9w-mv93-mxh7 pi-hole Fixed in 6.6 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-cq9w-mv93-mxh7
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences