Oracle JSP — 1 vulnerability check

noctis ships 1 vulnerability check for Oracle JSP; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Oracle JSP on Apache JServ path translation — JSP execution outside doc_root

Severityhigh
Categoryrce — Remote code execution
Serviceshttp, https
Detectiontcp_connect, script, match · highest QoD 70
Feedtests/vulnerabilities/oracle-jsp/oracle-jsp-jserv-path-translation.yaml

Oracle JSP (OJSP) 1.0.x to 1.1.1, as shipped with Oracle8i Release 8.1.7 and Oracle iAS Release 1.0.2 on Apache/JServ for Windows NT, translates request paths containing `//..` wrongly: a request such as `/a.jsp//..//..//..//..//..//../b.jsp` makes the server compile and run `b.jsp` from outside the web document root instead of `a.jsp`. An unauthenticated attacker can thus execute JSP pages that were never meant to be published. The fix is Oracle JSP 1.1.2.0.0.

The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS services), reads the `Server:` response header and reports the host when it advertises Apache JServ 1.0.x, 1.1, 1.1.0 or 1.1.1 (the JServ releases the affected Oracle JSP versions were commonly shipped with). Apache JServ 1.1.2 is not reported, nor is a server whose Apache OS token names a system other than Windows (for example `(Unix)`), since the flaw was only reported on Windows NT.

This is a version check: proving the flaw would require a JSP file already present outside the document root at a known place, which a scanner cannot know, so no such request is sent. Only the response headers of the home page are read. The installed Oracle JSP release is not visible in the header, so a host already upgraded to Oracle JSP 1.1.2.0.0 on an older JServ is still reported.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET / HTTP/1.0
  2. Parses / computes the next value with a Rhai script
  3. Checks ver.version for ^1\. → finding QoD 70: Server header '…': Apache JServ … is in the range used by Oracle JSP 1.1.1 and older (JSP execution outside doc_root via /a.jsp//..//../b.j…

References:

Feed source — tests/vulnerabilities/oracle-jsp/oracle-jsp-jserv-path-translation.yaml
# Ported from OpenVAS/Greenbone NASL pre2008/jserv_execute.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10925, GPL-2.0-only), which reports
# `.*apachejserv/1\.(0|1\.[01][^0-9])` (case-insensitive) in the response headers.
#
# No CVE: the NASL (and the backlog issue) cite CVE-2001-0307, but that NVD record
# is a Bajie HTTP JServer CGI command injection, another product entirely. The
# Oracle alert (Bugtraq, 12 Feb 2001, credit Georgi Guninski) has no CVE, and the
# Nessus plugin of the same name lists none. So `cves: []` and no `cvss:`.
#
# Better than the NASL:
# - The NASL's regex misses `ApacheJServ/1.1` with no third digit, which is the
#   exact banner of the affected Oracle iAS 1.0.2 / 8.1.7 HTTP Server
#   (`Oracle HTTP Server Powered by Apache/1.3.12 (Win32) ApacheJServ/1.1 ...`),
#   and `1.1b*` betas. Here: 1.0*, 1.1, 1.1b*, 1.1.0, 1.1.1; not 1.1.2.
# - The Oracle alert lists Windows NT as the only affected platform: a Server
#   header whose Apache OS token names another system (Unix, Linux, BSD…) is
#   not reported. A header without an OS token, or with Win32, is.
# - Only Server: lines of the header block are searched (a JServ string in the
#   body or another header is ignored), raw tcp_connect, HTTPS covered too.
#
# No benign proof: the bug executes a JSP file that already sits outside the
# document root (`/a.jsp//..//..//b.jsp`), and no such file is known on a
# target; planting one is not an option. Guninski #36 also reads files with the
# same `//..` path (`/a.jsp//..//../winnt/win.ini`), but the server answers with
# an error and the content only lands in a translated .java under /_pages
# (written on the target), so it gives no in-band proof. Version check at QoD 70.
uid: 5aa5287b-dbeb-4061-9215-65897281316d
name: "Oracle JSP on Apache JServ path translation — JSP execution outside doc_root"
description: |
  Oracle JSP (OJSP) 1.0.x to 1.1.1, as shipped with Oracle8i Release 8.1.7 and
  Oracle iAS Release 1.0.2 on Apache/JServ for Windows NT, translates request
  paths containing `//..` wrongly: a request such as
  `/a.jsp//..//..//..//..//..//../b.jsp` makes the server compile and run
  `b.jsp` from outside the web document root instead of `a.jsp`. An
  unauthenticated attacker can thus execute JSP pages that were never meant to
  be published. The fix is Oracle JSP 1.1.2.0.0.

  The test sends one plain `GET / HTTP/1.0` request (over TLS on HTTPS
  services), reads the `Server:` response header and reports the host when it
  advertises Apache JServ 1.0.x, 1.1, 1.1.0 or 1.1.1 (the JServ releases the
  affected Oracle JSP versions were commonly shipped with). Apache JServ 1.1.2 is not reported,
  nor is a server whose Apache OS token names a system other than Windows (for
  example `(Unix)`), since the flaw was only reported on Windows NT.

  This is a version check: proving the flaw would require a JSP file already
  present outside the document root at a known place, which a scanner cannot
  know, so no such request is sent. Only the response headers of the home page
  are read. The installed Oracle JSP release is not visible in the header, so a
  host already upgraded to Oracle JSP 1.1.2.0.0 on an older JServ is still
  reported.
category: rce
cves: []
severity: high
confidence_base: 0.30
tags: [oracle, oracle-jsp, apache-jserv, oracle-ias, path-traversal, windows, version-check, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://diswww.mit.edu/menelaus/bt/19162"
  - "https://seclists.org/bugtraq/2001/Feb/251"
  - "https://kb.cert.org/vuls/id/278971"
  - "https://www.guninski.com/orajsp.html"
  - "https://www.tenable.com/plugins/nessus/10925"

steps:
  # 1 — one plain request; only its response headers are used.
  - id: probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET / HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: resp

  # 2 — look for ApacheJServ/<affected version> in every Server: header line.
  - id: version
    action: script
    store_as: ver
    code: |
      let out = #{ vulnerable: false, version: "", server: "" };
      if type_of(resp.banner) == "string" {
        let head = resp.banner;
        let cut = stridx(head, "\r\n\r\n");
        if cut < 0 { cut = stridx(head, "\n\n"); }
        if cut >= 0 { head = substr(head, 0, cut); }
        for raw in split(head, "\n") {
          let line = eregmatch("^server:[ \\t]*([^\\r]*)", raw, true);
          if line.len() < 2 { continue; }
          let m = eregmatch("ApacheJServ/(1\\.0[^ ]*|1\\.1b[^ ]*|1\\.1(?:\\.[01])?)([^0-9.]|$)", line[1], true);
          if m.len() < 2 { continue; }
          // Apache OS token, e.g. "Apache/1.3.12 (Win32)": skip non-Windows systems.
          let os = eregmatch("Apache/[0-9][^ ]*[ ]+\\(([^)]*)\\)", line[1], true);
          if os.len() >= 2 && ereg("^win", os[1], true) == false { continue; }
          out.vulnerable = true;
          out.version = m[1];
          out.server = line[1];
          break;
        }
      }
      out

  - id: vulnerable_version
    action: match
    condition: "ver.vulnerable == true"
    source: ver.version
    pattern: "^1\\."
    on_match:
      stop: true
      finding:
        confidence_delta: 0.45
        qod: 70
        evidence: "Server header '{{ver.server}}': Apache JServ {{ver.version}} is in the range used by Oracle JSP 1.1.1 and older (JSP execution outside doc_root via /a.jsp//..//../b.jsp; not sent)."
        remediation: "Upgrade Oracle JSP to release 1.1.2.0.0 or later (or move to a supported Oracle HTTP Server), and do not keep JSP files outside the document root on the web server host."

View these feeds on GitHub