/

CVE-2026-39938

Severity:

CRITICAL RISK

(9.8)

Unauthenticated LFI (CWE-22) in Cacti Graph Theme IPC

CVE-2026-39938

Analyzed

Vulnerability type

Category:

Local File Inclusion

CWE:

CWE-22, CWE-78

Impact:

Arbitrary File Read / Potential 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

Cacti before version 1.2.31 contains an unauthenticated local file inclusion vulnerability tied to graph theme handling and rrdtool IPC serialization.

Under certain configurations, an attacker can craft requests that cause the server to read arbitrary local files, which may lead to code execution or data disclosure.

Affected context

The vulnerability occurs in Cacti deployments using versions 1.2.30 and earlier, particularly where graph themes and rrdtool inter-process communication (IPC) are enabled and exposed via the web interface.

It manifests when user-controlled input is used to resolve file paths for theme or IPC-related resources without sufficient normalization or restriction.

In environments where PHP interprets included files or where sensitive configuration files are accessible, this behavior can become significantly more dangerous.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the Cacti application.
  • Required access: No authentication; an attacker only needs network access to the Cacti web UI.
  • Trigger point: Requests that influence graph_theme and related rrdtool IPC serialization parameters, causing the application to resolve and access local file paths.
  • Why exploitation is possible: Path parameters are not robustly validated or constrained, allowing traversal or arbitrary file selection, and IPC serialization hardening is insufficient to prevent misuse of filesystem access.

Why this happens

At its core, this issue reflects improper control of file paths derived from user input, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

The graph theme and rrdtool IPC mechanisms rely on dynamically computed file paths, but do not consistently normalize, validate, or restrict these paths to a safe directory set.

In some deployments, the included files or data read from disk may influence command execution paths or configuration parsing, intersecting with CWE-78: Improper Neutralization of Special Elements used in an OS Command, where filesystem content or parameters can indirectly shape commands issued to rrdtool or related utilities.

Potential impact

  • An attacker may read arbitrary local files accessible to the web server user.
  • Sensitive configuration data, credentials, or keys could be exposed.
  • Under certain configurations, file inclusion may lead to arbitrary code execution via interpreted PHP or script files.
  • An attacker could potentially pivot to broader system compromise if included data is used to construct OS-level commands.

General mitigation guidance

Effective mitigation typically focuses on tightening path handling and reducing trust in user-controllable input.

Common defensive patterns include:

  • Constraining file access to a strict set of directories and whitelisted resources for themes and IPC.
  • Normalizing and validating all path-like inputs, rejecting traversal sequences and unexpected file extensions.
  • Decoupling IPC and theme configuration from direct filesystem inclusion, favoring structured metadata rather than dynamic file loading.
  • Ensuring any interaction with OS-level commands uses fixed command templates and parameter whitelisting to avoid injection via file content or user input.
  • Running the application with least-privilege permissions so that, even if file read occurs, the accessible data set is minimized.

How teams detect issues like this

Organizations can detect similar vulnerabilities by:

  • Applying static analysis rules that flag direct use of user input in file path construction or include/require statements.
  • Reviewing code paths around graph theme selection and IPC handling for directory traversal, lack of whitelisting, or missing normalization.
  • Implementing security-focused code review checklists that require verification of path constraints and command construction safety.
  • Using web application firewalls or request filtering policies to log and alert on suspicious path patterns such as ../ and unexpected file extensions.

Sources

SourceLink
github.comgithub.com/Cacti/cacti/commit/9871f0cef9af285398d558c9b3188d5977e01a04
github.comgithub.com/Cacti/cacti/security/advisories/GHSA-rm7p-qcqm-x5m6

Frequently asked

questions

Yes. An attacker with network access to the Cacti web interface can exploit the issue without prior authentication.

Only unauthenticated web access is required; no valid user credentials or prior compromise of the host are needed.

Restrict file access to vetted directories, enforce strict whitelisting for theme and IPC-related resources, and ensure that user input is never used directly in file includes or command construction.

Adopt secure-by-default path handling APIs, mandate input validation and canonicalization for all filesystem operations, enforce least-privilege execution environments, and integrate static analysis and security-focused code reviews in the development lifecycle.

Find out what's already
exploitable in your codebase.