Cloudanix VulnDB

CVE-2021-25297

High · 8.8 CISA KEV

CVSS

8.8

EPSS

56.7%

Published

Feb 15, 2021

CISA due date

Feb 1, 2022

Cloudanix analysis

Act now SSVC: Attend

A logged-in attacker can potentially take over the monitoring server and use it to steal data, disable alerts, or reach other systems.

Active In The Wild
Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Remote Code Execution
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

CVE-2021-25297 is an authenticated OS command injection vulnerability in Nagios XI 5.7.5 in the Switch configuration wizard component at /usr/local/nagiosxi/html/includes/configwizards/switch/switch.inc.php. The vulnerable code fails to safely sanitize user-controlled HTTP input before using it in operating system command execution. Because the attack is network-reachable, low-complexity, requires only a valid Nagios XI login, and can execute commands on the Nagios XI server, successful exploitation can compromise confidentiality, integrity, and availability of the monitoring host and potentially the infrastructure credentials, configurations, and network visibility stored in Nagios XI.

Why it matters to the business

An attacker with any valid Nagios XI account can potentially take control of the monitoring server, steal monitoring credentials and configuration data, alter or disable monitoring, and use the trusted monitoring system as a pivot point into managed infrastructure. The vulnerability is listed in CISA KEV with a remediation due date of 2022-02-01 and is known to have been exploited in the wild; although no ransomware-specific KEV flag is present, the affected product is often highly privileged and broadly connected, making remediation urgent for any exposed or internally reachable Nagios XI deployment.

How an attack unfolds

An attacker first obtains authenticated access to Nagios XI, either through stolen credentials, password reuse, phishing, exploitation of another flaw, or abuse of a low-privileged account. The attacker then sends a crafted HTTP request to the Switch configuration wizard endpoint, placing shell metacharacters or command-substitution syntax into a vulnerable input field. The server-side PHP code passes that input into an operating system command without adequate escaping, causing the injected payload to run under the web server/Nagios XI execution context. From there, the attacker may enumerate the host, read Nagios XI configuration files, recover stored credentials or API keys, write web shells or scripts, establish a reverse shell, modify monitoring checks, suppress alerts, and pivot to monitored systems using credentials or network trust available to the Nagios server. Public exploitation has been observed, so incident responders should treat suspicious requests to the vulnerable wizard as potential compromise rather than simple probing.

How to fix it

Upgrade Nagios XI to a vendor-supported version that includes the fix for this issue; Nagios XI 5.7.5 should be considered vulnerable. Because no exact fixed version was provided in the input, use the latest available Nagios XI release from the vendor and verify that the Switch configuration wizard command injection fix is included in the release notes. If immediate upgrade is not possible, restrict access to Nagios XI to trusted administrative networks or VPNs, enforce MFA for Nagios XI accounts, remove unnecessary or low-trust user accounts, disable or restrict access to the Switch configuration wizard if operationally feasible, and monitor or block suspicious requests containing shell metacharacters to /nagiosxi/includes/configwizards/switch/switch.inc.php. Rotate credentials stored in or accessible from Nagios XI if exploitation is suspected, including monitoring, SNMP, SSH, Windows, database, and API credentials.

How to confirm the fix worked

Confirm the installed Nagios XI version is newer than the vulnerable 5.7.5 release and that vendor release notes identify a fix for the Switch configuration wizard command injection issue. Validate that the vulnerable file path either no longer contains unsafe command construction or has been patched by the vendor package. Test access controls to ensure Nagios XI and the Switch wizard are not reachable from untrusted networks. Review web server logs for requests to /nagiosxi/includes/configwizards/switch/switch.inc.php containing characters or encodings associated with command injection, such as semicolons, pipes, backticks, $(), %3b, %7c, %60, or %24%28. On Linux hosts, review process accounting, auditd, EDR, and shell history for unexpected child processes of httpd, apache2, php-fpm, or Nagios XI processes, especially shells, curl, wget, nc, bash, python, perl, or chmod activity. If exploitation is suspected, validate file integrity of Nagios XI web directories, plugins, cron locations, temporary directories, and recently modified executable files.

Typical attack path

  1. Acquire valid Nagios XI credentials or session access.
  2. Access the Nagios XI web interface over the network.
  3. Send a crafted request to the Switch configuration wizard endpoint with shell metacharacters or command-substitution content in a user-controlled parameter.
  4. Trigger vulnerable server-side code that invokes an operating system command using the unsanitized input.
  5. Execute arbitrary commands as the Nagios XI/web server process user.
  6. Drop tooling, establish persistence, create a reverse shell, or add a web-accessible payload.
  7. Read Nagios XI configuration, monitoring data, stored credentials, scripts, and plugins.
  8. Disable, alter, or blind monitoring and pivot toward systems monitored by Nagios XI.

How to detect it

Review HTTP access logs, reverse proxy logs, WAF events, Nagios XI audit logs, Linux auth logs, process execution telemetry, auditd logs, EDR telemetry, and file integrity monitoring data from Nagios XI servers. Focus on authenticated requests to the Switch configuration wizard endpoint and look for command-injection syntax in request bodies or query strings, including shell separators, pipes, backticks, command substitution, URL-encoded metacharacters, or payloads invoking curl, wget, bash, sh, nc, python, perl, chmod, chown, or base64. Correlate suspicious web requests with new child processes spawned by web server or PHP processes, unexpected outbound connections, reverse shell behavior, new or modified files under Nagios XI web/plugin directories, new cron jobs, unexplained Nagios XI configuration changes, disabled alerts, new users, and access to credential-bearing configuration files. Because this vulnerability has been exploited in the wild and is in CISA KEV, treat matching exploit traffic followed by process creation or file modification as a high-confidence compromise indicator.

  • /usr/local/nagiosxi/html/includes/configwizards/switch/switch.inc.php
  • /nagiosxi/includes/configwizards/switch/switch.inc.php
  • POST /nagiosxi/includes/configwizards/switch/switch.inc.php
  • GET /nagiosxi/includes/configwizards/switch/switch.inc.php
  • switch.inc.php
  • %3b
  • %7c
  • %60
  • %24%28
  • ;wget
  • ;curl
  • |wget
  • |curl
  • `wget
  • `curl
  • $(wget
  • $(curl
  • /bin/sh -c
  • /bin/bash -c
  • bash -i
  • nc -e
  • python -c
  • perl -e
  • /tmp/
  • /var/tmp/
  • /dev/shm/

What your security team should do

  • Immediately identify all Nagios XI deployments and prioritize any running version 5.7.5 or otherwise missing the vendor fix.
  • Upgrade Nagios XI to a currently supported fixed release; this vulnerability is in CISA KEV and the KEV remediation deadline has long passed.
  • Restrict Nagios XI administrative access to trusted networks and require MFA for all interactive users.
  • Review and remove unnecessary Nagios XI accounts, especially low-privileged accounts that do not need configuration wizard access.
  • Search historical web, authentication, process, EDR, and audit logs for exploitation attempts and successful command execution from the Nagios XI web process.
  • If suspicious activity is found, assume the Nagios XI server and stored monitoring credentials may be compromised; isolate the host, preserve forensic evidence, and rotate credentials accessible to Nagios XI.
  • Add SIEM detections for command-injection patterns targeting the Switch configuration wizard endpoint.
  • Harden the monitoring server by limiting outbound network access, restricting shell-capable utilities where possible, and monitoring changes to Nagios XI web, plugin, and cron directories.

The record

Nagios XI version xi-5.7.5 is affected by OS command injection. The vulnerability exists in the file /usr/local/nagiosxi/html/includes/configwizards/switch/switch.inc.php due to improper sanitization of authenticated user-controlled input by a single HTTP request, which can lead to OS command injection on the Nagios XI server.

Affected packages

Ecosystem Package Introduced Fixed