eliteCMS — 1 vulnerability check
noctis ships 1 vulnerability check for eliteCMS, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
eliteCMS index.php 'page' SQL Injection
| CVE | CVE-2008-4046 |
|---|---|
| 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/elitecms/CVE-2008-4046.yaml |
Tests eliteCMS 1.0 and 1.01 for the unauthenticated SQL injection through the page parameter of index.php, which is pasted between single quotes into the page lookup query. In the web root and in the /cms, /elite and /elitecms directories, once the admin login page or the site footer identifies eliteCMS, the feed requests index.php with a page value that closes the quote and makes the database raise an XPath error carrying the product of two random numbers, which the application prints in its "Database Query failed" page. The correct product in the page confirms that the database ran the injected SQL; the product is not part of the request, so a page that only echoes the URL is not reported. The same value without the leading quote is sent as well, for installs that paste the parameter unquoted. On databases without the EXTRACTVALUE function, the feed falls back to a single quote followed by a random marker: a SQL syntax error quoting that marker, while the same value without the quote gives no SQL error, shows that the quote reaches the query unescaped. The probes read no table row and change 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}}/admin/login.php - HTTP(S) request
GET {{dir}}/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?page=-1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20A… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?page=-1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}})) - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?page=-1%27{{m.tok}} - HTTP(S) request
GET {{dir}}/index.php?page=-1{{m.tok}} - Parses / computes the next value with a Rhai script
- Checks
prooffor^XPATH syntax error: ~[0-9]+$→ finding QoD 97: eliteCMS index.php 'page' SQL Injection (CVE-2008-4046) - Checks
weakfor^[^ ]*/index\.php: You have an error in your SQL syntax \.\.\. near '…→ finding QoD 75: eliteCMS index.php 'page' SQL Injection (CVE-2008-4046)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2008-4046
- https://www.exploit-db.com/exploits/32316
- https://www.exploit-db.com/exploits/8838
- https://www.exploit-db.com/exploits/29034
- https://www.securityfocus.com/bid/30990
Feed source — tests/vulnerabilities/elitecms/CVE-2008-4046.yaml
# eliteCMS index.php 'page' SQL injection — CVE-2008-4046
#
# eliteCMS 1.0 / 1.01 (never fixed upstream) builds the page lookup in
# includes/functions.php get_page_settings() as
# SELECT * FROM pages WHERE id = '{$_GET['page']}'
# and confirm_query() dies with
# "Database Query failed !<br>Check Database Settings.<br>" . mysql_error()
# when the query fails (advisories EDB-8838 / EDB-29034, which quote both the
# code and the error page). Exploitable when magic_quotes_gpc is off.
#
# Detection (benign, read-only), per candidate install directory
# ("", /cms, /elite, /elitecms):
# 1. Product gate: <dir>/admin/login.php shows the eliteCMS admin panel
# title, or <dir>/index.php shows the "Powered by Elite CMS" footer.
# 2. QoD 97: page=-1' AND extractvalue(1,concat(0x7e,<a>*<b>)) AND '1'='1
# MySQL >= 5.1 / MariaDB fold the constant and raise
# "XPATH syntax error: '~<a×b>'" even before reading a row; the error
# page prints it. The product of two random 6-digit operands is not in
# the request, so a page that only echoes the URL cannot produce it.
# The same value without the leading quote is sent too, for an
# unquoted lookup (WHERE id = <page>, which the 1.0 advisory's quote-less
# exploit suggests); each form is a harmless literal in the other query.
# 3. QoD 75 fallback (MySQL 5.0 has no EXTRACTVALUE): page=-1'NOCTIS<hex>
# must give "You have an error in your SQL syntax ... near 'NOCTIS<hex>'"
# (the stray quote breaks the string literal right before our marker;
# in an unquoted lookup the error reads near ''NOCTIS<hex>'),
# while the control page=-1NOCTIS<hex> (no quote) shows no SQL error.
# No row is read or changed.
#
# Improvements over the source NASL: the NASL only requests
# index.php?page=-1%27 and looks for "You have an error in your SQL" — any
# page that prints that text for another reason is reported, and the database
# is never shown to run injected SQL. This feed proves execution with a
# database-computed value, keeps the syntax-error check only as a fallback
# with a random marker and a quote-free control, and also looks in the
# /elitecms directory.
#
# CVSS: CVE-2008-4046 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2009/eliteCMS_multiple.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100222, GPL-2.0-only); product gate after
# eliteCMS_detect.nasl (OID 1.3.6.1.4.1.25623.1.0.100221).
uid: a5945ed9-4428-47b2-b66b-d019d707a4ef
name: "eliteCMS index.php 'page' SQL Injection (CVE-2008-4046)"
description: |
Tests eliteCMS 1.0 and 1.01 for the unauthenticated SQL injection through
the page parameter of index.php, which is pasted between single quotes into
the page lookup query. In the web root and in the /cms, /elite and /elitecms
directories, once the admin login page or the site footer identifies
eliteCMS, the feed requests index.php with a page value that closes the
quote and makes the database raise an XPath error carrying the product of
two random numbers, which the application prints in its "Database Query
failed" page. The correct product in the page confirms that the database
ran the injected SQL; the product is not part of the request, so a page that
only echoes the URL is not reported. The same value without the leading
quote is sent as well, for installs that paste the parameter unquoted. On
databases without the EXTRACTVALUE
function, the feed falls back to a single quote followed by a random marker:
a SQL syntax error quoting that marker, while the same value without the
quote gives no SQL error, shows that the quote reaches the query unescaped.
The probes read no table row and change nothing.
cves: [CVE-2008-4046]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [elitecms, php, mysql, sqli, error-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2008-4046"
- "https://www.exploit-db.com/exploits/32316"
- "https://www.exploit-db.com/exploits/8838"
- "https://www.exploit-db.com/exploits/29034"
- "https://www.securityfocus.com/bid/30990"
# OpenVAS/Greenbone NASL 2009/eliteCMS_multiple.nasl (GPL-2.0-only)
steps:
# Random operands and marker; the expected proofs are computed locally.
- id: mint
action: script
code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999), tok: "NOCTIS" + rand_hex(8) }'
store_as: m
- id: mint-product
action: script
code: '"" + (m.a * m.b)'
store_as: prod
- id: init-proof
action: set_var
var_name: proof
var_value: ""
- id: init-weak
action: set_var
var_name: weak
var_value: ""
# ── Loop group: every step below runs once per candidate install dir ─────
- id: init-login
action: set_var
var_name: login
var_value: {status: 0, body: ""}
loop:
over: ["", "/cms", "/elite", "/elitecms"]
var: dir
- id: init-home
action: set_var
var_name: home
var_value: {status: 0, body: ""}
- id: init-xp-r
action: set_var
var_name: xp_r
var_value: {status: 0, body: ""}
- id: init-xn-r
action: set_var
var_name: xn_r
var_value: {status: 0, body: ""}
- id: init-q-r
action: set_var
var_name: q_r
var_value: {status: 0, body: ""}
- id: init-c-r
action: set_var
var_name: c_r
var_value: {status: 0, body: ""}
- id: fetch-login
action: http_request
method: GET
path: "{{dir}}/admin/login.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
store_as: login
- id: fetch-home
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
store_as: home
- id: gate
action: script
code: |
let lb = if type_of(login.body) == "string" { login.body } else { "" };
let hb = if type_of(home.body) == "string" { home.body } else { "" };
egrep("(?i)Elite CMS .* Admin Control Panel|eliteCMS - The Lightweight CMS|Pow(o|e)red by <a [^>]+>Elite CMS", lb) != "" ||
egrep("(?i)Pow(o|e)red by <a [^>]+>Elite CMS", hb) != ""
store_as: is_elite
# page=-1' AND extractvalue(1,concat(0x7e,<a>*<b>)) AND '1'='1
- id: inject-xpath
action: http_request
method: GET
path: "{{dir}}/index.php?page=-1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20AND%20%271%27=%271"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'is_elite == true && proof == ""'
store_as: xp_r
# The error text may be HTML-escaped by a front end; accept the quote in any
# common form, or none.
- id: verdict-xpath
action: script
code: |
if proof != "" { proof }
else if is_elite == true && type_of(xp_r.body) == "string" && egrep("XPATH syntax error: (?:'|�?39;|'|')?~" + prod, xp_r.body) != "" { "XPATH syntax error: ~" + prod }
else { "" }
store_as: proof
# Same proof for an unquoted lookup (WHERE id = <page>, as the 1.0
# advisory's quote-less exploit suggests). In the quoted 1.01 query this
# value is a plain string literal and raises nothing.
- id: inject-xpath-num
action: http_request
method: GET
path: "{{dir}}/index.php?page=-1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'is_elite == true && proof == ""'
store_as: xn_r
- id: verdict-xpath-num
action: script
code: |
if proof != "" { proof }
else if is_elite == true && type_of(xn_r.body) == "string" && egrep("XPATH syntax error: (?:'|�?39;|'|')?~" + prod, xn_r.body) != "" { "XPATH syntax error: ~" + prod }
else { "" }
store_as: proof
# Fallback for MySQL 5.0: quote + random marker, then the same value
# without the quote as a control.
- id: inject-quote
action: http_request
method: GET
path: "{{dir}}/index.php?page=-1%27{{m.tok}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'is_elite == true && proof == "" && weak == ""'
store_as: q_r
- id: control-noquote
action: http_request
method: GET
path: "{{dir}}/index.php?page=-1{{m.tok}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'is_elite == true && proof == "" && weak == "" && type_of(q_r.body) == "string" && stridx(q_r.body, "You have an error in your SQL syntax") >= 0'
store_as: c_r
- id: verdict-quote
action: script
code: |
if weak != "" { weak }
else if is_elite == true && proof == "" && type_of(q_r.body) == "string" && type_of(c_r.body) == "string" && c_r.status >= 200 &&
egrep("You have an error in your SQL syntax.*near (?:'|�?39;|'|'){1,2}" + m.tok, q_r.body) != "" &&
stridx(c_r.body, "SQL syntax") < 0 { dir + "/index.php: You have an error in your SQL syntax ... near '" + m.tok + "'" }
else { "" }
store_as: weak
- id: report
action: match
source: proof
pattern: "^XPATH syntax error: ~[0-9]+$"
on_match:
finding:
title: "eliteCMS index.php 'page' SQL Injection (CVE-2008-4046)"
description: "An unauthenticated GET to index.php with SQL appended to the page parameter made the database compute the product of two random numbers, which came back in the application's database error page. Any query the database user may run can be injected the same way, including reading the users table with the account password hashes."
remediation: "eliteCMS is no longer maintained and no fixed release exists. Remove the application or restrict access to it; at minimum patch get_page_settings() in includes/functions.php to cast the page parameter to an integer, and stop printing database errors to visitors."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/index.php with an injected page value computing {{m.a}}*{{m.b}} returned the database-computed result: {{proof}}"
stop: true
# ── Second group, run once after the loop: only reached when no
# directory gave the QoD 97 proof (that finding stops the test).
- id: after-loop
action: set_var
var_name: done
var_value: true
loop:
over: ["once"]
var: pass
- id: report-weak
action: match
source: weak
pattern: "^[^ ]*/index\\.php: You have an error in your SQL syntax \\.\\.\\. near 'NOCTIS[0-9a-f]+'$"
on_match:
finding:
title: "eliteCMS index.php 'page' SQL Injection (CVE-2008-4046)"
description: "A single quote in the page parameter of index.php broke the page lookup query: the database reported a SQL syntax error right before a random marker, while the same value without the quote gave no SQL error. The parameter reaches the query unescaped (the database did not support the computed-value proof)."
remediation: "eliteCMS is no longer maintained and no fixed release exists. Remove the application or restrict access to it; at minimum patch get_page_settings() in includes/functions.php to cast the page parameter to an integer, and stop printing database errors to visitors."
confidence_delta: 0.50
qod: 75
evidence: "GET <dir>/index.php?page=-1'{{m.tok}} → {{weak}}; the control without the quote showed no SQL error"