Oracle Reports — 2 vulnerability checks

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

← All products · Feeds on GitHub

Oracle Reports rwservlet Unauthenticated Diagnostic Exposure

CVECVE-2012-3152
Severitycritical · CVSS 9.1
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/oracle-reports/CVE-2012-3152.yaml

The target's Oracle Reports rwservlet exposes the SHOWENV diagnostic command without authentication, disclosing the Reports Servlet environment (ORACLE_HOME, REPORTS_PATH and other server configuration). The same unauthenticated command access is the precondition abused by public exploits to read arbitrary files from the host (CVE-2012-3152). The check requests the diagnostic page only and matches on the genuine environment-disclosure signature; it does not read any target file.

How noctis detects it

  1. HTTP(S) request GET /reports/rwservlet/showenv
  2. Checks env_resp.body for (?is)reports?[ _-]?serv(let|er).{0,400}?(ORACLE_HOME|REPORTS_PATH|REP… → finding QoD 75: Oracle Reports rwservlet Unauthenticated Diagnostic Exposure (CVE-2012-3152)

References:

Feed source — tests/vulnerabilities/oracle-reports/CVE-2012-3152.yaml
# Oracle Reports rwservlet unauthenticated diagnostic/file-read exposure
# (CVE-2012-3152).
#
# Oracle Fusion Middleware Reports Developer / Reports Services expose the
# rwservlet "SHOWENV" diagnostic command without authentication. A vulnerable
# install answers GET /reports/rwservlet/showenv with the Reports Servlet
# environment dump — ORACLE_HOME, REPORTS_PATH, REPORTS_TMP and the rest of the
# server configuration. That same unauthenticated access to the servlet command
# set is what the public PoC (pwnacle-fusion) and the Metasploit module abuse to
# read arbitrary files off the host (desname=<path>&destype=file), so the open
# diagnostic command is the detectable, reproducible precondition of the file
# read.
#
# Detection (no exploitation): we only request the SHOWENV diagnostic page and
# key on the genuine Reports Servlet environment disclosure structure that a
# vulnerable server returns. We never read a target file. A hardened / patched
# server rejects the command (401/403) or does not expose it (404), so the
# match fails and nothing is reported.
#
# QoD 75 — response analysis of the unauthenticated diagnostic disclosure.
#
# Source: ProjectDiscovery Nuclei http/cves/2012/CVE-2012-3152.yaml + the
# Metasploit auxiliary module and the pwnacle-fusion PoC.
uid: e42f3de7-4253-4161-8159-c1c11943b12b
name: "Oracle Reports rwservlet Unauthenticated Diagnostic Exposure (CVE-2012-3152)"
description: |
  The target's Oracle Reports rwservlet exposes the SHOWENV diagnostic command
  without authentication, disclosing the Reports Servlet environment
  (ORACLE_HOME, REPORTS_PATH and other server configuration). The same
  unauthenticated command access is the precondition abused by public exploits
  to read arbitrary files from the host (CVE-2012-3152). The check requests the
  diagnostic page only and matches on the genuine environment-disclosure
  signature; it does not read any target file.
cves: [CVE-2012-3152]
cvss: 9.1
severity: critical
category: exposure
confidence_base: 0.25
tags: [oracle, oracle-reports, fusion-middleware, rwservlet, file-read, exposure, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-3152"
  - "https://github.com/Mekanismen/pwnacle-fusion"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2012/CVE-2012-3152.yaml"
  - "https://www.rapid7.com/db/?q=CVE-2012-3152"

steps:
  # Seed the gate var so the match-step condition never reads an undefined
  # Rhai var (which throws and silently skips the step).
  - id: init-exposed
    action: set_var
    var_name: showenv_exposed
    var_value: false

  # Request the unauthenticated rwservlet SHOWENV diagnostic command. Standard
  # GET with no encoded path, so http_request / resp.body is correct here.
  # port: "{{port}}" is mandatory — without it the request hits 80/443 and the
  # dynamically allocated test port is ignored.
  - id: showenv-probe
    action: http_request
    method: GET
    path: "/reports/rwservlet/showenv"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    store_as: env_resp

  # Match on the genuine Reports Servlet environment disclosure: a vulnerable
  # server returns HTTP 200 with the Reports Servlet environment dump listing
  # the Oracle Reports server configuration variables. A patched/hardened
  # server answers 401/403/404, so this match fails and no finding is produced.
  - id: showenv-match
    action: match
    condition: "env_resp.status == 200"
    source: env_resp.body
    pattern: "(?is)reports?[ _-]?serv(let|er).{0,400}?(ORACLE_HOME|REPORTS_PATH|REPORTS_TMP|REPORTS_SERVER)"
    on_match:
      finding:
        title: "Oracle Reports rwservlet Unauthenticated Diagnostic Exposure (CVE-2012-3152)"
        description: "The Oracle Reports rwservlet SHOWENV diagnostic command is reachable without authentication and discloses the Reports Servlet environment (server configuration). This unauthenticated command access is the precondition abused to read arbitrary files from the host."
        remediation: "Apply the Oracle Critical Patch Update for CVE-2012-3152 and restrict rwservlet diagnostic commands (SHOWENV/SHOWJOBS/GETSERVERINFO) via the reports configuration (rwservlet.properties: webcommandaccess / diagnostic) so they require authentication or are disabled."
        confidence_delta: 0.45
        qod: 75
        evidence: "rwservlet SHOWENV disclosed the Reports Servlet environment: {{env_resp.body}}"
      set_vars:
        showenv_exposed: true

Oracle Reports rwservlet PARSEQUERY Database Credential Disclosure

CVECVE-2012-3153
Severitymedium · CVSS 6.4
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/oracle-reports/CVE-2012-3153.yaml

Oracle Fusion Middleware Reports exposes the undocumented rwservlet SHOWMAP and PARSEQUERY commands without authentication. SHOWMAP lists the cgicmd.dat key maps and PARSEQUERY expands a key map into its full report query, disclosing the userid=<user>/<password>@<database> credentials it carries. The check lists the key maps and expands them until one discloses a database credential; the password itself is not recorded in the finding.

How noctis detects it

  1. HTTP(S) request GET /reports/rwservlet/showmap
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /reports/rwservlet/parsequery?{{cur_key}}
  5. Parses / computes the next value with a Rhai script
  6. Checks cred.summary for ^parsequery\?.+ disclosed userid= → finding QoD 75: Oracle Reports rwservlet PARSEQUERY Database Credential Disclosure (CVE-2012-3153)

References:

Feed source — tests/vulnerabilities/oracle-reports/CVE-2012-3153.yaml
# Oracle Reports rwservlet PARSEQUERY key-map database credential disclosure
# (CVE-2012-3153).
#
# Ported from OpenVAS/Greenbone NASL 2014/gb_oracle_parsequery_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103974, GPL-2.0-only).
#
# Oracle Fusion Middleware Reports (11.1.1.4, 11.1.1.6, 11.1.2.0) answer two
# undocumented rwservlet commands without authentication:
#   1. GET /reports/rwservlet/showmap          lists every cgicmd.dat key map,
#      one <SPAN class=OraInstructionText>key</SPAN> per entry;
#   2. GET /reports/rwservlet/parsequery?<key> expands that key map into the full
#      report query — including any userid=<user>/<password>@<db> it carries, i.e.
#      the database credentials the reports run with.
#
# Exploitation proof (read-only): like the NASL we list the key maps, then expand
# them one by one through PARSEQUERY and report only when a key map actually
# discloses a userid=<user>/<password>@<db> credential. That is the real bug
# exercised, not a version or endpoint fingerprint. Nothing is written and no
# report is run. The password is never put in the finding: the evidence carries
# the key map name, the database user and the connect string only.
#
# Deviations from the NASL (fewer false positives):
#   - the NASL's `userid=(.*)@` also fires on a key map with no password
#     (userid=scott@orcl) or a %VAR% / $var placeholder; we require a real
#     password between "/" and the last "@", i.e. a credential actually disclosed;
#   - key map names are parsed from every OraInstructionText span, not only
#     from lines that egrep matched, and are restricted to key-map characters
#     before being put in the URL.
#
# QoD 75 — response analysis of the disclosed credential.
uid: 3a48dd58-f38d-458f-972d-cabb6c5f04b3
name: "Oracle Reports rwservlet PARSEQUERY Database Credential Disclosure (CVE-2012-3153)"
description: |
  Oracle Fusion Middleware Reports exposes the undocumented rwservlet SHOWMAP and
  PARSEQUERY commands without authentication. SHOWMAP lists the cgicmd.dat key
  maps and PARSEQUERY expands a key map into its full report query, disclosing
  the userid=<user>/<password>@<database> credentials it carries. The check lists
  the key maps and expands them until one discloses a database credential; the
  password itself is not recorded in the finding.
cves: [CVE-2012-3153]
cvss: 6.4
severity: medium
category: exposure
confidence_base: 0.30
tags: [oracle, oracle-reports, fusion-middleware, rwservlet, credential-disclosure, exposure]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-3153"
  - "https://www.oracle.com/security-alerts/cpuoct2012.html"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2012/CVE-2012-3153.yaml"
  - "OpenVAS/Greenbone NASL 2014/gb_oracle_parsequery_vuln.nasl (GPL-2.0-only)"

steps:
  # Pre-initialise every result a script reads: an undefined var in a script
  # aborts the whole test.
  - id: init-showmap
    action: set_var
    var_name: map_resp
    var_value: {status: 0, body: ""}

  - id: showmap
    action: http_request
    method: GET
    path: "/reports/rwservlet/showmap"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: map_resp

  # Extract the key map names (at most 10, de-duplicated). Each one sits right
  # after a "<SPAN class=OraInstructionText>" tag; only key-map characters are
  # kept so the name is safe to put in the PARSEQUERY URL.
  - id: parse-keymaps
    action: script
    code: |
      let keys = [];
      if map_resp.status == 200 && type_of(map_resp.body) == "string" {
        let parts = split(map_resp.body, "OraInstructionText>");
        let i = 1;
        while i < parts.len() && keys.len() < 10 {
          let m = eregmatch("^\\s*([A-Za-z0-9_.$-]+)\\s*</SPAN>", parts[i], true);
          if m.len() > 1 && !keys.contains(m[1]) {
            keys.push(m[1]);
          }
          i += 1;
        }
      }
      keys
    store_as: keymaps

  # Expand each key map through PARSEQUERY until one discloses a credential.
  # The loop runs this step and the three following ones once per index.
  - id: pick-keymap
    action: script
    loop:
      count: 10
      var: km_idx
    code: |
      if km_idx < keymaps.len() { keymaps[km_idx] } else { "" }
    store_as: cur_key

  - id: reset-pq
    action: set_var
    var_name: pq_resp
    var_value: {status: 0, body: ""}

  - id: parsequery
    action: http_request
    condition: "cur_key != \"\""
    method: GET
    path: "/reports/rwservlet/parsequery?{{cur_key}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: pq_resp

  # A disclosed credential is userid=<user>/<password>@<db> with a non-empty,
  # non-placeholder password. Only the user and the connect string leave this step.
  - id: extract-cred
    action: script
    code: |
      let r = #{ hit: false, summary: "" };
      if pq_resp.status == 200 && type_of(pq_resp.body) == "string" {
        // Greedy password: a password containing "@" backtracks to the last "@",
        // so no part of it can end up in the connect string (group 3).
        let m = eregmatch("userid=([^/\\s@<>\"'&]+)/([^\\s<>\"']+)@([^\\s<>\"'&@]+)", pq_resp.body, true);
        // A %VAR% / $var placeholder is not a disclosed password.
        if m.len() > 3 && !ereg("^[%$]", m[2]) {
          r.hit = true;
          r.summary = "parsequery?" + cur_key + " disclosed userid=" + m[1] + "/<password>@" + m[3];
        }
      }
      r
    store_as: cred

  - id: report-cred
    action: match
    condition: "cred.hit == true"
    source: cred.summary
    pattern: "^parsequery\\?.+ disclosed userid="
    on_match:
      stop: true
      finding:
        title: "Oracle Reports rwservlet PARSEQUERY Database Credential Disclosure (CVE-2012-3153)"
        description: "The Oracle Reports rwservlet SHOWMAP and PARSEQUERY commands are reachable without authentication. SHOWMAP listed the cgicmd.dat key maps and PARSEQUERY expanded one of them into its report query, disclosing the database user, password and connect string it carries."
        remediation: "Apply the Oracle Critical Patch Update of October 2012 (CVE-2012-3153), disable or restrict the rwservlet diagnostic commands (rwservlet.properties: <webcommandaccess>L2</webcommandaccess>, DIAGNOSTIC=NO), remove database credentials from cgicmd.dat key maps, and change the disclosed database password."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{cred.summary}} (password withheld)"

View these feeds on GitHub