Bitweaver — 1 vulnerability check

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

← All products · Feeds on GitHub

Bitweaver boards_rss.php version Directory Traversal File Write

CVECVE-2009-1678, CVE-2009-1677
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/bitweaver/bitweaver-boards-rss-traversal-write.yaml

Tests Bitweaver for the directory traversal in its RSS feed cache: boards/boards_rss.php builds the cache file name from the "version" parameter without any check, so a value holding "../" makes the feed writer create or overwrite a file outside the cache folder (and, combined with PHP code in the Host header, write PHP code to a file of the attacker's choosing). The feed requests boards_rss.php under the usual install folders with version set to "/../../" followed by a random name. A vulnerable install writes the feed two folders up, into its own temp/rss/ cache folder, and names the written file in its reply (Content-Disposition: filename=<random name>.xml); a fixed install keeps its usual cache file name. The only change left on the server is one small RSS feed file (the feed's own content, no code) under that random name in temp/rss/; nothing is written to the Bitweaver root folder.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/boards/boards_rss.php?version=%2F..%2F..%2F{{probe.name}}
  3. Parses / computes the next value with a Rhai script
  4. Checks rss_proof for ^noctis[0-9A-Za-z]+\.xml$ → finding QoD 97: Bitweaver boards_rss.php version Directory Traversal File Write (CVE-2009-1678)

References:

Feed source — tests/vulnerabilities/bitweaver/bitweaver-boards-rss-traversal-write.yaml
# Bitweaver boards_rss.php "version" directory traversal file write
# CVE-2009-1678 (directory traversal in saveFeed via "version") and CVE-2009-1677
# (static PHP code injection into the files saveFeed writes)
#
# Bitweaver <= 2.6 (read in the bitweaver/rss and bitweaver/boards git history):
#   rss/rss_inc.php 1.13: $rss_version_name = $_REQUEST['version'], kept as-is
#     when it matches no known format, then
#     $cacheFileTail = 'p'.<group ids>.'_'.$rss_version_name.'.xml';
#   boards/boards_rss.php 1.4:
#     $cacheFile = TEMP_PKG_PATH.'rss/boards/'.$_SERVER['HTTP_HOST']."_".$cacheFileTail;
#     echo $rss->saveFeed( $rss_version_name, $cacheFile );
#   rss/feedcreator.class.php saveFeed(): fopen($filename, "w+"), writes the
#     feed, then _redirect(): Header("Content-Disposition: inline;
#     filename=".basename($filename)) + readfile().
# PHP resolves "<dir>/../" in a path by itself, even when <dir> does not
# exist, so version=/../../../../x.php writes <bitweaver root>/x.php.xml (the
# feed links carry the raw Host header, hence the PHP code injection when
# Apache runs *.php.xml as PHP). Fixed in rss_inc.php 1.14 (2009-05-13):
# an unknown version now falls back to "RSS0.91".
#
# Detection, per install folder ("", /bitweaver, /bw):
#   GET <dir>/boards/boards_rss.php?version=/../../noctis<random>
#   The vulnerable code writes the feed to temp/rss/noctis<random>.xml
#   (two levels up from the "<host>_p-1_" name, still inside Bitweaver's own
#   RSS cache folder, which rss_inc.php creates on every request; one level
#   up would need temp/rss/boards/, which only exists once someone fetched
#   the boards feed, and the traversal request cannot create it because
#   mkdir_p() refuses "..") and answers with
#   "Content-Disposition: inline; filename=noctis<random>.xml" and the feed.
#   A fixed install answers "filename=<host>_p-1_RSS0.91.xml". The header can
#   only carry the bare random name when the "/../" in our value was part of
#   the path the file was written to: confirmed file write (QoD 97).
#
# CVSS: NVD v2 only — 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P) for CVE-2009-1678; no v3.
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_bitweaver_dir_trav_n_code_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900356, GPL-2.0-only). Improvements: the file is
# written inside Bitweaver's temp/rss/ cache folder instead of the web root (the
# source check leaves bookoo.php.xml in the document root of every vulnerable
# target), a random name instead of a fixed one (a leftover bookoo.php.xml
# from an earlier scan made a fixed install look vulnerable), proper HTTP
# requests (the source check appends " \r\n\r\n" to the URL, which breaks the
# request line), and no dependency on the session cookie or on the web root
# being writable.
uid: a4e665e4-3628-4afc-84f9-a99d4924d88d
name: "Bitweaver boards_rss.php version Directory Traversal File Write"
description: |
  Tests Bitweaver for the directory traversal in its RSS feed cache:
  boards/boards_rss.php builds the cache file name from the "version"
  parameter without any check, so a value holding "../" makes the feed
  writer create or overwrite a file outside the cache folder (and, combined
  with PHP code in the Host header, write PHP code to a file of the
  attacker's choosing). The feed requests boards_rss.php under the usual
  install folders with version set to "/../../" followed by a random name.
  A vulnerable install writes the feed two folders up, into its own
  temp/rss/ cache folder, and names the written file in its reply
  (Content-Disposition: filename=<random name>.xml); a fixed install keeps
  its usual cache file name. The only change left on the server is one
  small RSS feed file (the feed's own content, no code) under that random
  name in temp/rss/; nothing is written to the Bitweaver root folder.
cves: [CVE-2009-1678, CVE-2009-1677]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [bitweaver, cms, php, path-traversal, file-write, code-injection, rss, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-1678"
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-1677"
  - "https://github.com/bitweaver/rss/commit/69ae15025f20c397e7697c6b45bfc88bcb65a3f8"
  # OpenVAS/Greenbone NASL 2009/gb_bitweaver_dir_trav_n_code_inj_vuln.nasl (GPL-2.0-only)

steps:
  - id: build-probe
    action: script
    code: |
      #{ name: "noctis" + rand_str(12) }
    store_as: probe

  # ── Loop group: one pass per install folder ──────────────────────────────
  - id: init-rss
    action: set_var
    var_name: rss
    var_value: {status: 0, body: "", headers: {}}
    loop:
      var: dir
      over: ["", "/bitweaver", "/bw"]

  - id: rss-probe
    action: http_request
    method: GET
    path: "{{dir}}/boards/boards_rss.php?version=%2F..%2F..%2F{{probe.name}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: rss

  - id: rss-check
    action: script
    code: |
      let cd = if type_of(rss.headers) == "map" && "content-disposition" in rss.headers { rss.headers["content-disposition"] } else { "" };
      let b = if type_of(rss.body) == "string" { rss.body } else { "" };
      let want = "filename=" + probe.name + ".xml";
      if rss.status == 200 && cd.ends_with(want) && (b.contains("<rss") || b.contains("<rdf:RDF") || b.contains("<feed")) {
        probe.name + ".xml"
      } else { "" }
    store_as: rss_proof

  - id: report-write
    action: match
    source: rss_proof
    pattern: "^noctis[0-9A-Za-z]+\\.xml$"
    condition: 'rss_proof != ""'
    on_match:
      finding:
        title: "Bitweaver boards_rss.php version Directory Traversal File Write (CVE-2009-1678)"
        description: "An unauthenticated request to boards/boards_rss.php with version set to \"/../../\" followed by a random name made Bitweaver write its RSS feed to a file of that name two folders above the expected cache file, and its reply named that file: the version parameter reaches the cache file path without any check. An attacker can use \"../\" sequences to create or overwrite files anywhere the web server can write, including a .php.xml file in the web root whose feed links carry PHP code from the Host header (CVE-2009-1677), which Apache may run as PHP."
        cves: [CVE-2009-1678, CVE-2009-1677]
        cvss: 7.5
        severity: high
        remediation: "Upgrade Bitweaver to a release that includes rss/rss_inc.php 1.14 or later (May 2009), which maps unknown version values to the default feed format. Until then, block requests to boards/boards_rss.php whose version parameter contains \"/\" or \"..\". A feed file named after the random value is left in Bitweaver's temp/rss/ folder and can be deleted."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/boards/boards_rss.php?version=/../../{{probe.name}} answered 200 with an RSS feed and Content-Disposition naming {{rss_proof}} (file written outside the per-host cache name)"
      stop: true

View these feeds on GitHub