Discuz! — 1 vulnerability check
noctis ships 1 vulnerability check for Discuz!, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Discuz! 4.0.0 RC4 and earlier multiple-extension file upload (version check)
| CVE | CVE-2005-2614 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/discuz/CVE-2005-2614.yaml |
Requests index.php of a Discuz! forum at /discuz, the web root, /bbs, /forum and /forums. The page is recognised as Discuz! by its "- powered by Discuz!" title, and the version is read from the generator meta tag, the "Powered by Discuz! Board" description meta tag or the page footer. When the page shows no version, include/cache.func.php?kernel_version is read, which prints the kernel version without login. Versions 1.x to 3.x and 4.0.0 alpha, beta and RC1 to RC4 are reported: they check only the last extension of an uploaded attachment, so a member allowed to attach files can upload a file such as "x.php.rar" that the web server runs as a PHP script (CVE-2005-2614). The upload itself is not attempted, as it needs a forum account and leaves a post and a file behind; only one or two pages per folder are read.
How noctis detects it
- HTTP(S) request
GET {{dir}}/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/include/cache.func.php?kernel_version - Parses / computes the next value with a Rhai script
- Checks
ver_hitfor^/→ finding QoD 70: Discuz! 4.0.0 RC4 and earlier multiple-extension file upload (version check)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2005-2614
- https://seclists.org/fulldisclosure/2005/Aug/438
- http://www.securityfocus.com/bid/14564
Feed source — tests/vulnerabilities/discuz/CVE-2005-2614.yaml
# Discuz! <= 4.0.0 RC4 — multiple-extension attachment upload — CVE-2005-2614
#
# STG Security advisory SSA-20050812-27 (Full Disclosure, 2005-08-15): Discuz!
# "4.0.0 rc4 and prior" only check the LAST extension of an attached file, so
# an attachment named "x.php.rar" passes the allowed-extension list and is
# stored with its name kept; Apache then runs the .php part. Uploading an
# attachment needs a forum account allowed to attach files (the guest group
# of a stock install cannot) and leaves a post and a file on the forum, so the
# flaw itself is not exercised: this is a version check (QoD 70).
#
# Real page layout, read from the shipped sources (bunian/discuz-archive):
# 3.1.2 templates/default/header.htm
# <meta name="generator" content="Discuz! $version with Templates 3.1">
# <meta name="description" content="$bbname - Powered by Discuz! Board $version">
# <title>$bbname$navtitle - powered by Discuz!</title>
# 4.0.0 templates/default/header.htm (the description no longer has a version)
# <title>$bbname $seotitle $navtitle - powered by Discuz!</title>
# <meta name="generator" content="Discuz! $version with Templates 4.0.0">
# footers: <b>Discuz!</b></a> <b style="color:#FF9900">$version</b>
# 2.x: 2.5F stores a plain "2.5"; live 2.2F pages show it wrapped as
# content="Discuz! <b style='color: #FF9900'>2.2</b>F with ..." (tags stripped)
# 4.0.0 include/cache.func.php?kernel_version answers, without login,
# "Version: 4.0.0<br>Release: 20051216" (seen in the 4.0.0 / 4.1.0 sources;
# not confirmed for the RCs, so it is only a fallback).
# 4.0.0 final (2006-01) fixes the flaw: include/post.func.php renames every
# php/phtml/cgi/pl/... part of the stored name to "_php" before the last
# extension. Versions 1.x-3.x and 4.0.0 alpha/beta/RC1-RC4 are reported.
#
# Better than the source NASL: it reads the version only from the description
# meta, which 4.x templates no longer fill and which 2.x wraps in a <b> tag,
# so it misses 2.x and 4.0.0 RCs laid out like 4.0.0. This feed reads the
# generator meta, the description meta and the footer (tags stripped), falls
# back on the kernel_version answer, and also tries /bbs, /forum and /forums.
#
# Source: OpenVAS/Greenbone NVT pre2008/discuz_arbitrary_file_upload_flaw.nasl
# (OID 1.3.6.1.4.1.25623.1.0.19751, GPL-2.0-only).
#
# CVSS: NVD v2 only (no v3 score): 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P).
uid: f470f1d9-bfe8-4c6c-b5d7-c319fe8eaf7a
name: "Discuz! 4.0.0 RC4 and earlier multiple-extension file upload (version check)"
description: |
Requests index.php of a Discuz! forum at /discuz, the web root, /bbs, /forum
and /forums. The page is recognised as Discuz! by its "- powered by
Discuz!" title, and the version is read from the generator meta tag, the
"Powered by Discuz! Board" description meta tag or the page footer. When the
page shows no version, include/cache.func.php?kernel_version is read, which
prints the kernel version without login.
Versions 1.x to 3.x and 4.0.0 alpha, beta and RC1 to RC4 are reported: they
check only the last extension of an uploaded attachment, so a member allowed
to attach files can upload a file such as "x.php.rar" that the web server
runs as a PHP script (CVE-2005-2614). The upload itself is not attempted, as
it needs a forum account and leaves a post and a file behind; only one or
two pages per folder are read.
cves: [CVE-2005-2614]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [discuz, php, forum, file-upload, rce, version-check]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2005-2614"
- "https://seclists.org/fulldisclosure/2005/Aug/438"
- "http://www.securityfocus.com/bid/14564"
# OpenVAS/Greenbone NASL pre2008/discuz_arbitrary_file_upload_flaw.nasl (GPL-2.0-only)
steps:
# Loop group: the steps below run once per install folder; a finding stops it.
- id: init-page
action: set_var
var_name: page
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/discuz", "", "/bbs", "/forum", "/forums"]
- id: init-kernel
action: set_var
var_name: kernel
var_value: {status: 0, body: ""}
- id: index-probe
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: page
# Version from the page: generator meta, then description meta, then footer.
- id: page-version
action: script
code: |
let body = if page.status == 200 && type_of(page.body) == "string" { page.body } else { "" };
let discuz = ereg("(?i)- powered by Discuz!</title>", body);
let v = "";
let src = "";
if discuz {
let g = eregmatch("(?i)<meta name=\"generator\" content=\"Discuz! ([^\"]*)\"", body);
if g.len() > 1 {
v = ereg_replace("<[^>]*>", "", g[1]);
src = "generator meta";
}
if v == "" || !ereg("^\\s*[0-9]", v) {
let d = eregmatch("(?i)<meta name=\"description\" content=\"[^\"]*Powered by Discuz! Board ([^\"]*)\"", body);
if d.len() > 1 {
v = ereg_replace("<[^>]*>", "", d[1]);
src = "description meta";
}
}
if v == "" || !ereg("^\\s*[0-9]", v) {
let f = eregmatch("(?i)<b>Discuz!</b>(?:\\s|</a>)*<b style=\"color: ?#FF9900\">([^<]+)</b>", body);
if f.len() > 1 {
v = f[1];
src = "footer";
}
}
if !ereg("^\\s*[0-9]", v) { v = ""; src = ""; }
}
#{ discuz: discuz, version: v, source: src }
store_as: pv
- id: kernel-probe
action: http_request
method: GET
path: "{{dir}}/include/cache.func.php?kernel_version"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'pv.discuz == true && pv.version == ""'
store_as: kernel
- id: version-check
action: script
code: |
let v = pv.version;
let src = pv.source;
if pv.discuz && v == "" && kernel.status == 200 && type_of(kernel.body) == "string"
&& kernel.body.contains("Crossday Discuz! Board") {
let k = eregmatch("Version: ([0-9][^<\\s]*)", kernel.body);
if k.len() > 1 { v = k[1]; src = "kernel_version page"; }
}
let hit = "";
if pv.discuz && v != "" {
let m = eregmatch("(?i)^\\s*([0-9]+)\\.([0-9]+)(?:\\.([0-9]+))?\\s?(rc|beta|alpha|preview)?\\s?([0-9]*)", v);
if m.len() > 1 {
let major = int(m[1]);
let minor = int(m[2]);
let patch = if m[3] == "" { 0 } else { int(m[3]) };
let tag = tolower(m[4]);
let num = if m[5] == "" { 0 } else { int(m[5]) };
let vuln = major < 4
|| (major == 4 && minor == 0 && patch == 0
&& (tag == "alpha" || tag == "beta" || tag == "preview" || (tag == "rc" && num <= 4)));
if vuln {
let shown = eregmatch("^\\s*([0-9][0-9A-Za-z. ]*?)\\s*(with|$)", v);
let ver = if shown.len() > 1 { shown[1] } else { v };
hit = (if dir == "" { "/" } else { dir }) + " (Discuz! " + ver + ", from the " + src + ")";
}
}
}
hit
store_as: ver_hit
- id: report-version
action: match
source: ver_hit
pattern: "^/"
condition: 'ver_hit != ""'
on_match:
finding:
title: "Discuz! 4.0.0 RC4 and earlier multiple-extension file upload (version check)"
description: "The forum identifies itself as Discuz! 4.0.0 RC4 or earlier. These versions check only the last extension of an uploaded attachment, so a member allowed to attach files can upload a file such as \"x.php.rar\" that the web server then runs as a PHP script, executing commands with the web server's privileges (CVE-2005-2614). The upload was not attempted: the result rests on the version the forum shows."
remediation: "Upgrade Discuz! to 4.0.0 final or later. Until then, remove rar and other extensions that Apache does not map to a handler from the allowed attachment extensions, and stop the attachments folder from running scripts."
confidence_delta: 0.40
qod: 70
evidence: "install dir {{ver_hit}}"
stop: true