Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-35517 — Detection scripts for Pi-hole FTLDNS RCE (CVE-2026-35517) via newline injection, including Python scanner and Nmap NSE script for version-based vulnerability assessment. | Kitploit
Tools/GitHubGitHub/keraattin/cve-2026-35517
Vulnerability ScannersExploitationInformation GatheringWeb SecurityNetwork SecurityPenetration Testing
GitHubkeraattin/cve-2026-35517

CVE-2026-35517

Detection scripts for Pi-hole FTLDNS RCE (CVE-2026-35517) via newline injection, including Python scanner and Nmap NSE script for version-based vulnerability assessment.

View Repository
4 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-35517 - Pi-hole FTLDNS Remote Code Execution via Newline Injection

CVE-2026-35517 CVSS 8.8 CWE-93 FTLDNS 6.0-6.5

TL;DR

A Remote Code Execution vulnerability in Pi-hole's FTLDNS engine (versions 6.0 through 6.5) allows an authenticated attacker to inject arbitrary dnsmasq configuration directives by embedding newline characters (\n) into the dns.upstreams API parameter. Since dnsmasq supports directives that execute shell commands, this newline injection directly translates to full command execution on the host system.

This isn't just a single bug, it's a class of injection that affects five different configuration parameters, all patched together in FTL v6.6.


Table of Contents

  • Quick Facts
  • What is Pi-hole FTLDNS?
  • Vulnerability Deep Dive
    • Understanding the Architecture
    • The Injection Point
    • From Newline to Shell — The Kill Chain
    • The Full Family — Five Injection Vectors
  • Impact Analysis
  • Affected Versions
  • Who is at Risk?
  • Detection
    • Python Scanner
    • Nmap NSE Script
    • Manual Version Check
  • Indicators of Compromise
  • Remediation
  • References
  • Author

Quick Facts

FieldDetail
CVE IDCVE-2026-35517
VendorPi-hole Project
ProductFTLDNS (pihole-FTL)
Affected Versions6.0 to < 6.6
CVSS v3.18.8 (High)
CWECWE-93 — Improper Neutralization of CRLF Sequences
Attack VectorNetwork
AuthenticationRequired (Pi-hole admin/API access)
User InteractionNone
PublishedApril 7, 2026
Patched InFTL v6.6 (released April 3, 2026)
Discovered ByT0X1Cx
Related AdvisoriesGHSA-23w8-7333-p9fj, GHSA-wxhv-w77q-6qwp, GHSA-28g5-gg88-wh5m, GHSA-fqv2-qhfh-ghcj, GHSA-vfmq-jrx3-wv3c

What is Pi-hole FTLDNS?

Pi-hole is one of the most widely deployed DNS sinkholes in the world. It sits on your network, handles DNS queries, and blocks ads and trackers at the DNS level before they ever reach your browser. It's used everywhere from single Raspberry Pi setups in apartments to enterprise deployments protecting thousands of devices.

FTLDNS (Faster Than Light DNS) is Pi-hole's core engine. It's a custom fork/wrapper around dnsmasq, the well-known DNS and DHCP server. FTLDNS handles:

  • DNS query resolution and caching
  • DNS-level blocking (the core Pi-hole function)
  • DHCP server functionality
  • Query logging and statistics
  • The API that the web interface talks to

Here's the key detail: FTLDNS generates dnsmasq configuration files from user-supplied settings through its API. If you change the upstream DNS server in the Pi-hole admin panel, FTLDNS writes that value into a dnsmasq configuration file and restarts the service. That write path is where the vulnerability lives.


Vulnerability Deep Dive

Understanding the Architecture

root@kitploit:~
+------------------+            +------------------+               +------------------+
|   Admin Panel    |  API/Web   |  FTLDNS Engine   | Config Write  |    dnsmasq       |
|    (Web UI)      | ---------> |  (pihole-FTL)    | ------------> |   (DNS/DHCP)     |
+------------------+            +------------------+               +------------------+
                                        |                                   |
                                  Reads settings,                     Reads config,
                                  writes to config                    serves DNS/DHCP
                                  files on disk                       to network

When an admin changes the upstream DNS servers through the Pi-hole web UI or API, the flow is:

  1. The web UI sends a request to the FTLDNS API with the new upstream DNS value
  2. FTLDNS validates the input (or rather, fails to validate it properly)
  3. FTLDNS writes the value into a dnsmasq configuration directive
  4. dnsmasq is restarted and reads the new configuration

The Injection Point

The dns.upstreams parameter is intended to accept DNS server addresses like 8.8.8.8 or 1.1.1.1. FTLDNS writes these into the dnsmasq config as server= directives:

root@kitploit:~
# Normal input: "8.8.8.8"
# Generates:
server=8.8.8.8

The problem: FTLDNS does not sanitize newline characters in the input. An attacker can inject \n to break out of the intended server= directive and inject entirely new configuration lines:

root@kitploit:~
# Malicious input: "8.8.8.8\ndhcp-option=6,evil.dns.server"
# Generates:
server=8.8.8.8
dhcp-option=6,evil.dns.server

This alone would be concerning (DNS hijacking via DHCP option injection). But it gets worse.

From Newline to Shell — The Kill Chain

dnsmasq supports a configuration directive called dhcp-option that can reference external scripts, and more critically, it supports several directives that can execute commands in specific scenarios. The exploitation chain looks like this:

root@kitploit:~
Step 1: Attacker authenticates to Pi-hole 
        (default creds, weak password, CSRF, compromised session)

Step 2: Attacker sends API request to update dns.upstreams:
        
        POST /api/dns/upstream
        {
          "upstreams": ["8.8.8.8\n<malicious dnsmasq directive>"]
        }

Step 3: FTLDNS writes the value to the dnsmasq config file 
        without sanitizing the newline

Step 4: The injected dnsmasq directive is parsed as a 
        legitimate configuration option

Step 5: Depending on the directive injected, the attacker achieves:
        - DNS hijacking (redirect all DNS queries)
        - DHCP poisoning (push malicious configs to clients)
        - Command execution via dnsmasq's scripting capabilities
        - File write to arbitrary paths

The key insight is that this isn't about exploiting a dnsmasq vulnerability, dnsmasq is working as designed. The vulnerability is that FTLDNS lets untrusted input bleed into the configuration file, turning a configuration management API into an arbitrary config injection point.

The Full Family — Five Injection Vectors

The researcher (T0X1Cx) discovered that the same newline injection pattern affects five different FTLDNS configuration parameters. This is a systemic issue — the code lacked input sanitization across the board:

AdvisoryParameterWhat It Controls
GHSA-23w8-7333-p9fjdns.upstreamsUpstream DNS servers
GHSA-wxhv-w77q-6qwpdns.hostRecordCustom DNS host records
GHSA-28g5-gg88-wh5mdns.cnameRecordsCNAME record mappings
GHSA-fqv2-qhfh-ghcjdhcp.leaseTimeDHCP lease duration
GHSA-vfmq-jrx3-wv3cdhcp.hostsStatic DHCP host assignments

Each of these parameters writes to dnsmasq configuration files, and each failed to sanitize newline characters. The fix in FTL v6.6 added proper input validation that rejects newline characters (and other control characters) across all configuration parameters.


Impact Analysis

On the Pi-hole host:

  • Full command execution with the privileges of the FTLDNS process (typically root or pihole user)
  • Since Pi-hole often runs on dedicated devices (Raspberry Pi) or as a privileged container, this frequently means root access
  • File read/write access to the host filesystem
  • Persistence via cron jobs, SSH keys, or modified system files

On the network (downstream impact):

  • DNS hijacking — redirect all DNS queries to attacker-controlled servers
  • DHCP poisoning — push malicious DNS, gateway, or NTP settings to all DHCP clients
  • Man-in-the-middle positioning — by controlling DNS, the attacker can redirect traffic for any domain
  • Credential harvesting — redirect authentication endpoints to phishing servers
  • Malware distribution — redirect software update domains to serve malicious payloads

Risk amplification factors:

  • Pi-hole is often the only DNS server on the network compromise it, and you control name resolution for every device
  • Many Pi-hole installations use default or weak admin passwords
  • Pi-hole instances are frequently exposed to the entire local network, not just admins
  • CSRF attacks against the Pi-hole web interface could trigger exploitation without direct authentication

Affected Versions

VersionStatus
FTLDNS 6.6+Patched
FTLDNS 6.0 – 6.5Vulnerable
FTLDNS 5.x and earlierNot affected (different API architecture)

To check your version:

root@kitploit:~
pihole -v
# or
pihole-FTL --version

Who is at Risk?

High risk:

  • Pi-hole instances accessible from untrusted network segments
  • Deployments using default or weak admin passwords
  • Pi-hole exposed to the internet (surprisingly common on Shodan)
  • Shared hosting environments where multiple users access the same network

Moderate risk:

  • Pi-hole instances in well-segmented home networks with strong passwords
  • Deployments behind VPN with multi-factor authentication

Lower risk (but still patch):

  • Air-gapped or fully isolated Pi-hole instances
  • Read-only or API-disabled deployments

Detection

Python Scanner

The Python script detects vulnerable Pi-hole instances through version-based analysis.

How it works:

  1. Fingerprinting — Identifies Pi-hole via admin interface indicators (page content, headers)
  2. API Version Query — Queries both Pi-hole v5 and v6 API endpoints for FTL version info
  3. Version Comparison — Parses the FTL version string and checks against the vulnerable range (6.0 ≤ v < 6.6)
  4. Related CVEs — If vulnerable, flags all five related newline injection advisories

No injection payloads are sent. The test is entirely read-only and safe.

Usage:

root@kitploit:~
# Install dependencies
pip install -r requirements.txt

# Single target (HTTP, default port 80)
python CVE-2026-35517_PiHole_FTLDNS_detector.py -t 192.168.1.1

# Custom port
python CVE-2026-35517_PiHole_FTLDNS_detector.py -t pi.hole -p 8080

# HTTPS mode (auto-switches to port 443)
python CVE-2026-35517_PiHole_FTLDNS_detector.py -t 10.0.0.1 --https

# Bulk scan from file
python CVE-2026-35517_PiHole_FTLDNS_detector.py -f targets.txt

# JSON output saved to file
python CVE-2026-35517_PiHole_FTLDNS_detector.py -t 192.168.1.1 --json -o results.json

# Increased timeout
python CVE-2026-35517_PiHole_FTLDNS_detector.py -t 192.168.1.1 --timeout 20

Options:

FlagDescriptionDefault
-t, --targetTarget IP or hostname—
-f, --fileFile with targets, one per line (# comments supported)—
-p, --portTarget port80
--httpsUse HTTPS (auto-switches port to 443 if port is 80)Off
--timeoutConnection timeout in seconds10
--jsonOutput in JSON formatOff
-o, --outputSave results to a file—

Example output:

root@kitploit:~
╔══════════════════════════════════════════════════════════════╗
║  CVE-2026-35517 - Pi-hole FTLDNS RCE Detector                ║
║  Newline Injection in dns.upstreams → Command Execution      ║
║  CVSS: 8.8 (High) | Affects: FTLDNS 6.0 - 6.5                ║
╚══════════════════════════════════════════════════════════════╝

[*] Scanning 192.168.1.1:80...

Target: 192.168.1.1:80
============================================================
  [*] Pi-hole detected
      Admin interface: Accessible
      API accessible:  Yes
      FTL version:     v6.4
      Core version:    v6.3
      Web version:     v6.4

  CVE-2026-35517 Assessment:
    [VULNERABLE] FTLDNS 6.4 is within the vulnerable range (6.0 - 6.5).
    Upgrade to FTL v6.6 or later immediately.

  Related Vulnerabilities (also patched in FTL v6.6):
    [-] GHSA-wxhv-w77q-6qwp: RCE via dns.hostRecord Newline Injection
    [-] GHSA-28g5-gg88-wh5m: RCE via dns.cnameRecords Newline Injection
    [-] GHSA-fqv2-qhfh-ghcj: RCE via dhcp.leaseTime Newline Injection
    [-] GHSA-vfmq-jrx3-wv3c: RCE via dhcp.hosts Newline Injection

  Remediation:
    1. Upgrade Pi-hole FTL to version 6.6 or later
    2. Run: pihole -up
    3. Verify with: pihole -v
    4. Review API access controls and authentication settings
    5. Check logs for signs of exploitation (unusual DNS config changes)

Nmap NSE Script

root@kitploit:~
# Install the NSE script
sudo cp CVE-2026-35517_PiHole_FTLDNS.nse /usr/share/nmap/scripts/
sudo nmap --script-updatedb

# Basic scan
nmap -p 80 --script CVE-2026-35517_PiHole_FTLDNS <target>

# Scan common Pi-hole ports
nmap -p 80,443,8080,4711 --script CVE-2026-35517_PiHole_FTLDNS <target>

# Subnet scan — find all Pi-hole instances on a network
nmap -p 80 --script CVE-2026-35517_PiHole_FTLDNS 192.168.1.0/24

# Combined with version detection
nmap -sV -p 80,443 --script CVE-2026-35517_PiHole_FTLDNS <target>

# Scan targets from a file
nmap -p 80 --script CVE-2026-35517_PiHole_FTLDNS -iL targets.txt

Example Nmap output:

root@kitploit:~
PORT   STATE SERVICE
80/tcp open  http
| CVE-2026-35517_PiHole_FTLDNS:
|   VULNERABLE:
|   Pi-hole FTLDNS RCE via Upstream DNS Configuration
|     State: VULNERABLE
|     IDs:  CVE:CVE-2026-35517
|     Risk factor: High (CVSS: 8.8)
|     Disclosure date: 2026-04-07
|     Extra information:
|       FTL Version: v6.4
|       Core Version: v6.3
|       Web Version: v6.4
|       Related advisories also fixed in FTL v6.6:
|         GHSA-wxhv-w77q-6qwp (dns.hostRecord injection)
|         GHSA-28g5-gg88-wh5m (dns.cnameRecords injection)
|         GHSA-fqv2-qhfh-ghcj (dhcp.leaseTime injection)
|         GHSA-vfmq-jrx3-wv3c (dhcp.hosts injection)
|       Remediation: Upgrade to Pi-hole FTL v6.6+ (pihole -up)
|     References:
|       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-35517
|_      https://github.com/pi-hole/FTL/security/advisories/GHSA-23w8-7333-p9fj

Manual Version Check

If you have SSH access to the Pi-hole host:

root@kitploit:~
# Check FTL version
pihole-FTL --version

# Or via the Pi-hole CLI
pihole -v

# Check via API (v6)
curl -s http://pi.hole/api/info/version | python3 -m json.tool

# Check via API (v5)
curl -s http://pi.hole/admin/api.php?versions | python3 -m json.tool

If the FTL version is between 6.0 and 6.5 (inclusive), you are vulnerable.


Indicators of Compromise

What to look for:

  • Unusual dnsmasq configuration entries — Check /etc/dnsmasq.d/ and /etc/pihole/ for unexpected directives
  • Modified upstream DNS settings — Verify your configured upstream servers haven't been changed
  • Unexpected API calls — Review Pi-hole's query log and API access logs for configuration change requests
  • Anomalous DNS behavior — Clients resolving domains to unexpected IP addresses
  • New cron jobs or SSH keys — If the host has been compromised via command execution
  • Process anomalies — Unexpected child processes spawned by dnsmasq or pihole-FTL

Commands to investigate:

root@kitploit:~
# Check dnsmasq configs for injected lines
grep -r "dhcp-option\|addn-hosts\|conf-file\|log-facility" /etc/dnsmasq.d/

# Check for recent config modifications
find /etc/pihole /etc/dnsmasq.d -mtime -7 -ls

# Review Pi-hole's debug log
pihole -d

# Check running processes for anomalies
ps aux | grep -E "dnsmasq|pihole"

# Review crontab for persistence
crontab -l
cat /etc/crontab
ls -la /etc/cron.d/

Remediation

Immediate action - upgrade now:

root@kitploit:~
# Update Pi-hole (includes FTL, Web, and Core)
pihole -up

# Verify the update
pihole -v
# FTL version should be >= 6.6

If you can't upgrade immediately:

  1. Restrict API access — Configure Pi-hole to only accept API connections from trusted IPs
  2. Change the admin password — Use a strong, unique password: pihole -a -p
  3. Network isolation — Ensure the Pi-hole admin interface is only accessible from a management VLAN
  4. Disable remote API — If you only use the local web UI, restrict the API to localhost

Post-patch actions:

  1. Audit DNS configuration — Review all dnsmasq config files for injected directives
  2. Verify upstream servers — Confirm your DNS upstream settings are correct
  3. Check for persistence — Look for unauthorized cron jobs, SSH keys, or modified system files
  4. Review DHCP leases — If DHCP is managed by Pi-hole, verify lease configurations
  5. Monitor DNS behavior — Watch for anomalous resolution patterns over the next few days

References

  • GitHub Security Advisory — GHSA-23w8-7333-p9fj (dns.upstreams)
  • GitHub Security Advisory — GHSA-wxhv-w77q-6qwp (dns.hostRecord)
  • GitHub Security Advisory — GHSA-28g5-gg88-wh5m (dns.cnameRecords)
  • GitHub Security Advisory — GHSA-fqv2-qhfh-ghcj (dhcp.leaseTime)
  • GitHub Security Advisory — GHSA-vfmq-jrx3-wv3c (dhcp.hosts)
  • Pi-hole FTL v6.6 Release Notes

Author

Kerem Oruç - Cybersecurity Engineer

  • GitHub: @keraattin
  • Twitter: @keraattin
Download Tool