Scripteen Image Hosting — 1 vulnerability check

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

← All products · Feeds on GitHub

Scripteen Free Image Hosting Script cookgid Cookie Authentication Bypass

CVECVE-2009-4987
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/scripteen-image-hosting/CVE-2009-4987.yaml

Scripteen Free Image Hosting Script 2.3 and earlier decides who is an administrator from a "cookgid" cookie sent by the browser whenever no login session exists. Setting that cookie to 1, the administrator group, opens the administration area without any password. The vendor published version 2.4 after the report; the product is no longer maintained.

The check finds the application by its login page (login.php, showing the product name or the member login form) in the web root and the usual install directories. It then requests the administration area (admin/) twice without following redirects: once with "cookgid" set to a random non-administrator group as a control, and once with "cookgid" set to 1. The vulnerability is confirmed when only the second request returns the administration dashboard ("Admin Control Panel" with the member and image totals), proving that the forged cookie alone grants administrator access. The requests only read the dashboard and change nothing.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/login.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/admin/
  5. HTTP(S) request GET {{dir}}/admin/
  6. Parses / computes the next value with a Rhai script
  7. Checks hit for ^/ → finding QoD 97: Scripteen Free Image Hosting Script cookgid Cookie Authentication Bypass (CVE-2009-4987)

References:

Feed source — tests/vulnerabilities/scripteen-image-hosting/CVE-2009-4987.yaml
# Scripteen Free Image Hosting Script 2.3 — admin/header.php "cookgid" cookie
# authentication bypass — CVE-2009-4987 (EDB-9256, OSVDB-56539)
#
# Tracking issue: CVE-2009-2892 (backlog #1402). That record is the SQL
# injection through the same unfiltered cookies in header.php (EDB-9252, an
# authenticated UNION on profile.php). The check this feed ports does not
# inject anything: it sends "Cookie: cookgid=1" to /admin/ and looks for the
# administration dashboard, which is the authentication bypass NVD records as
# CVE-2009-4987 ("bypass authentication ... by setting the cookgid cookie value
# to 1"). The feed therefore names CVE-2009-4987 only.
#
# Vulnerable code (admin/header.php, 2.3, quoted in EDB-9256), included by
# every admin page:
#     $userid=$_SESSION['userid']; $usergid=$_SESSION['usergid'];
#     if (!$userid || empty($userid) || $userid==""){
#         $userid = $_COOKIE['cookid']; $usergid = $_COOKIE['cookgid']; }
#     if($usergid!="1") { header("Location: logout.php"); exit; }
# With no session, the group id comes straight from the client cookie, so
# cookgid=1 is the administrator group. The vendor announced 2.4 right after
# the "my image hosting site got hacked" forum thread (both cited by NVD for
# CVE-2009-2892); no fixed source could be checked.
# The vendor source is not public any more; the page markers are the ones
# the public reports and the source check rely on.
#
# Detection (read-only), per candidate install dir (web root + usual dirs):
#   1. GET <dir>/login.php must name "Scripteen Free Image Hosting Script"
#      (footer) or carry the member login form fields uname + pass.
#   2. Control: GET <dir>/admin/ with "Cookie: cookgid=<random 2..9999>",
#      redirects not followed — must be answered (2xx/3xx) WITHOUT the
#      dashboard totals (the vulnerable code redirects to logout.php).
#   3. Probe: the same request with "Cookie: cookgid=1" — 200 with
#      "Admin Control Panel", "Total Members" and "Total images".
#   QoD 97: the administrator dashboard is reached with a forged cookie, and
#   the differential control proves the cookie value is what grants it.
#
# Better than the source check (markers on the cookgid=1 reply only):
#   - The control with another group id rules out an admin area that is open
#     to everyone, or a front end serving the same page for any request.
#   - Several install dirs; redirects are not followed.
#
# CVSS: NVD v2 7.5 (no v3 score published).
#
# Ported from OpenVAS/Greenbone NVT 2009/scripteen_multiple.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100246, GPL-2.0-only).
uid: f0fbbda8-83ab-4c18-b5a0-10defa913a15
name: "Scripteen Free Image Hosting Script cookgid Cookie Authentication Bypass (CVE-2009-4987)"
description: |
  Scripteen Free Image Hosting Script 2.3 and earlier decides who is an
  administrator from a "cookgid" cookie sent by the browser whenever no
  login session exists. Setting that cookie to 1, the administrator group,
  opens the administration area without any password. The vendor published
  version 2.4 after the report; the product is no longer maintained.

  The check finds the application by its login page (login.php, showing the
  product name or the member login form) in the web root and the usual
  install directories. It then requests the administration area (admin/)
  twice without following redirects: once with "cookgid" set to a random
  non-administrator group as a control, and once with "cookgid" set to 1.
  The vulnerability is confirmed when only the second request returns the
  administration dashboard ("Admin Control Panel" with the member and image
  totals), proving that the forged cookie alone grants administrator access.
  The requests only read the dashboard and change nothing.
cves: [CVE-2009-4987]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [scripteen, image-hosting, php, auth-bypass, cookie]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4987"
  - "https://www.exploit-db.com/exploits/9256"
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-2892"
  - "https://www.exploit-db.com/exploits/9252"
  # OpenVAS/Greenbone NASL 2009/scripteen_multiple.nasl (GPL-2.0-only)

steps:
  - id: mint
    action: script
    code: 'rand_int(2, 9999).to_string()'
    store_as: ctl_gid

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

  # ── Loop group: every step below runs once per candidate install dir ─────
  - id: init-fp
    action: set_var
    var_name: fp
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/scripteen", "/imagehosting", "/imagehost", "/hosting", "/images"]

  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {status: 0, body: ""}

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

  - id: init-app
    action: set_var
    var_name: is_app
    var_value: false

  - id: fetch-login
    action: http_request
    method: GET
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == ""'
    store_as: fp

  - id: gate
    action: script
    condition: 'hit == ""'
    code: |
      // product footer, or the member login form the public PoC posts to
      // (uname + pass fields), for sites whose footer was removed
      fp.status == 200 && type_of(fp.body) == "string"
        && (egrep("(?i)Scripteen Free Image Hosting Script", fp.body) != ""
            || (egrep("(?i)name\\s*=\\s*[\"']?uname[\"' >]", fp.body) != ""
                && egrep("(?i)name\\s*=\\s*[\"']?pass[\"' >]", fp.body) != ""))
    store_as: is_app

  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/admin/"
    port: "{{port}}"
    headers:
      Cookie: "cookgid={{ctl_gid}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit == "" && is_app == true'
    store_as: ctl

  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/admin/"
    port: "{{port}}"
    headers:
      Cookie: "cookgid=1"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit == "" && is_app == true'
    store_as: prb

  - id: verdict
    action: script
    condition: 'hit == "" && is_app == true'
    code: |
      let pb = if type_of(prb.body) == "string" { prb.body } else { "" };
      let cb = if type_of(ctl.body) == "string" { ctl.body } else { "" };
      let panel = prb.status == 200
        && egrep("(?i)Admin Control Panel", pb) != ""
        && egrep("(?i)Total Members", pb) != ""
        && egrep("(?i)Total images", pb) != "";
      // the control must have been answered, and without the dashboard data
      // (the totals only print after the group check passed; a page title
      // printed before header.php could still show up in a refused reply)
      let ctl_ok = ctl.status >= 200 && ctl.status < 400
        && egrep("(?i)Total Members", cb) == "";
      if panel && ctl_ok { (if dir == "" { "/" } else { dir }) } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "^/"
    on_match:
      finding:
        title: "Scripteen Free Image Hosting Script cookgid Cookie Authentication Bypass (CVE-2009-4987)"
        description: "The administration area (admin/) returned the administrator dashboard to a request whose only credential was a forged \"cookgid=1\" cookie, while the same request with another group id did not: the application takes the user's group from a client-side cookie when no session exists, so anyone can act as administrator."
        remediation: "Scripteen Free Image Hosting Script is no longer maintained: remove it, or at least restrict the admin/ directory to trusted addresses (web server access rules or HTTP authentication) and make admin/header.php rely on the server-side session only, never on the cookgid/cookid cookies. The vendor published version 2.4 after the report; a fixed release could not be confirmed."
        confidence_delta: 0.65
        qod: 97
        evidence: "install dir {{hit}}: GET admin/ with Cookie cookgid=1 returned HTTP 200 with \"Admin Control Panel\", \"Total Members\" and \"Total images\"; the same request with cookgid={{ctl_gid}} did not return the dashboard"
      stop: true

View these feeds on GitHub