/

CVE-2026-119335

Severity:

HIGH RISK

(7.8)

OS Command Injection (CWE-78) in Pi-hole PID File Path

CVE-2026-119335

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Privilege Escalation and Root-Level Command Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection vulnerability in Pi-hole's PID-file handling can cause root-run Bash logic to evaluate attacker-controlled content as an arithmetic expression. An attacker who already has code execution as the pihole user may be able to escalate privileges to root when a vulnerable subcommand reads the manipulated PID file.

A command injection vulnerability in Pi-hole's PID-file handling can cause root-run Bash logic to evaluate attacker-controlled content as an arithmetic expression. An attacker who already has code execution as the pihole user may be able to escalate privileges to root when a vulnerable subcommand reads the manipulated PID file.

Affected context

The issue occurs in Pi-hole deployments where the root-run subcommands use the

pihole-owned /run/pihole-FTL.pid file and rely on incomplete validation of

its contents. The risk is present when an attacker can execute code as the

pihole user and write to that PID file before a privileged Bash arithmetic

comparison processes its value.

The issue occurs in Pi-hole deployments where the root-run subcommands use the

pihole-owned /run/pihole-FTL.pid file and rely on incomplete validation of

its contents. The risk is present when an attacker can execute code as the

pihole user and write to that PID file before a privileged Bash arithmetic

comparison processes its value.

Exploit preconditions

  • Attack surface: Local interaction with Pi-hole's PID-file handling
  • Required access: Existing code execution or equivalent write capability as the pihole user
  • Trigger point: A root-run Pi-hole subcommand that reads and evaluates the PID value
  • Why exploitation is possible: Validation rejects only values beginning with a non-digit, while Bash arithmetic evaluation can interpret specially structured digit-prefixed content and perform command substitution
  • Attack surface: Local interaction with Pi-hole's PID-file handling
  • Required access: Existing code execution or equivalent write capability as the pihole user
  • Trigger point: A root-run Pi-hole subcommand that reads and evaluates the PID value
  • Why exploitation is possible: Validation rejects only values beginning with a non-digit, while Bash arithmetic evaluation can interpret specially structured digit-prefixed content and perform command substitution

Why this happens

The underlying flaw combines incomplete input validation with unsafe use of

attacker-influenced data in a Bash arithmetic expression. The validation

checks only the first character rather than requiring the entire PID value to

match a strict numeric format. As a result, content that appears to begin

like a valid PID can still be interpreted by Bash as executable expression

syntax, which maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The underlying flaw combines incomplete input validation with unsafe use of

attacker-influenced data in a Bash arithmetic expression. The validation

checks only the first character rather than requiring the entire PID value to

match a strict numeric format. As a result, content that appears to begin

like a valid PID can still be interpreted by Bash as executable expression

syntax, which maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute commands with root privileges
  • The Pi-hole host could be fully compromised
  • DNS filtering and resolution behavior could be altered
  • Local credentials, configuration, or protected data could be exposed
  • The compromised host could be used for lateral movement or persistence
  • An attacker may execute commands with root privileges
  • The Pi-hole host could be fully compromised
  • DNS filtering and resolution behavior could be altered
  • Local credentials, configuration, or protected data could be exposed
  • The compromised host could be used for lateral movement or persistence

General mitigation guidance

Mitigation generally focuses on treating PID-file contents as strictly

untrusted data and preventing shell evaluation from interpreting them as

code.

Common defensive patterns include:

  • Require the complete PID value to match a narrowly defined decimal-integer schema
  • Parse and compare process identifiers using non-shell APIs or safely typed operations
  • Avoid arithmetic evaluation of data that can be modified by a less-privileged account
  • Use ownership, permissions, and protected runtime directories to limit PID-file modification
  • Separate privileged operations from inputs writable by service accounts
  • Apply least privilege to Pi-hole processes and constrain root-run helper behavior
  • Treat validation as a full-string check performed before any interpretation or comparison

Mitigation generally focuses on treating PID-file contents as strictly

untrusted data and preventing shell evaluation from interpreting them as

code.

Common defensive patterns include:

  • Require the complete PID value to match a narrowly defined decimal-integer schema
  • Parse and compare process identifiers using non-shell APIs or safely typed operations
  • Avoid arithmetic evaluation of data that can be modified by a less-privileged account
  • Use ownership, permissions, and protected runtime directories to limit PID-file modification
  • Separate privileged operations from inputs writable by service accounts
  • Apply least privilege to Pi-hole processes and constrain root-run helper behavior
  • Treat validation as a full-string check performed before any interpretation or comparison

How teams detect issues like this

Detection can combine source review, runtime monitoring, and policy enforcement.

Useful approaches include:

  • Static analysis rules for arithmetic evaluation, command substitution, and

shell expansion involving file-derived variables

  • Code review checks for validation expressions that inspect only a prefix or

first character of security-sensitive values

  • Searches for privileged shell commands consuming files writable by service

accounts

  • File-integrity monitoring on PID files and other privileged runtime metadata
  • Alerts for unexpected root-child processes launched by Pi-hole helpers
  • CI policies that reject shell arithmetic or dynamic evaluation of untrusted

input; automated code-review tools may assist with identifying these patterns

Detection can combine source review, runtime monitoring, and policy enforcement.

Useful approaches include:

  • Static analysis rules for arithmetic evaluation, command substitution, and

shell expansion involving file-derived variables

  • Code review checks for validation expressions that inspect only a prefix or

first character of security-sensitive values

  • Searches for privileged shell commands consuming files writable by service

accounts

  • File-integrity monitoring on PID files and other privileged runtime metadata
  • Alerts for unexpected root-child processes launched by Pi-hole helpers
  • CI policies that reject shell arithmetic or dynamic evaluation of untrusted

input; automated code-review tools may assist with identifying these patterns

Sources

SourceLink
github.comgithub.com/pi-hole/pi-hole/commit/555dd4d8b3699327fbba482bb73cce5f53979bd1
github.comgithub.com/pi-hole/pi-hole/pull/6719
github.comgithub.com/pi-hole/pi-hole/releases/tag/v6.5
github.comgithub.com/pi-hole/pi-hole/security/advisories/GHSA-cf36-4hhc-8398

Frequently asked

questions

It is primarily a local privilege-escalation issue. Remote exploitation would

generally require a separate vulnerability or exposed service that first

provides code execution or write access as the pihole user.

The attacker must be able to execute code as the pihole user or otherwise

modify the pihole-owned PID file, and a privileged Pi-hole subcommand must

subsequently process its contents.

Treat the PID value as untrusted text, require a complete numeric match, and

avoid passing it through shell arithmetic or other evaluation mechanisms.

Use typed or non-shell parsing, protect privileged runtime files with strict

ownership and permissions, review trust boundaries between service accounts

and root helpers, and monitor for unexpected changes to sensitive files.

It is primarily a local privilege-escalation issue. Remote exploitation would

generally require a separate vulnerability or exposed service that first

provides code execution or write access as the pihole user.

The attacker must be able to execute code as the pihole user or otherwise

modify the pihole-owned PID file, and a privileged Pi-hole subcommand must

subsequently process its contents.

Treat the PID value as untrusted text, require a complete numeric match, and

avoid passing it through shell arithmetic or other evaluation mechanisms.

Use typed or non-shell parsing, protect privileged runtime files with strict

ownership and permissions, review trust boundaries between service accounts

and root helpers, and monitor for unexpected changes to sensitive files.

Find out what's already
exploitable in your codebase.