Jetspeed — 2 vulnerability checks
noctis ships 2 vulnerability checks for Jetspeed, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Apache Jetspeed User Manager REST Service Unauthenticated Access
| CVE | CVE-2016-2171 |
|---|---|
| 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/jetspeed/CVE-2016-2171.yaml |
Tests Apache Jetspeed 2.3.0 for the User Manager REST service that is not protected by Jetspeed Security. The feed sends an unauthenticated GET to services/usermanager/users/ (JSON, one record) under /jetspeed and the web root. A vulnerable portal answers HTTP 200 with its user table (a JSON object with recordsReturned, totalRecords and records), which shows that an anonymous client can list, and through the same service create, change or delete, portal accounts. A fixed portal answers 401 and is not reported. The request only reads; the finding gives the number of accounts, not their names.
How noctis detects it
- HTTP(S) request
GET {{dir}}/services/usermanager/users/?_type=json&results=1&start=0 - Parses / computes the next value with a Rhai script
- Checks
um.placeholderfor^usermanager-users-listed$→ finding QoD 75: Apache Jetspeed User Manager REST Service Unauthenticated Access (CVE-2016-2171)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-2171
- https://portals.apache.org/jetspeed-2/security-reports.html
- https://www.mail-archive.com/jetspeed-user@portals.apache.org/msg10558.html
Feed source — tests/vulnerabilities/jetspeed/CVE-2016-2171.yaml
# Apache Jetspeed User Manager REST service open to anonymous users —
# CVE-2016-2171
#
# Jetspeed 2.3.0 exposes the User Manager JAX-RS service under
# /jetspeed/services/usermanager/ (list, read, create, update and delete
# users) without enforcing Jetspeed Security: an anonymous client can list
# every portal account, and add, edit or delete users. Jetspeed 2.3.1 requires
# administrative rights and answers 401 "Insufficient privilege to access this
# REST service" (AbstractRestService.checkPrivilege).
#
# Detection (benign, read-only): an unauthenticated
# GET <dir>/services/usermanager/users/?_type=json&results=1&start=0
# on /jetspeed and the web root. The finding requires HTTP 200 and the
# service's own JSON user table (a JSON object with recordsReturned,
# totalRecords and records, as serialized from UserDataTableBean). Nothing is
# created, changed or deleted; only one record is asked for, and no user name
# reaches the finding — the match runs on a fixed placeholder and the evidence
# gives the number of accounts. QoD 75.
#
# This check is not in the source NASL (which only probes the URI-path XSS,
# CVE-2016-0712, see CVE-2016-0712.yaml): it proves the access-control flaw
# directly instead of inferring it from the XSS. The same request with a
# crafted "roles" parameter is the SQL injection CVE-2016-0710; it is not sent.
#
# Related advisory set tracked in noctis issue #1219, from the OpenVAS/Greenbone
# NVT 2016/gb_apache_jetspeed_mult_vuln.nasl (GPL-2.0-only).
uid: c7f4d69e-03e8-43b8-8945-e453104c56c5
name: "Apache Jetspeed User Manager REST Service Unauthenticated Access (CVE-2016-2171)"
description: |
Tests Apache Jetspeed 2.3.0 for the User Manager REST service that is not
protected by Jetspeed Security. The feed sends an unauthenticated GET to
services/usermanager/users/ (JSON, one record) under /jetspeed and the web
root. A vulnerable portal answers HTTP 200 with its user table (a JSON
object with recordsReturned, totalRecords and records), which shows that an
anonymous client can list, and through the same service create, change or
delete, portal accounts. A fixed portal answers 401 and is not reported.
The request only reads; the finding gives the number of accounts, not
their names.
cves: [CVE-2016-2171]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [apache, jetspeed, portal, rest-api, auth-bypass, missing-authorization, java]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-2171"
- "https://portals.apache.org/jetspeed-2/security-reports.html"
- "https://www.mail-archive.com/jetspeed-user@portals.apache.org/msg10558.html"
steps:
# ── Loop group: every following step runs once per install dir. Each pass
# resets the values it reads, so nothing is left over from the previous dir.
- id: init-users-r
action: set_var
var_name: users_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/jetspeed", ""]
- id: probe
action: http_request
method: GET
path: "{{dir}}/services/usermanager/users/?_type=json&results=1&start=0"
port: "{{port}}"
headers:
Accept: "application/json"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: users_r
# The service's JSON user table: an object with the three UserDataTableBean
# fields. Only the account count and a fixed placeholder leave this step.
- id: parse
action: script
code: |
let out = #{ open: false, total: "", placeholder: "" };
if users_r.status == 200 && type_of(users_r.body) == "string" {
let b = users_r.body;
let m = eregmatch("\"totalRecords\"\\s*:\\s*([0-9]+)", b);
if ereg("^\\x{FEFF}?\\s*\\{", b) && m.len() > 1
&& ereg("\"recordsReturned\"\\s*:\\s*[0-9]", b)
&& ereg("\"records\"\\s*:\\s*\\[", b) {
out.open = true;
out.total = m[1];
out.placeholder = "usermanager-users-listed";
}
}
out
store_as: um
- id: report
action: match
condition: "um.open == true"
source: um.placeholder
pattern: "^usermanager-users-listed$"
on_match:
finding:
title: "Apache Jetspeed User Manager REST Service Unauthenticated Access (CVE-2016-2171)"
description: "The Jetspeed User Manager REST service answered an unauthenticated request with the portal's user table. The service is not protected by Jetspeed Security (Jetspeed 2.3.0), so an anonymous attacker can list, create, modify and delete portal accounts, including administrators, and reach the SQL injection in its search parameters (CVE-2016-0710)."
remediation: "Upgrade Apache Jetspeed to 2.3.1 or later, which requires administrative rights on the REST services. Until then, block /jetspeed/services/ at the reverse proxy. Jetspeed has been retired by Apache: plan a migration to a maintained portal."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/services/usermanager/users/?_type=json&results=1&start=0 without credentials returned HTTP 200 with the JSON user table (totalRecords: {{um.total}}; user names withheld)"
stop: trueApache Jetspeed Portal URI Path Reflected XSS
| CVE | CVE-2016-0712 |
|---|---|
| Severity | medium · CVSS 6.1 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/jetspeed/CVE-2016-0712.yaml |
Tests Apache Jetspeed for the reflected cross-site scripting in the portal URI path (Jetspeed 2.2.0 to 2.2.2 and 2.3.0). The feed requests a portal page whose path is a random marker followed by "onmouseover="alert(document.cookie), under /jetspeed and the web root. A vulnerable portal copies the path unescaped into the href of its portlet action links, so the double quote closes the attribute and adds an event handler: the finding requires the marker, the closing quote and the handler verbatim inside an attribute of a Jetspeed page. A fixed portal removes the quotes from the path and is not reported. The request only renders a portal page and changes nothing on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/portal/{{tok}}%22onmouseover%3d%22alert%28document.cookie%29?URL=foo/bar - Parses / computes the next value with a Rhai script
- Checks
xss_prooffor^noctis[0-9a-f]{12}"onmouseover="alert\(document\.cookie\)$→ finding QoD 75: Apache Jetspeed Portal URI Path Reflected XSS (CVE-2016-0712)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-0712
- https://portals.apache.org/jetspeed-2/security-reports.html
Feed source — tests/vulnerabilities/jetspeed/CVE-2016-0712.yaml
# Apache Jetspeed reflected XSS in the portal URI path — CVE-2016-0712
#
# Jetspeed 2.2.0–2.2.2 and 2.3.0 (and probably the unsupported 2.1.x) copy
# the page path that follows /portal unescaped into the URLs of the portlet
# action links (Minimize / Maximize ...), inside a double-quoted href. A path
# such as foo"onmouseover="alert(document.cookie) closes the attribute and
# adds an event handler. Jetspeed 2.3.1 fixes it in
# AbstractPortalURL.setPath(), which now drops every ' and " from the path
# (path.replaceAll("['\"]", "")), so the same request is reflected as
# fooonmouseover=alert(document.cookie), still inside the attribute.
#
# Detection (benign, read-only): GET <dir>/portal/<marker>%22onmouseover%3d
# %22alert%28document.cookie%29?URL=foo/bar on /jetspeed and the web root,
# where <marker> is random per scan, and require a reply that mentions
# Jetspeed and holds ="...<marker>"onmouseover="alert(document.cookie)
# verbatim: the marker inside a double-quoted attribute value, followed by
# the double quote that closes it and the injected handler. The "Jetspeed"
# check ignores the copies of the probed /jetspeed/portal/ path, so a page
# that merely echoes the request URL is not reported as Jetspeed. QoD 75.
#
# Improvements over the source NASL:
# - The NASL only greps for "alert(document.cookie)", which Jetspeed 2.3.1
# still prints (quotes stripped, text kept), so it reports fixed portals.
# This feed requires the quotes that break out of the attribute.
# - A random marker per scan, so a page that always prints the payload is
# not reported.
# - The NASL needs its Jetspeed product detection for the install dir; this
# feed tries /jetspeed and the web root directly.
#
# The other CVEs of the March 2016 advisory set are not covered here:
# CVE-2016-2171 (unauthenticated User Manager REST service) has its own feed
# (CVE-2016-2171.yaml); CVE-2016-0709 (Import/Export ZIP traversal) and
# CVE-2016-0711 (stored XSS in link/page/folder titles) need an administrator
# session, and CVE-2016-0710 (SQL injection in the same REST service) is only
# reachable through the CVE-2016-2171 flaw.
#
# Ported from OpenVAS/Greenbone NVT 2016/gb_apache_jetspeed_mult_vuln.nasl
# (GPL-2.0-only). Fixed code read from the jetspeed-portal 2.3.0 vs 2.3.1 jars
# of the Apache release installers (archive.apache.org/dist/portals/jetspeed-2).
uid: 002e46de-47f6-43e0-8d87-5ac1adc0258f
name: "Apache Jetspeed Portal URI Path Reflected XSS (CVE-2016-0712)"
description: |
Tests Apache Jetspeed for the reflected cross-site scripting in the portal
URI path (Jetspeed 2.2.0 to 2.2.2 and 2.3.0). The feed requests a portal
page whose path is a random marker followed by
"onmouseover="alert(document.cookie), under /jetspeed and the web root. A
vulnerable portal copies the path unescaped into the href of its portlet
action links, so the double quote closes the attribute and adds an event
handler: the finding requires the marker, the closing quote and the handler
verbatim inside an attribute of a Jetspeed page. A fixed portal removes the
quotes from the path and is not reported. The request only renders a portal
page and changes nothing on the server.
cves: [CVE-2016-0712]
cvss: 6.1
severity: medium
category: xss
confidence_base: 0.30
tags: [apache, jetspeed, portal, xss, java]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-0712"
- "https://portals.apache.org/jetspeed-2/security-reports.html"
# OpenVAS/Greenbone NASL 2016/gb_apache_jetspeed_mult_vuln.nasl (GPL-2.0-only)
steps:
# Random marker for this scan (letters and hex digits only).
- id: marker
action: script
code: |
"noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
store_as: tok
# ── Loop group: every following step runs once per install dir. Each pass
# resets the values it reads, so nothing is left over from the previous dir.
- id: init-probe-r
action: set_var
var_name: probe_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/jetspeed", ""]
- id: probe
action: http_request
method: GET
path: "{{dir}}/portal/{{tok}}%22onmouseover%3d%22alert%28document.cookie%29?URL=foo/bar"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe_r
# The injected handler right after a double-quoted attribute value that
# holds this scan's marker, on a Jetspeed page — or "".
- id: reflection
action: script
code: |
let out = "";
if probe_r.status == 200 && type_of(probe_r.body) == "string" {
let b = probe_r.body;
// Product check outside the reflection: the probed path holds
// "/jetspeed/portal/", so drop every copy of it before looking for
// "jetspeed" (a generic URL echo must not pass as Jetspeed).
let rest = ereg_replace("(?i)/jetspeed/portal/", "", b);
if tolower(rest).contains("jetspeed") {
let want = tok + "\"onmouseover=\"alert(document.cookie)";
if ereg("=[ \\t]*\"[^\"<>]*" + tok + "\"onmouseover=\"alert\\(document\\.cookie\\)", b) {
out = want;
}
}
}
out
store_as: xss_proof
- id: report
action: match
source: xss_proof
pattern: '^noctis[0-9a-f]{12}"onmouseover="alert\(document\.cookie\)$'
on_match:
finding:
title: "Apache Jetspeed Portal URI Path Reflected XSS (CVE-2016-0712)"
description: "A portal page requested with a path ending in a double quote and an onmouseover handler was rendered with that path copied unescaped into a double-quoted link attribute, so the quote closes the attribute and the handler is added to the link. An attacker can send a crafted link that runs script in the victim's portal session."
remediation: "Upgrade Apache Jetspeed to 2.3.1 or later. Jetspeed has been retired by Apache: plan a migration to a maintained portal."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/portal/<marker>%22onmouseover%3d%22alert%28document.cookie%29 returned HTTP 200 with a Jetspeed page containing the attribute breakout: {{xss_proof}}"
stop: true