EMO Realty Manager — 1 vulnerability check

noctis ships 1 vulnerability check for EMO Realty 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

EMO Realty Manager googlemap/index.php cat1 SQL injection

CVECVE-2010-5006
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/emo-realty-manager/CVE-2010-5006.yaml

EMO Realty Manager passes the cat1 parameter of googlemap/index.php into an SQL query without sufficient escaping, so an unauthenticated visitor can inject SQL into the application's database.

Under the usual install paths (/emo_virtual, /emorealty and the web root), this check first confirms the EMO Realty Manager page title on index.php, then requests the map page with a random token as a control, then with a single quote appended to the token, and then with two quotes. The vulnerability is reported when only the single-quote request prints a MySQL syntax error, while the control and the balanced two-quote request print none. Nothing is written and no data is read from the database.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{adir}}/index.php
  3. HTTP(S) request GET {{adir}}/googlemap/index.php?{{q.ctl}}
  4. HTTP(S) request GET {{adir}}/googlemap/index.php?{{q.one}}
  5. HTTP(S) request GET {{adir}}/googlemap/index.php?{{q.two}}
  6. Parses / computes the next value with a Rhai script
  7. Checks res.ok for ^true$ → finding QoD 75: EMO Realty Manager cat1 SQL injection (CVE-2010-5006)

References:

Feed source — tests/vulnerabilities/emo-realty-manager/CVE-2010-5006.yaml
# EMO Realty Manager — googlemap/index.php cat1 SQL injection (CVE-2010-5006)
#
# The Google-map page of EMO Realty Manager builds its listing query from the cat1
# parameter without escaping, so a lone quote breaks the query and the page prints the
# MySQL syntax error.
#
# Detection (QoD 75), per candidate install dir (/emo_virtual, /emorealty, web root):
#   1. <dir>/index.php must carry the "EMO Realty Manager" page title (product gate).
#   2. googlemap/index.php?cat1=<random token> (control) prints no SQL error.
#   3. cat1=<token>' (one quote) prints a MySQL syntax error.
#   4. cat1=<token>'' (two quotes, a quoted literal quote in SQL) prints none: the page
#      does not simply print an error for any quote character.
# Read-only: the payloads are quote characters; nothing is written or read from the DB.
#
# Better than the source NASL: it fires on one quote probe alone; here a clean control and
# a balanced-quote probe rule out pages that print an error for any quote.
# CVSS: NVD carries only a CVSS v2 score (7.5) for this CVE.
#
# Source: OpenVAS/Greenbone NVT 2011/gb_emo_realty_manager_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.802342, GPL-2.0-only).
uid: 76ed6ab9-fd7e-4187-b316-897227a22248
name: "EMO Realty Manager googlemap/index.php cat1 SQL injection (CVE-2010-5006)"
description: |
  EMO Realty Manager passes the cat1 parameter of googlemap/index.php into an SQL query
  without sufficient escaping, so an unauthenticated visitor can inject SQL into the
  application's database.

  Under the usual install paths (/emo_virtual, /emorealty and the web root), this check
  first confirms the EMO Realty Manager page title on index.php, then requests the map
  page with a random token as a control, then with a single quote appended to the token,
  and then with two quotes. The vulnerability is reported when only the single-quote
  request prints a MySQL syntax error, while the control and the balanced two-quote
  request print none. Nothing is written and no data is read from the database.
cves: [CVE-2010-5006]
cvss: 7.5  # NVD publishes only a CVSS v2 base score (7.5) for this CVE
severity: high
category: sqli
confidence_base: 0.30
tags: [emo-realty-manager, php, sqli, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-5006"

steps:
  - id: gen
    action: script
    code: |
      let t = "nc" + rand_hex(5);
      #{ ctl: "cat1=" + t, one: "cat1=" + t + "%27", two: "cat1=" + t + "%27%27" }
    store_as: q

  # A loop: step runs together with every following non-loop step once per directory, so
  # the init steps below reset all stored results at the start of each iteration.
  - id: init-home
    action: set_var
    var_name: home_resp
    var_value: {status: 0, body: null}
    loop:
      over: ["/emo_virtual", "/emorealty", ""]
      var: adir

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

  - id: init-one
    action: set_var
    var_name: one_resp
    var_value: {status: 0, body: null}

  - id: init-two
    action: set_var
    var_name: two_resp
    var_value: {status: 0, body: null}

  - id: home
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/index.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: home_resp

  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/googlemap/index.php?{{q.ctl}}"
    condition: 'home_resp.status == 200 && type_of(home_resp.body) == "string" && ereg("(?i)<title>EMO Realty Manager", home_resp.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl_resp

  - id: inject-one
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/googlemap/index.php?{{q.one}}"
    condition: 'ctl_resp.status == 200 && type_of(ctl_resp.body) == "string" && !ereg("(?i)(error in your SQL syntax|mysql_fetch|MySQL server version)", ctl_resp.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: one_resp

  - id: inject-two
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/googlemap/index.php?{{q.two}}"
    condition: 'one_resp.status >= 200 && one_resp.status < 500 && type_of(one_resp.body) == "string" && ereg("error in your SQL syntax", one_resp.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: two_resp

  - id: check
    action: script
    code: |
      let o = if type_of(one_resp.body) == "string" { one_resp.body } else { "" };
      let t = if type_of(two_resp.body) == "string" { two_resp.body } else { "" };
      let ok = two_resp.status == 200
        && ereg("error in your SQL syntax", o)
        && !ereg("(?i)(error in your SQL syntax|mysql_fetch|MySQL server version)", t);
      #{ ok: ok }
    store_as: res

  - id: report
    action: match
    source: res.ok
    pattern: "^true$"
    condition: "res.ok"
    on_match:
      finding:
        title: "EMO Realty Manager cat1 SQL injection (CVE-2010-5006)"
        description: "A single quote appended to the cat1 parameter of googlemap/index.php made EMO Realty Manager print a MySQL syntax error, while the same request without the quote and with a balanced pair of quotes printed none: the value reaches an SQL statement unescaped, so an unauthenticated attacker can run arbitrary SQL against the application database."
        remediation: "Upgrade EMO Realty Manager to a release that escapes the cat1 parameter, or remove the googlemap page; no vendor fix is known for the original product, so consider replacing it with a maintained real-estate application."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/googlemap/index.php: cat1=<token> answers without a database error, cat1=<token>' answers with an SQL syntax error, cat1=<token>'' answers without one"
      stop: true

View these feeds on GitHub