Cobalt RaQ — 2 vulnerability checks

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

← All products · Feeds on GitHub

Sun Cobalt RaQ 4 SHP overflow.cgi remote command execution

CVECVE-2002-1361
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https, ssl, hosts2-ns
Detectionscript, http_request, match · highest QoD 70
Feedtests/vulnerabilities/cobalt-raq/CVE-2002-1361.yaml

Checks for overflow.cgi from the Sun Cobalt RaQ 4 Security Hardening Package, which stores its "email" parameter unfiltered in its configuration and later runs it through a shell as root, allowing unauthenticated remote command execution (CVE-2002-1361). The test requests /cgi-bin/.cobalt/overflow/overflow.cgi and expects an HTTP 200 page that mentions "overflow", while a random file name in the same directory must answer with another status (so catch-all servers are not reported). The exploit itself is never sent: it can only be triggered by overwriting the package's configuration, which would leave a command that runs again on every alert.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /cgi-bin/.cobalt/overflow/overflow.cgi
  3. HTTP(S) request GET /cgi-bin/.cobalt/overflow/{{ctl}}.cgi
  4. Parses / computes the next value with a Rhai script
  5. Checks verdict for ^COBALT_OVERFLOW_CGI$ → finding QoD 70: Sun Cobalt RaQ 4 SHP overflow.cgi present — CVE-2002-1361

References:

Feed source — tests/vulnerabilities/cobalt-raq/CVE-2002-1361.yaml
# Sun Cobalt RaQ 4 — SHP overflow.cgi remote command execution (CVE-2002-1361)
#
# Ported from OpenVAS/Greenbone NVT 2008/cobalt_overflow_cgi.nasl
# (OID 1.3.6.1.4.1.25623.1.0.80051, GPL-2.0-only).
#
# The RaQ 4 Security Hardening Package (SHP, optional add-on) installs
# /cgi-bin/.cobalt/overflow/overflow.cgi in the admin web server (port 81,
# or 444 over SSL). It writes the "email" form field into its config file
# without filtering, and overflowTestEmail.cgi later runs it through a shell
# as root (CERT CA-2002-35, VU#810921, BID 6326). Public exploit (EDB 22072,
# grazer): POST overflow.cgi "enabled=1&email=`<cmd>`&page=overflow", then
# GET overflowTestEmail.cgi. Sun's fix removes the SHP (and the CGI).
#
# The NASL only asks http_is_cgi_installed_ka() whether the CGI path exists.
#
# Why no exploitation proof: the only path to the shell is to OVERWRITE the
# SHP config (enable the feature and replace the admin's alert address with
# the payload). The injected command then stays in the config and runs again
# on every overflow alert, and the original address can't be restored
# reliably. That is a persistent change on a root-owned config, so the feed
# never sends the POST nor GETs overflowTestEmail.cgi (which also mails the
# configured address) and stays a presence check at QoD 70.
#
# Deviations from the NASL (fewer false positives):
#  - overflow.cgi must answer HTTP 200 (redirects not followed) with a body
#    that mentions "overflow" (the public exploit greps the raw reply for
#    the same word, without checking the status);
#  - a random sibling path in the same directory is requested as a control:
#    it must answer, with a status other than 200; a catch-all / soft-404
#    host (200 everywhere) or a control that gets no reply at all gives no
#    finding (fail-closed).
uid: de904b9b-6e84-4eef-ad27-8ddb844ddee3
name: "Sun Cobalt RaQ 4 SHP overflow.cgi remote command execution (CVE-2002-1361)"
description: |
  Checks for overflow.cgi from the Sun Cobalt RaQ 4 Security Hardening
  Package, which stores its "email" parameter unfiltered in its configuration
  and later runs it through a shell as root, allowing unauthenticated remote
  command execution (CVE-2002-1361). The test requests
  /cgi-bin/.cobalt/overflow/overflow.cgi and expects an HTTP 200 page that
  mentions "overflow", while a random file name in the same directory must answer
  with another status (so catch-all servers are not reported). The exploit itself
  is never sent: it can only be triggered by overwriting the package's
  configuration, which would leave a command that runs again on every alert.
cves: [CVE-2002-1361]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [cobalt, sun, raq, shp, cgi, command-injection, rce]
# The admin web server listens on 81 (nmap port name "hosts2-ns" when
# discovery ran without -sV) and 444 over SSL ("https" or "ssl" with -sV;
# its bare port name "snpp" would get plaintext, so it is not listed).
services: [http, https, ssl, hosts2-ns]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1361"
  - "https://www.kb.cert.org/vuls/id/810921"
  - "https://www.exploit-db.com/exploits/22072"

steps:
  # Random sibling name for the soft-404 control.
  - id: mint-control
    action: script
    code: '"noctis" + rand_hex(8)'
    store_as: ctl

  - id: probe-cgi
    action: http_request
    method: GET
    path: "/cgi-bin/.cobalt/overflow/overflow.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: probe-control
    action: http_request
    method: GET
    path: "/cgi-bin/.cobalt/overflow/{{ctl}}.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: control

  # Fixed verdict string as the match source, so no page content reaches the
  # finding. A failed request leaves its result undefined: no finding unless
  # both requests got an answer.
  - id: verdict
    action: script
    code: |
      let v = "";
      if is_def_var("page") && page.status == 200 && type_of(page.body) == "string"
         && page.body.to_lower().contains("overflow") {
        let ctl_ok = is_def_var("control") && control.status != 200;
        if ctl_ok { v = "COBALT_OVERFLOW_CGI"; }
      }
      v
    store_as: verdict

  - id: cgi-present
    action: match
    source: verdict
    pattern: '^COBALT_OVERFLOW_CGI$'
    on_match:
      finding:
        title: "Sun Cobalt RaQ 4 SHP overflow.cgi present — CVE-2002-1361"
        description: "/cgi-bin/.cobalt/overflow/overflow.cgi from the Sun Cobalt RaQ 4 Security Hardening Package answered HTTP 200, while a random file name in the same directory did not. This CGI stores its email parameter unfiltered and later runs it through a shell as root, allowing unauthenticated remote command execution (CVE-2002-1361). The exploit was not sent, because it overwrites the package's configuration."
        remediation: "Install Sun's SHP removal package (RaQ4-en-Security-2.0.1-SHP_REM.pkg), which removes overflow.cgi, and restrict the admin web server (ports 81/444) to trusted management hosts. The RaQ 4 is end-of-life: replace the appliance."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET /cgi-bin/.cobalt/overflow/overflow.cgi returned HTTP 200 mentioning \"overflow\"; control GET /cgi-bin/.cobalt/overflow/{{ctl}}.cgi did not return HTTP 200"
      stop: true

Cobalt RaQ cgiwrap cross-site script execution

CVECVE-1999-1530, CVE-2000-0431
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionscript, http_request, match · highest QoD 70
Feedtests/vulnerabilities/cobalt-raq/cgiwrap-cross-site-access.yaml

Checks for cgiwrap, the CGI wrapper that the Cobalt RaQ 2 and RaQ 3 server appliances shipped in a modified build. That build does not properly identify the user a script runs as, so the administrator of one hosted site can read or modify another site's files (CVE-1999-1530), and files uploaded through FrontPage let users bypass cgiwrap and modify files (CVE-2000-0431). The test requests /cgiwrap, /cgi-bin/cgiwrap, /scripts/cgiwrap and /cgiwrapDir/cgiwrap (the RaQ layout) without a user or script name and reports the first one that answers HTTP 200 with cgiwrap's own "CGIWrap Error" page, while a random file name in the same directory answers without that page (so servers returning the same page everywhere are not reported). Only read-only GET requests are sent. Standard cgiwrap builds are not affected by these flaws, so a finding on a non-Cobalt server should be confirmed.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script, for each of 4 values
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}cgiwrap
  5. HTTP(S) request GET {{dir}}{{ctl}}
  6. Parses / computes the next value with a Rhai script
  7. Checks verdict for ^CGIWRAP_PRESENT$ → finding QoD 70: cgiwrap installed (…cgiwrap) — Cobalt RaQ CVE-1999-1530 / CVE-2000-0431

References:

Feed source — tests/vulnerabilities/cobalt-raq/cgiwrap-cross-site-access.yaml
# Cobalt RaQ 2/3 cgiwrap — cross-site script execution (CVE-1999-1530, CVE-2000-0431)
#
# Ported from OpenVAS/Greenbone NVT pre2008/cgiwrap.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10041, GPL-2.0-only).
#
# The Cobalt RaQ 2/3 shipped a modified cgiwrap (/cgi-bin/cgiwrap) that does
# not properly identify the user a script runs as (CVE-1999-1530: an
# administrator of one virtual site can read or modify another site's data),
# and files uploaded through FrontPage get ownership/permissions that let a
# user bypass cgiwrap and modify files (CVE-2000-0431). Standard cgiwrap
# builds are not affected. NVD only scores both in CVSS v2 (3.6 and 7.5);
# the feed takes the higher one.
#
# CVE mapping: neither flaw can be proven remotely without a valid site
# account (1530 needs a site administrator, 0431 a FrontPage upload), and the
# NASL itself only asks http_is_cgi_installed_ka() whether "<dir>/cgiwrap"
# exists in "/", /cgi-bin and /scripts. The feed therefore stays a component
# presence check at QoD 70. It also probes /cgiwrapDir/, the ScriptAlias the
# RaQ uses for cgiwrap (cgiwrap doc/faq, "cgiwrapd on a Cobalt RaQ"), which
# the NASL misses.
#
# Better than the NASL (fewer false positives): instead of "the URL exists",
# the reply must be cgiwrap's own error page. Called with no user/script,
# every cgiwrap build answers through MSG_Error_General() (fetch.c,
# "Couldn't find user and script name, check your URL.", or "Error executing
# script" with CONF_QUIET_ERRORS) under the title "CGIWrap Error: ..."
# (msgs.c, MSG_HTML_Header / MSG_Plain_Header). A random sibling name in the
# same directory is requested as a control: it must answer and must NOT
# carry that title, so a honeypot or catch-all host that returns the same
# page everywhere is not reported (fail-closed when the control gets no
# reply).
uid: 7e6ea03b-8809-4834-b918-ab5a382cd1e2
name: "Cobalt RaQ cgiwrap cross-site script execution (CVE-1999-1530, CVE-2000-0431)"
description: |
  Checks for cgiwrap, the CGI wrapper that the Cobalt RaQ 2 and RaQ 3 server
  appliances shipped in a modified build. That build does not properly
  identify the user a script runs as, so the administrator of one hosted
  site can read or modify another site's files (CVE-1999-1530), and files
  uploaded through FrontPage let users bypass cgiwrap and modify files
  (CVE-2000-0431). The test requests /cgiwrap, /cgi-bin/cgiwrap,
  /scripts/cgiwrap and /cgiwrapDir/cgiwrap (the RaQ layout) without a
  user or script name and reports the first one that answers HTTP 200
  with cgiwrap's own "CGIWrap Error" page, while a random file name in
  the same directory answers without that page (so servers returning the
  same page everywhere are not reported). Only read-only GET requests are
  sent. Standard cgiwrap builds are not affected
  by these flaws, so a finding on a non-Cobalt server should be confirmed.
cves: [CVE-1999-1530, CVE-2000-0431]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [cobalt, sun, raq, cgiwrap, cgi]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-1999-1530"
  - "https://nvd.nist.gov/vuln/detail/CVE-2000-0431"
  - "https://github.com/cgiwrap/cgiwrap"

steps:
  # Random sibling name for the honeypot / catch-all control.
  - id: mint-control
    action: script
    code: '"noctis" + rand_hex(8)'
    store_as: ctl

  # One loop group per CGI directory: reset the stored results first, so a
  # request that fails leaves no value from the previous directory behind.
  - id: reset-page
    action: script
    code: '#{ status: 0, body: () }'
    store_as: page
    loop:
      over: ["/", "/cgi-bin/", "/scripts/", "/cgiwrapDir/"]
      var: dir

  - id: reset-control
    action: script
    code: '#{ status: 0, body: () }'
    store_as: control

  - id: probe-cgiwrap
    action: http_request
    method: GET
    path: "{{dir}}cgiwrap"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: probe-control
    action: http_request
    method: GET
    path: "{{dir}}{{ctl}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200"
    store_as: control

  # Fixed verdict string as the match source, so no page content reaches the
  # finding.
  - id: verdict
    action: script
    code: |
      let v = "";
      if page.status == 200 && type_of(page.body) == "string"
         && page.body.contains("CGIWrap Error") {
        let ctl_ok = control.status > 0
          && !(type_of(control.body) == "string" && control.body.contains("CGIWrap Error"));
        if ctl_ok { v = "CGIWRAP_PRESENT"; }
      }
      v
    store_as: verdict

  - id: cgiwrap-present
    action: match
    source: verdict
    pattern: '^CGIWRAP_PRESENT$'
    on_match:
      finding:
        title: "cgiwrap installed ({{dir}}cgiwrap) — Cobalt RaQ CVE-1999-1530 / CVE-2000-0431"
        description: "{{dir}}cgiwrap answered HTTP 200 with cgiwrap's own \"CGIWrap Error\" page, while a random file name in the same directory did not. The cgiwrap build shipped with the Cobalt RaQ 2 and RaQ 3 does not properly identify the user a script runs as, letting one hosted site's administrator read or modify another site's data (CVE-1999-1530), and lets FrontPage uploads bypass cgiwrap (CVE-2000-0431). Standard cgiwrap builds are not affected: confirm that the server is a Cobalt RaQ."
        remediation: "Apply Cobalt's cgiwrap security update for the RaQ 2/RaQ 3, or remove /cgi-bin/cgiwrap if virtual sites do not need it. The RaQ appliances are end-of-life: replace them."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET {{dir}}cgiwrap returned HTTP 200 with the \"CGIWrap Error\" page; control GET {{dir}}{{ctl}} answered without it"
      stop: true

View these feeds on GitHub