/

CVE-2026-44888

Severity:

CRITICAL RISK

(9.8)

Code Injection in Pi.Alert SaveConfigFile

CVE-2026-44888

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Unauthenticated Remote Code Execution

Severity:

CRITICAL RISK

(9.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

Pi.Alert's configuration saving endpoint writes user-supplied numeric values directly into pialert.conf, which is subsequently loaded using Python's exec() by a recurring background process.

Under default settings where web protection is disabled, an unauthenticated attacker can inject Python code into the config file and achieve OS-level remote code execution whenever the cron job reloads configuration.

Affected context

The vulnerability affects Pi.Alert deployments where:

  • The SaveConfigFile() web endpoint is exposed and reachable.
  • Configuration values are written directly to pialert.conf without strong validation, escaping, or type enforcement.
  • The background cron process periodically loads pialert.conf using Python's exec() in the application runtime.
  • PIALERT_WEB_PROTECTION is set to False (the default in many setups), leaving the endpoint unauthenticated.

In such environments, attacker-controlled configuration parameters can cross the trust boundary between the web interface and the privileged background process.

Exploit preconditions

  • Attack surface: HTTP access to the Pi.Alert web service exposing the SaveConfigFile() endpoint.
  • Required access:
  • On default installations with PIALERT_WEB_PROTECTION = False, no authentication is required.
  • In hardened setups, the attacker would need valid credentials or another method to reach the config-saving path.
  • Trigger point: The periodic cron job or background task that reloads pialert.conf using exec() every 3–5 minutes.
  • Why exploitation is possible: User-supplied "numeric" configuration fields (such as SMTP_PORT) are written verbatim into a Python configuration file and then executed as code. Because data is treated as code without validation or sanitization, an attacker can inject arbitrary Python expressions that the cron process executes in the server context.

Why this happens

This issue stems from treating configuration data as executable code and using Python's exec() on files that can be influenced by external input.

The SaveConfigFile() endpoint accepts client-controlled values and writes them directly into pialert.conf in a form that is later evaluated by exec(). This design conflates configuration with code and effectively grants remote users the ability to extend or replace application logic. The absence of robust validation (e.g., strict numeric parsing, type checks, or whitelisting) and the reliance on dynamic execution make it a textbook instance of CWE-94: Improper Control of Generation of Code, where externally supplied input shapes code that is interpreted by the runtime.

Potential impact

  • Remote execution of arbitrary Python code in the Pi.Alert server context.
  • Execution of OS commands, including installation of malware, backdoors, or pivot tooling.
  • Full compromise of the host running Pi.Alert, depending on the service account's privileges.
  • Modification or disabling of intrusion detection and monitoring logic.
  • Use of the Pi.Alert instance as a foothold for lateral movement within the internal network.
  • Exfiltration or tampering of configuration data, logs, and monitored network information.

General mitigation guidance

Effective mitigation generally focuses on removing the dependency on dynamic code execution for configuration and strictly separating data from code:

  • Replace exec()-based configuration loading with a data-only format (e.g., INI, JSON, or YAML) parsed using non-executing libraries.
  • Enforce strict type validation on all incoming configuration fields; for numeric fields, perform robust conversion and reject non-numeric input instead of embedding raw strings into code.
  • Introduce a canonical configuration schema and validate all updates against this schema before persisting them to disk.
  • Treat any file loaded by the runtime as untrusted unless it is written exclusively by trusted components, and avoid executing configuration content.
  • Apply least-privilege principles for the Pi.Alert process and its cron jobs to reduce the blast radius if code execution occurs.
  • Enable strong authentication and access control on administrative endpoints to narrow who can modify configuration.

How teams detect issues like this

Detection efforts can target both the underlying coding pattern and potential exploitation attempts:

  • Static analysis: Configure rules to flag uses of exec() or similar dynamic evaluation functions on file contents, especially when those files are modified by web handlers or user-facing endpoints.
  • Code review: Treat any pattern where configuration data is constructed as Python code as a high-risk anti-pattern; reviewers should be alert for concatenation of user input into code-like strings.
  • Runtime monitoring: Log and monitor access to administrative endpoints like SaveConfigFile() and look for unusual or malformed configuration values, particularly where numeric fields contain unexpected characters.
  • File integrity checks: Use checksums or integrity monitoring on configuration files that should not change frequently, alerting on suspicious or frequent modifications.
  • Policy enforcement: Incorporate organization-wide guidelines that prohibit using exec() for configuration handling and enforce them with pre-commit hooks or CI checks in relevant repositories.

Sources

SourceLink
github.comgithub.com/leiweibau/Pi.Alert/security/advisories/GHSA-xg85-f8qw-7c5f

Frequently asked

questions

In environments using default settings (PIALERT_WEB_PROTECTION = False), the vulnerability is broadly exploitable by anyone who can reach the Pi.Alert web interface over the network. In instances with proper authentication and restricted exposure, exploitation is limited to authenticated or internal users with configuration access.

On default installations, no credentials are needed; simple HTTP access to the configuration-saving endpoint is sufficient. In hardened deployments, the attacker must have the same level of access required to modify configuration via the web UI.

The safest pattern is to eliminate dynamic code execution for configuration: store settings in a data-only format and parse them with non-executing libraries, while strictly validating and constraining configuration fields to their expected types and ranges.

Avoid any design that treats externally influenced configuration as executable code, adopt secure coding guidelines that forbid exec()/eval() on dynamic input, and enforce these rules through code review and automated checks in CI. Additionally, require authentication and proper authorization for all administrative or configuration-changing endpoints and apply least-privilege principles to background tasks that consume configuration.

Find out what's already
exploitable in your codebase.