SoftBB — 2 vulnerability checks

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

← All products · Feeds on GitHub

SoftBB redir_last_post_list.php post parameter SQL injection

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

SoftBB 0.1.3 places the post parameter of redir_last_post_list.php into a MySQL query without escaping it, so a remote, unauthenticated attacker can run arbitrary SQL against the forum database.

For the web root, /softbb and /cms whose index page carries the SoftBB footer, this check sends an EXTRACTVALUE expression built from two random numbers. The injection is confirmed when the database error returned by the page carries the product of those numbers, which only the database can have computed. On older MySQL servers without EXTRACTVALUE, it falls back to a stray quote followed by a random word: the flaw is reported when the MySQL syntax error quotes that word while a plain numeric value causes no SQL error. The requests only make the query fail; nothing is read or written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{v.d}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{v.d}}/redir_last_post_list.php?post=1%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{…
  5. HTTP(S) request GET {{v.d}}/redir_last_post_list.php?post=1%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}…
  6. Parses / computes the next value with a Rhai script
  7. Checks xv for XPATH syntax error carrying ~[0-9]+ → finding QoD 97: SoftBB redir_last_post_list.php post parameter SQL injection (CVE-2014-9560)
  8. HTTP(S) request GET {{v.d}}/redir_last_post_list.php?post=1%27{{sc.tok}}
  9. HTTP(S) request GET {{v.d}}/redir_last_post_list.php?post={{sc.ctl}}
  10. Parses / computes the next value with a Rhai script
  11. Checks fallback for MySQL syntax error quoting the injected marker → finding QoD 75: SoftBB redir_last_post_list.php post parameter SQL injection (CVE-2014-9560)

References:

Feed source — tests/vulnerabilities/softbb/CVE-2014-9560.yaml
# SoftBB 0.1.3 — redir_last_post_list.php post parameter SQL injection
# (CVE-2014-9560).
#
# SoftBB 0.1.3 splices the post parameter of redir_last_post_list.php into a
# MySQL query unescaped (Full Disclosure 2015-01-20, BID 71986). When the query
# fails the page prints the MySQL error. The product source is no longer
# available; the vector follows the advisory.
#
# Detection, read-only, for the web root, /softbb and /cms. A directory is
# tested only when its index.php carries the "Copyright SoftBB" footer.
#   1. QoD 97 — post = 1 AND extractvalue(1,concat(0x7e,A*B)) (numeric
#      context) then 1' AND extractvalue(1,concat(0x7e,A*B)) AND '1'='1
#      (quoted context). A, B: random 6-digit numbers. MySQL >= 5.1 evaluates
#      the constant expression while preparing the query and fails with
#      "XPATH syntax error: '~<A*B>'": the product never appears in the
#      request, so only the database can have computed it. No row is read or
#      written.
#   2. QoD 75 fallback (MySQL < 5.1 has no EXTRACTVALUE) — post = 1'NOCTIS<rand>
#      (a stray quote): the MySQL syntax error quotes the random word, while a
#      control value made of digits shows no SQL error. Reported only when no
#      directory gave the stage 1 proof.
#
# Reference: OpenVAS/Greenbone NVT `2015/gb_softbb_sql_n_xss_vuln.nasl`, which
# sends post='SQL-INJECTION-TEST and matches "You have an error in your SQL
# syntax"; this feed adds the computed proof, a random marker + control for
# the fallback, and accepts HTML-escaped quotes. The XSS half (CVE-2014-9561)
# is softbb/CVE-2014-9561.yaml.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: 6837153d-751f-40ef-b892-928485950da4
name: "SoftBB redir_last_post_list.php post parameter SQL injection (CVE-2014-9560)"
description: |
  SoftBB 0.1.3 places the post parameter of redir_last_post_list.php into a
  MySQL query without escaping it, so a remote, unauthenticated attacker can
  run arbitrary SQL against the forum database.

  For the web root, /softbb and /cms whose index page carries the SoftBB
  footer, this check sends an EXTRACTVALUE expression built from two random
  numbers. The injection is confirmed when the database error returned by the
  page carries the product of those numbers, which only the database can have
  computed. On older MySQL servers without EXTRACTVALUE, it falls back to a
  stray quote followed by a random word: the flaw is reported when the MySQL
  syntax error quotes that word while a plain numeric value causes no SQL
  error. The requests only make the query fail; nothing is read or written.
cves: [CVE-2014-9560]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [softbb, php, mysql, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-9560"
  - "http://seclists.org/fulldisclosure/2015/Jan/20"
  - "http://www.securityfocus.com/bid/71986"
  - "http://packetstormsecurity.com/files/129888/SoftBB-0.1.3-SQL-Injection.html"

steps:
  - id: gen
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: a, b: b, prod: "~" + (a * b),
         tok: "NOCTIS" + rand_int(10000000, 99999999) + "Q",
         ctl: "" + rand_int(10000000, 99999999) }
    store_as: sc

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

  # ── Per install dir (loop group): every following step runs per dir ───────
  # Pre-initialise every stored result a script reads.
  - id: init-idx
    action: set_var
    var_name: idx
    var_value: {status: 0, body: ""}
    loop:
      var: v
      over:
        - {d: ""}
        - {d: "/softbb"}
        - {d: "/cms"}

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

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

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

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

  - id: index
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/index.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: idx

  - id: init-isb
    action: set_var
    var_name: isb
    var_value: false

  - id: check-index
    action: script
    code: |
      type_of(idx.body) == "string" && idx.status >= 200 && idx.status < 400 && ereg("Copyright SoftBB", idx.body)
    store_as: isb

  # Stage 1: EXTRACTVALUE error carrying the database-computed product —
  # numeric context first …
  - id: xv-numeric
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/redir_last_post_list.php?post=1%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))"
    condition: "isb"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: xvn

  # … then quoted.
  - id: xv-quoted
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/redir_last_post_list.php?post=1%27%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))%20AND%20%271%27=%271"
    condition: "isb"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: xvq

  - id: check-xv
    action: script
    code: |
      let bn = if type_of(xvn.body) == "string" { xvn.body } else { "" };
      let bq = if type_of(xvq.body) == "string" { xvq.body } else { "" };
      let re = "XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?" + sc.prod + "(?:[^0-9]|$)";
      if isb && ereg(re, bn) {
        v.d + "/redir_last_post_list.php post=1 AND extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + ")): XPATH syntax error carrying " + sc.prod + " (HTTP " + xvn.status + ")"
      } else if isb && ereg(re, bq) {
        v.d + "/redir_last_post_list.php post=1' AND extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + ")) AND '1'='1: XPATH syntax error carrying " + sc.prod + " (HTTP " + xvq.status + ")"
      } else { "" }
    store_as: xv

  - id: report-xv
    action: match
    source: xv
    pattern: "XPATH syntax error carrying ~[0-9]+"
    condition: 'xv != ""'
    on_match:
      finding:
        title: "SoftBB redir_last_post_list.php post parameter SQL injection (CVE-2014-9560)"
        description: "SoftBB ran an SQL expression injected through the post parameter of redir_last_post_list.php: the database error returned by the page carries the product of two random numbers chosen by the scanner, which never appear in the request. An unauthenticated attacker can run arbitrary SQL against the forum database (read or change accounts and posts)."
        remediation: "SoftBB is no longer maintained: replace it with a maintained forum. If you maintain the code, cast post to an integer (or use a prepared statement) before building the query, and do not print database errors to visitors."
        confidence_delta: 0.65
        qod: 97
        evidence: "Error-based SQLi confirmed: {{xv}}"
      stop: true

  # Stage 2 (MySQL < 5.1): syntax error quoting a random marker + control.
  - id: qm-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/redir_last_post_list.php?post=1%27{{sc.tok}}"
    condition: 'fallback == "" && isb'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: qm

  - id: ctl-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/redir_last_post_list.php?post={{sc.ctl}}"
    condition: 'fallback == "" && isb && qm.status != 0'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: ctl

  - id: check-qm
    action: script
    code: |
      if fallback != "" { fallback } else {
        let b = if type_of(qm.body) == "string" { qm.body } else { "" };
        let cb = if type_of(ctl.body) == "string" { ctl.body } else { "" };
        let q = "(?:'|&#0?39;|&#x27;|&apos;)";
        let syn = isb && ereg("(?i)error in your SQL syntax[^\\n]{0,200}near " + q + "{1,2}[^\\n]{0,8}" + sc.tok, b);
        let cerr = ereg("(?i)error in your SQL syntax|XPATH syntax error|MySQL error", cb);
        if ctl.status != 0 && syn && !cerr {
          v.d + "/redir_last_post_list.php post=1'" + sc.tok + ": MySQL syntax error quoting the injected marker (HTTP " + qm.status + "), control post=" + sc.ctl + " without SQL error (HTTP " + ctl.status + ")"
        } else { "" }
      }
    store_as: fallback

  # ── Fallback report (no stage 1 proof in any dir) ─────────────────────────
  - id: once
    action: set_var
    var_name: done
    var_value: true
    loop:
      var: o
      over: ["once"]

  - id: report-qm
    action: match
    source: fallback
    pattern: "MySQL syntax error quoting the injected marker"
    condition: 'fallback != ""'
    on_match:
      finding:
        title: "SoftBB redir_last_post_list.php post parameter SQL injection (CVE-2014-9560)"
        description: "A single quote sent in the post parameter of SoftBB's redir_last_post_list.php broke its SQL query: the MySQL syntax error quotes the random text that followed it, while a plain numeric value caused no SQL error. The parameter reaches the query unescaped, so an unauthenticated attacker can run arbitrary SQL against the forum database."
        remediation: "SoftBB is no longer maintained: replace it with a maintained forum. If you maintain the code, cast post to an integer (or use a prepared statement) before building the query, and do not print database errors to visitors."
        confidence_delta: 0.50
        qod: 75
        evidence: "Error-based SQLi: {{fallback}}"
      stop: true

SoftBB redir_last_post_list.php post parameter reflected cross-site scripting

CVECVE-2014-9561
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/softbb/CVE-2014-9561.yaml

SoftBB 0.1.3 prints the post parameter of redir_last_post_list.php back into the page without escaping it, so an attacker can send a forum visitor a link that runs script in the site's origin.

For the web root, /softbb and /cms whose index page carries the SoftBB footer, this check sends the post parameter a value that closes quotes and opens an element named after a random marker. The flaw is reported when the page returns that element unescaped and the same request sent to an absent script in the same folder does not reflect it. Nothing is stored on the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{v.d}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{v.d}}/redir_last_post_list.php?post=1%27%22%3E%3C{{sc.marker}}%3E
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{v.d}}/{{sc.marker}}.php?post=1%27%22%3E%3C{{sc.marker}}%3E
  7. Parses / computes the next value with a Rhai script
  8. Checks hit for ^reflected$ → finding QoD 75: SoftBB redir_last_post_list.php post parameter reflected cross-site scripting (CVE-2014-9561)

References:

Feed source — tests/vulnerabilities/softbb/CVE-2014-9561.yaml
# SoftBB 0.1.3 — redir_last_post_list.php post parameter reflected XSS
# (CVE-2014-9561).
#
# SoftBB 0.1.3 prints the post parameter of redir_last_post_list.php back
# into the page without escaping it (Full Disclosure 2015-01-21, BID 71987),
# either directly or inside the failed-query error page. The product source is
# no longer available; the vector follows the advisory.
#
# Detection, for the web root, /softbb and /cms: a directory is tested only
# when its index.php carries the "Copyright SoftBB" footer. The value sent is
# 1'"><noctis…> (quote break-outs followed by an element named after a random
# marker, so that both a failed query echoed raw and a direct print reflect
# it). The flaw is reported when the reply carries that element unescaped and
# the same payload sent to an absent script of the same folder is not
# reflected (catch-all pages echoing the URL). Nothing is stored on the target.
#
# The SQL injection half (CVE-2014-9560) is softbb/CVE-2014-9560.yaml.
#
# Reference: OpenVAS/Greenbone NVT `2015/gb_softbb_sql_n_xss_vuln.nasl` lists
# this CVE but only tests the SQL injection. CVSS: NVD carries only a CVSS v2
# score (4.3).
uid: e0a03375-021e-41ee-9138-a1ff93d9d7dc
name: "SoftBB redir_last_post_list.php post parameter reflected cross-site scripting (CVE-2014-9561)"
description: |
  SoftBB 0.1.3 prints the post parameter of redir_last_post_list.php back into
  the page without escaping it, so an attacker can send a forum visitor a link
  that runs script in the site's origin.

  For the web root, /softbb and /cms whose index page carries the SoftBB
  footer, this check sends the post parameter a value that closes quotes and
  opens an element named after a random marker. The flaw is reported when the
  page returns that element unescaped and the same request sent to an absent
  script in the same folder does not reflect it. Nothing is stored on the
  target.
cves: [CVE-2014-9561]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [softbb, php, xss]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-9561"
  - "http://seclists.org/fulldisclosure/2015/Jan/21"
  - "http://www.securityfocus.com/bid/71987"
  - "http://packetstormsecurity.com/files/129889/SoftBB-0.1.3-Cross-Site-Scripting.html"

steps:
  - id: gen-marker
    action: script
    code: |
      let m = "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4);
      #{ marker: m, want: "<" + m + ">" }
    store_as: sc

  # ── Loop group: every following step runs once per folder ─────────────────
  - id: init-idx
    action: set_var
    var_name: idx
    var_value: {status: 0, body: ""}
    loop:
      var: v
      over:
        - {d: ""}
        - {d: "/softbb"}
        - {d: "/cms"}

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

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

  - id: init-ctrl-clean
    action: set_var
    var_name: ctrl_clean
    var_value: false

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

  - id: index
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{v.d}}/index.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: idx

  - id: init-isb
    action: set_var
    var_name: isb
    var_value: false

  - id: check-index
    action: script
    code: |
      type_of(idx.body) == "string" && idx.status >= 200 && idx.status < 400 && ereg("Copyright SoftBB", idx.body)
    store_as: isb

  - id: probe
    action: http_request
    method: GET
    path: "{{v.d}}/redir_last_post_list.php?post=1%27%22%3E%3C{{sc.marker}}%3E"
    port: "{{port}}"
    condition: "isb"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: probe_r

  - id: check
    action: script
    code: |
      let body = if type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      if isb && probe_r.status >= 200 && probe_r.status < 400 && body.contains(sc.want) { "reflected" } else { "" }
    store_as: hit

  # ── Control: the same payload to a random, absent .php script ────────────
  - id: control
    action: http_request
    method: GET
    path: "{{v.d}}/{{sc.marker}}.php?post=1%27%22%3E%3C{{sc.marker}}%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit != ""'
    store_as: ctrl_r

  - id: control-check
    action: script
    condition: 'hit != ""'
    code: |
      let body = if type_of(ctrl_r.body) == "string" { ctrl_r.body } else { "" };
      ctrl_r.status != 0 && !body.contains(sc.want)
    store_as: ctrl_clean

  - id: report
    action: match
    source: hit
    pattern: "^reflected$"
    condition: "ctrl_clean == true"
    on_match:
      finding:
        title: "SoftBB redir_last_post_list.php post parameter reflected cross-site scripting (CVE-2014-9561)"
        description: "An unauthenticated request to SoftBB's redir_last_post_list.php with the post parameter set to quote break-outs followed by an element named after a random marker returned that element unescaped in the page, while an absent script in the same folder did not reflect it. An attacker can send a forum visitor a link that runs any script in the site's origin, for example to steal the session cookie."
        remediation: "SoftBB is no longer maintained: replace it with a maintained forum. If you maintain the code, cast post to an integer, HTML-escape anything printed back, and do not print failed SQL queries to visitors."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{v.d}}/redir_last_post_list.php?post=1'\"><{{sc.marker}}> was reflected unescaped ({{sc.want}}) on a page of an install carrying the SoftBB footer; the same payload sent to an absent script ({{v.d}}/{{sc.marker}}.php) was not"
      stop: true

View these feeds on GitHub