iBill — 1 vulnerability check

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

← All products · Feeds on GitHub

iBill password management CGI (ibillpm.pl) weak default password

CVECVE-2001-0839
Severityhigh · CVSS 7.5
Categorydefault-credentials — Default credentials
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/ibill/CVE-2001-0839.yaml

Detects iBill's password management CGI (ibillpm.pl), which adds, deletes and changes members in the site's .htpasswd file for anyone who knows its password. That password defaults to the client's master account number, shown in the signup pages, followed by two lower-case letters, so it can be guessed in at most 676 tries. The feed first posts a random password with an invalid request type to ibillpm.pl in the common CGI directories and identifies the CGI by its bare numeric reply code. When the CGI checks the password first, it reads the account number from the site's signup pages and tries the 676 default passwords, always with an invalid request type so that no member is ever added, deleted or changed. A reply other than "authentication failed" proves the default password is accepted. When the account number cannot be found, the feed reports the reachable CGI with lower confidence. A site where every default password is refused is not reported.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST {{dir}}/ibillpm.pl with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{pg}}
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request POST {{cgi.dir}}/ibillpm.pl with a crafted body
  8. Parses / computes the next value with a Rhai script
  9. Parses / computes the next value with a Rhai script
  10. Checks crack.code for ^(50[2-8]|20[1-3])$ → finding QoD 97: iBill ibillpm.pl at …/ibillpm.pl accepted the default password (master account … from the signup page + a two-letter suffix, not shown): a …
  11. Checks cgi.code for ^50[1-8]$ → finding QoD 70: iBill ibillpm.pl at …/ibillpm.pl answered a POST with a random password and an invalid request type with the bare iBill code …; the default…

References:

Feed source — tests/vulnerabilities/ibill/CVE-2001-0839.yaml
# iBill password management CGI (ibillpm.pl) weak default password (CVE-2001-0839)
#
# Ported from OpenVAS/Greenbone NVT `pre2008/ibillpm_detect.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.11083, GPL-2.0-only), which only reports that
# ibillpm.pl exists in a CGI directory (any non-404 answer).
#
# Background (Bugtraq, 2001-10, BID 3476, EDB-21129): iBill's server drives the
# site's ibillpm.pl with form POSTs
#   authpwd=<pwd>&reqtype=<add|delete|chgpwd>&username=<u>&password=<p>&submit=Submit
# and the CGI answers HTTP 200 with a bare numeric code (501 auth failed,
# 502 invalid request type, 503-508 file / user errors, 201-203 success).
# iBill set authpwd to the client's MASTER_ACCOUNT (published in the hidden
# `account` field of the site's signup pages, e.g. value="123456-500" or
# "123456500", last 3 digits = sub-account) followed by two lower-case
# letters: 676 candidates, after which anyone can add/delete .htpasswd users.
#
# Detection:
#   1. For each CGI dir, POST a random authpwd with an INVALID reqtype. The
#      CGI is identified when the reply is HTTP 200 with a bare iBill code
#      (501-508). 501 means the password is checked before the request type.
#   2. When it answered 501, read the signup pages for the hidden account
#      field and try the 676 MASTER_ACCOUNT + [a-z][a-z] passwords, still with
#      an invalid reqtype. A reply other than 501 proves the password was
#      accepted (QoD 97). Nothing is written: add/delete/chgpwd are never sent.
#   3. When the weak password could not be tried (no account number found, or
#      the CGI rejects the request type first, or 3 tries got no answer —
#      no 2-hour stall on a target that starts dropping us), report the CGI at
#      QoD 70.
#      When all 676 were tried and refused, the site uses a non-default
#      password: no finding.
#
# Better than the NASL: the NASL reports any non-404 answer for the file name
# (a catch-all 200/403 page is a finding); this feed requires the CGI's own
# reply format, and proves the weak password itself when the account number
# is published, while staying silent on sites that changed it.
uid: eb2e6ac0-868c-4628-b7dd-1c29debbb0a8
name: "iBill password management CGI (ibillpm.pl) weak default password (CVE-2001-0839)"
description: |
  Detects iBill's password management CGI (ibillpm.pl), which adds, deletes
  and changes members in the site's .htpasswd file for anyone who knows its
  password. That password defaults to the client's master account number,
  shown in the signup pages, followed by two lower-case letters, so it can be
  guessed in at most 676 tries.
  The feed first posts a random password with an invalid request type to
  ibillpm.pl in the common CGI directories and identifies the CGI by its bare
  numeric reply code. When the CGI checks the password first, it reads the
  account number from the site's signup pages and tries the 676 default
  passwords, always with an invalid request type so that no member is ever
  added, deleted or changed. A reply other than "authentication failed"
  proves the default password is accepted. When the account number cannot be
  found, the feed reports the reachable CGI with lower confidence. A site
  where every default password is refused is not reported.
cves: [CVE-2001-0839]
cvss: 7.5
severity: high
category: default-credentials
confidence_base: 0.20
tags: [ibill, cgi, perl, weak-password, brute-force, intrusive, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-0839"
  - "https://www.exploit-db.com/exploits/21129"
  - "https://seclists.org/bugtraq/2001/Oct/242"
  - "OpenVAS/Greenbone NASL pre2008/ibillpm_detect.nasl (GPL-2.0-only)"

steps:
  # Random control password and an invalid request type (never add/delete/chgpwd).
  - id: gen
    action: script
    code: |
      #{ pwd: "noctis" + rand_str(10), req: "noctis" + rand_str(6) }
    store_as: rnd

  # Result of the CGI search: found / dir / reply code of the control POST.
  - id: init-cgi
    action: set_var
    var_name: cgi
    var_value: {found: false, dir: "", code: ""}

  - id: init-acct
    action: set_var
    var_name: acct
    var_value: ""

  - id: init-crack
    action: set_var
    var_name: crack
    var_value: {hit: false, code: ""}

  # Unanswered password tries; the brute force stops after 3.
  - id: init-fails
    action: set_var
    var_name: fails
    var_value: 0

  # ── 1. Find the CGI (loop group: every step until the next loop) ────────
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/cgi-bin", "/scripts", "", "/cgi", "/cgi-local"]

  - id: probe
    action: http_request
    method: POST
    path: "{{dir}}/ibillpm.pl"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "authpwd={{rnd.pwd}}&reqtype={{rnd.req}}&username={{rnd.req}}&password={{rnd.pwd}}&submit=Submit"
    condition: "cgi.found == false"
    store_as: probe

  - id: classify
    action: script
    code: |
      if cgi.found {
        cgi
      } else {
        let b = if type_of(probe.body) == "string" { probe.body } else { "" };
        let m = eregmatch("^\\s*(50[1-8])\\s*$", b);
        if probe.status == 200 && m.len() > 1 {
          #{ found: true, dir: dir, code: m[1] }
        } else {
          cgi
        }
      }
    store_as: cgi

  # ── 2. Read the account number from the signup pages ────────────────────
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: pg
      over: ["/", "/join.html", "/join.htm", "/signup.html", "/signup.htm", "/index.html"]

  - id: page
    action: http_request
    method: GET
    path: "{{pg}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    condition: "cgi.found && cgi.code == \"501\" && acct == \"\""
    store_as: page

  - id: account
    action: script
    code: |
      if acct != "" {
        acct
      } else {
        let b = if type_of(page.body) == "string" { page.body } else { "" };
        let v = "";
        let m = eregmatch("<input[^>]*name\\s*=\\s*[\"']?account[\"']?[^>]*value\\s*=\\s*[\"']?\\s*([0-9]+)(-[0-9]+)?", b, true);
        if m.len() > 1 { v = m[1]; if m[2] == "" && v.len() > 3 { v = v.sub_string(0, v.len() - 3); } }
        if v == "" {
          let m2 = eregmatch("<input[^>]*value\\s*=\\s*[\"']?\\s*([0-9]+)(-[0-9]+)?[\"']?[^>]*name\\s*=\\s*[\"']?account[\"'\\s>/]", b, true);
          if m2.len() > 1 { v = m2[1]; if m2[2] == "" && v.len() > 3 { v = v.sub_string(0, v.len() - 3); } }
        }
        if v.len() >= 3 { v } else { "" }
      }
    store_as: acct

  # ── 3. Try MASTER_ACCOUNT + [a-z][a-z], invalid reqtype (read-only) ─────
  - id: suffix
    action: script
    code: |
      let al = "abcdefghijklmnopqrstuvwxyz";
      al.sub_string(i / 26, 1) + al.sub_string(i % 26, 1)
    store_as: sfx
    loop:
      var: i
      count: 676

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

  - id: attempt
    action: http_request
    method: POST
    path: "{{cgi.dir}}/ibillpm.pl"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "authpwd={{acct}}{{sfx}}&reqtype={{rnd.req}}&username={{rnd.req}}&password={{rnd.pwd}}&submit=Submit"
    timeout_secs: 4
    condition: "cgi.found && cgi.code == \"501\" && acct != \"\" && fails < 3"
    store_as: att

  - id: count-fails
    action: script
    code: |
      if att.status == 0 { fails + 1 } else { fails }
    store_as: fails

  - id: judge
    action: script
    code: |
      let b = if type_of(att.body) == "string" { att.body } else { "" };
      let m = eregmatch("^\\s*(50[2-8]|20[1-3])\\s*$", b);
      if att.status == 200 && m.len() > 1 { #{ hit: true, code: m[1] } } else { #{ hit: false, code: "" } }
    store_as: crack

  - id: weak-password
    action: match
    source: crack.code
    pattern: "^(50[2-8]|20[1-3])$"
    condition: "crack.hit"
    on_match:
      finding:
        confidence_delta: 0.75
        qod: 97
        evidence: "iBill ibillpm.pl at {{cgi.dir}}/ibillpm.pl accepted the default password (master account {{acct}} from the signup page + a two-letter suffix, not shown): a random password got code 501 (authentication failed), the default one got code {{crack.code}} for an invalid request type — no member was added, deleted or changed"
      stop: true

  # ── 4. CGI found but the default password could not be tried ────────────
  - id: init-fp
    action: set_var
    var_name: fp
    var_value: ""
    loop:
      var: once
      over: ["once"]

  - id: fingerprint
    action: match
    source: cgi.code
    pattern: "^50[1-8]$"
    condition: "cgi.found && !(cgi.code == \"501\" && acct != \"\" && fails < 3)"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 70
        evidence: "iBill ibillpm.pl at {{cgi.dir}}/ibillpm.pl answered a POST with a random password and an invalid request type with the bare iBill code {{cgi.code}}; the default password (master account + two letters) could not be tried (no account number on the signup pages, request type checked first, or the CGI stopped answering)"
      stop: true

View these feeds on GitHub