/

CVE-2026-39902

Severity:

HIGH RISK

(7.2)

OS Command Injection (CWE-78) in Cacti Web Framework

CVE-2026-39902

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.2)

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 versions before 1.2.31 contain an incomplete input blocklist that can allow authenticated administrators to store shell-significant characters in an input string. If that value is later incorporated into an operating-system command without safe argument handling, an attacker may execute unintended commands with the application's privileges.

Cacti versions before 1.2.31 contain an incomplete input blocklist that can allow authenticated administrators to store shell-significant characters in an input string. If that value is later incorporated into an operating-system command without safe argument handling, an attacker may execute unintended commands with the application's privileges.

Affected context

The issue occurs in Cacti deployments where an authenticated administrator can save an input_string that is later used in a command-execution context. It becomes risky when validation relies on a partial character blocklist and does not safely separate user-controlled data from shell syntax. The exposure depends on the relevant input being processed by a command-capable feature and on the resulting process having meaningful system privileges.

The issue occurs in Cacti deployments where an authenticated administrator can save an input_string that is later used in a command-execution context. It becomes risky when validation relies on a partial character blocklist and does not safely separate user-controlled data from shell syntax. The exposure depends on the relevant input being processed by a command-capable feature and on the resulting process having meaningful system privileges.

Exploit preconditions

  • Attack surface: Cacti administrative input handling and any subsequent command-execution path using the stored value
  • Required access: Authenticated administrative access capable of saving the affected input
  • Trigger point: Processing of the saved input_string by a shell command or command-building routine
  • Why exploitation is possible: The prior blocklist omitted several shell-significant characters, allowing crafted values to pass validation and influence command interpretation
  • Attack surface: Cacti administrative input handling and any subsequent command-execution path using the stored value
  • Required access: Authenticated administrative access capable of saving the affected input
  • Trigger point: Processing of the saved input_string by a shell command or command-building routine
  • Why exploitation is possible: The prior blocklist omitted several shell-significant characters, allowing crafted values to pass validation and influence command interpretation

Why this happens

The underlying bug is an incomplete blacklist used to validate data that may reach an operating-system command. Characters such as quotes, redirection operators, subshell delimiters, and braces can carry shell syntax, but the validation logic did not account for all relevant metacharacters. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where untrusted input is interpreted as part of a command rather than treated strictly as data.

The underlying bug is an incomplete blacklist used to validate data that may reach an operating-system command. Characters such as quotes, redirection operators, subshell delimiters, and braces can carry shell syntax, but the validation logic did not account for all relevant metacharacters. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where untrusted input is interpreted as part of a command rather than treated strictly as data.

Potential impact

  • An attacker could execute arbitrary operating-system commands with the application's privileges
  • The Cacti host or service account may be compromised
  • Monitoring data, configurations, or credentials could be altered or exposed
  • The compromised system could be used for lateral movement or further intrusion
  • Availability of monitoring services could be disrupted
  • An attacker could execute arbitrary operating-system commands with the application's privileges
  • The Cacti host or service account may be compromised
  • Monitoring data, configurations, or credentials could be altered or exposed
  • The compromised system could be used for lateral movement or further intrusion
  • Availability of monitoring services could be disrupted

General mitigation guidance

Mitigation generally focuses on preventing user-controlled data from becoming shell syntax.

Common defensive patterns include:

  • Prefer direct process APIs with an executable and separately bounded arguments instead of invoking a shell
  • Use allowlisted values and strict type or schema validation for administrative inputs
  • Treat stored administrative input as untrusted when it is later consumed by backend processes
  • Avoid relying on character blocklists as the primary command-injection defense
  • Apply least privilege to the web service, scheduled jobs, and command-executing helpers
  • Restrict access to administrative functions and audit changes to command-relevant configuration
  • Add regression tests covering shell metacharacters and unexpected argument boundaries

Mitigation generally focuses on preventing user-controlled data from becoming shell syntax.

Common defensive patterns include:

  • Prefer direct process APIs with an executable and separately bounded arguments instead of invoking a shell
  • Use allowlisted values and strict type or schema validation for administrative inputs
  • Treat stored administrative input as untrusted when it is later consumed by backend processes
  • Avoid relying on character blocklists as the primary command-injection defense
  • Apply least privilege to the web service, scheduled jobs, and command-executing helpers
  • Restrict access to administrative functions and audit changes to command-relevant configuration
  • Add regression tests covering shell metacharacters and unexpected argument boundaries

How teams detect issues like this

Detection efforts can include:

  • Static analysis rules identifying shell invocation, string-based command construction, and concatenation of user-controlled values
  • Code review checks for blacklist-only validation and use of shell-enabled process APIs
  • Tests that verify inputs remain single arguments and cannot alter command structure
  • Runtime monitoring for unusual child processes, command interpreters, redirection behavior, or unexpected process execution by the Cacti service account
  • Policy enforcement requiring direct execution APIs, approved argument handling, and least-privilege service identities
  • Automated security review tools that flag data flows from administrative inputs to operating-system command execution

Detection efforts can include:

  • Static analysis rules identifying shell invocation, string-based command construction, and concatenation of user-controlled values
  • Code review checks for blacklist-only validation and use of shell-enabled process APIs
  • Tests that verify inputs remain single arguments and cannot alter command structure
  • Runtime monitoring for unusual child processes, command interpreters, redirection behavior, or unexpected process execution by the Cacti service account
  • Policy enforcement requiring direct execution APIs, approved argument handling, and least-privilege service identities
  • Automated security review tools that flag data flows from administrative inputs to operating-system command execution

Sources

SourceLink
github.comgithub.com/Cacti/cacti/pull/7112
github.comgithub.com/Cacti/cacti/security/advisories/GHSA-c4qp-j9r9-fq24

Frequently asked

questions

It can be exploitable through the Cacti administrative interface when the attacker has authenticated administrative access and the affected value is later processed in a command-execution path.

Yes, the described attack requires an authenticated administrator who can save the relevant input_string. The overall impact also depends on how and where Cacti processes that value.

Keep user-controlled values out of shell syntax by using direct process execution with separately validated arguments. Strict allowlists and strong privilege boundaries provide additional protection.

Review all flows from administrative input to process execution, avoid blacklist-only validation, test shell metacharacter handling, and enforce secure command-execution patterns through code review and automated analysis.

It can be exploitable through the Cacti administrative interface when the attacker has authenticated administrative access and the affected value is later processed in a command-execution path.

Yes, the described attack requires an authenticated administrator who can save the relevant input_string. The overall impact also depends on how and where Cacti processes that value.

Keep user-controlled values out of shell syntax by using direct process execution with separately validated arguments. Strict allowlists and strong privilege boundaries provide additional protection.

Review all flows from administrative input to process execution, avoid blacklist-only validation, test shell metacharacter handling, and enforce secure command-execution patterns through code review and automated analysis.

Find out what's already
exploitable in your codebase.