/

CVE-2026-54161

Severity:

HIGH RISK

(8.1)

OS Command Injection (CWE-78) in Network UPS Tools

CVE-2026-54161

Received

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary operating-system command execution

Severity:

HIGH RISK

(8.1)

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

Network UPS Tools (NUT) can pass a server-supplied UPS alarm value into shell commands when upsmon handles notifications. If an alarm is processed with an EXEC notification configured, crafted shell metacharacters may allow command execution with the privileges of the upsmon account, which is commonly root.

Affected context

The issue occurs in upsmon notification handling in clients/upsmon.c, where the ups.alarm value supplied by the server is incorporated into shell commands. It affects the described NUT versions 2.8.3 through 2.8.5 when a monitored device reports an ALARM state and the operator has configured NOTIFYCMD with EXEC in NOTIFYFLAG ALARM. The alarm value may originate from a malicious or compromised upsd, a compromised UPS device, or a plaintext connection exposed to an on-path attacker.

Exploit preconditions

  • Attack surface: The upsmon notification path for monitored UPS devices.
  • Required access: Ability to influence the alarm value supplied to upsmon, such as through a malicious or compromised upsd, a compromised UPS device, or an on-path position on a plaintext connection.
  • Trigger point: A monitored device reports an ALARM state while NOTIFYFLAG ALARM enables EXEC for the configured NOTIFYCMD.
  • Why exploitation is possible: The server-supplied alarm text is inserted into shell commands without adequate protection against shell metacharacters. Successful command execution runs with the upsmon account's privileges.

Why this happens

The notification code treats a server-supplied alarm string as safe to embed in a shell command. Shell metacharacters in that string can alter the command's meaning when the shell interprets it, which maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command. This is a command-construction and input-trust boundary failure.

Potential impact

  • An attacker may execute arbitrary operating-system commands as the upsmon account.
  • If upsmon runs with root privileges, an attacker could gain root-level control of the host.
  • An attacker could disrupt UPS monitoring or alter system configuration.
  • A compromised host could be used to access other systems or sensitive data.

General mitigation guidance

Defensive patterns focus on avoiding shell interpretation of externally influenced data and limiting the consequences of compromise.

  • Prefer direct process execution with fixed arguments over constructing shell command strings.
  • If shell invocation cannot be avoided, use robust argument-escaping mechanisms appropriate to the platform and validate input against a narrow expected format.
  • Treat alarm text from servers, devices, and network connections as untrusted, including when transport encryption is enabled.
  • Restrict notification command configuration and run monitoring processes with only the privileges they need.
  • Use authenticated, encrypted connections where appropriate, while recognizing that transport protection does not address compromised upstream devices.

How teams detect issues like this

  • Use static analysis to identify shell execution APIs that receive strings containing externally sourced values.
  • Review notification handling for command construction, especially paths that incorporate server- or device-supplied alarm text.
  • Check configuration and deployment policies for EXEC notification settings and unnecessary privileges assigned to monitoring processes.
  • Monitor process creation and command execution by upsmon for unexpected activity.
  • Automated code review tools can help flag shell invocation patterns and untrusted data flows.

Sources

SourceLink
github.comgithub.com/networkupstools/nut/commit/98e073d4cc31f9c73e2fa0c2677540487d902fe7
github.comgithub.com/networkupstools/nut/commit/dffba911504866695be698bb5ec49eac40d0f66a
github.comgithub.com/networkupstools/nut/commit/ecf98e7542e4ae2b62b211622ee26989274b2220
github.comgithub.com/networkupstools/nut/pull/3499
github.comgithub.com/networkupstools/nut/security/advisories/GHSA-mjgp-j4gm-6qg5
openwall.comopenwall.com/lists/oss-security/2026/07/01/10

Frequently asked

questions

It may be exploitable through a network path if an attacker can control the alarm value supplied to upsmon, for example through a malicious or compromised server or an on-path attacker on a plaintext connection. A compromised UPS device may also supply the value upstream; TLS does not prevent that scenario.

The attacker must be able to influence the alarm text, and the monitored device must report an ALARM state while the relevant notification configuration invokes NOTIFYCMD with EXEC.

Avoid passing constructed command strings to a shell. Prefer direct execution with fixed arguments, and tightly constrain and validate any externally sourced values used in notifications.

Treat network- and device-supplied text as untrusted, review shell invocation and data flows, and run monitoring components with least privilege.

Find out what's already
exploitable in your codebase.