MYRE — 1 vulnerability check

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

← All products · Feeds on GitHub

MYRE Real Estate Software findagent.php XSS and SQL injection

CVECVE-2011-3393, CVE-2011-3394
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/myre/CVE-2011-3393.yaml

MYRE Real Estate Software does not sanitise the country1, state1 and city1 parameters of findagent.php before printing them (reflected cross-site scripting), and places the page parameter of the same script into an SQL query without validation (SQL injection).

Under /realestate and the web root, this check first confirms the "MYRE Real Estate Software" text on index.php. It then requests findagent.php with a random bold-tag marker in country1 and reports the XSS when the marker returns with its tags intact. For the SQL injection it requests page=1 and page=1 and 1=1 as controls, which must not raise a database error, then page=' and reports the flaw when a MySQL "You have an error in your SQL syntax" page comes back. Nothing is written and no data is read.

How noctis detects it

  1. HTTP(S) request GET {{adir}}/index.php
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{adir}}/findagent.php?country1=%22%3E%3Cb%3E{{mk}}%3C%2Fb%3E
  4. Parses / computes the next value with a Rhai script
  5. Checks xss_resp.body for NOCTIS → finding QoD 75: MYRE Real Estate Software findagent.php cross-site scripting (CVE-2011-3393)
  6. HTTP(S) request GET {{adir}}/findagent.php?page=1
  7. HTTP(S) request GET {{adir}}/findagent.php?page=1+and+1%3D1
  8. HTTP(S) request GET {{adir}}/findagent.php?page=%27
  9. Parses / computes the next value with a Rhai script
  10. Checks inj_resp.body for error in your SQL syntax → finding QoD 75: MYRE Real Estate Software findagent.php SQL injection (CVE-2011-3394)

References:

Feed source — tests/vulnerabilities/myre/CVE-2011-3393.yaml
# MYRE Real Estate Software — findagent.php country1/state1/city1 reflected XSS
# (CVE-2011-3393) and page parameter SQL injection (CVE-2011-3394)
#
# Detection (per candidate dir: /realestate, then the web root):
#   0. index.php must carry the "MYRE Real Estate Software" page text.
#   1. XSS, QoD 75 — findagent.php?country1="><b>MARKER</b> (random marker)
#      answers 200 with the markup returned unescaped.
#   2. SQLi, QoD 75 — findagent.php?page=1 and page=1+and+1=1 (valid
#      conditions) answer with no database error, then page=' answers with a
#      MySQL "You have an error in your SQL syntax" page: our raw quote
#      reached the query.
#
# Read-only: the XSS marker is inert markup, the SQL payload is a lone quote;
# nothing is written, no data is read.
#
# Ported from OpenVAS/Greenbone NVT `2011/gb_myre_real_estate_mult_xss_n_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.802157, GPL-2.0-only). Improvements: the XSS uses
# a random inert marker instead of a script payload, and the SQL error must be
# absent for the two valid controls, so a page that always prints a database
# error is not reported.
# CVSS: NVD carries only CVSS v2 scores (XSS 4.3, SQLi 7.5).
uid: 010352d4-35a0-4ddc-8264-1d58becf6cac
name: "MYRE Real Estate Software findagent.php XSS and SQL injection (CVE-2011-3393, CVE-2011-3394)"
description: |
  MYRE Real Estate Software does not sanitise the country1, state1 and city1
  parameters of findagent.php before printing them (reflected cross-site
  scripting), and places the page parameter of the same script into an SQL
  query without validation (SQL injection).

  Under /realestate and the web root, this check first confirms the
  "MYRE Real Estate Software" text on index.php. It then requests
  findagent.php with a random bold-tag marker in country1 and reports the XSS
  when the marker returns with its tags intact. For the SQL injection it
  requests page=1 and page=1 and 1=1 as controls, which must not raise a
  database error, then page=' and reports the flaw when a MySQL "You have an
  error in your SQL syntax" page comes back. Nothing is written and no data
  is read.
cves: [CVE-2011-3393, CVE-2011-3394]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [myre, real-estate, php, sqli, xss, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-3393"
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-3394"

steps:
  - id: init-idx
    action: set_var
    var_name: idx
    var_value: {status: 0, body: null}
    loop:
      over: ["/realestate", ""]
      var: adir

  - id: init-xss
    action: set_var
    var_name: xss_resp
    var_value: {status: 0, body: null}

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

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

  - id: init-inj
    action: set_var
    var_name: inj_resp
    var_value: {status: 0, body: null}

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

  - id: marker
    action: script
    code: |
      "NOCTIS" + oob_token.sub_string(0, 8)
    store_as: mk

  - id: xss-get
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/findagent.php?country1=%22%3E%3Cb%3E{{mk}}%3C%2Fb%3E"
    condition: 'idx.status == 200 && type_of(idx.body) == "string" && stridx(idx.body, "MYRE Real Estate Software") >= 0'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: xss_resp

  - id: xss-check
    action: script
    code: |
      let b = if type_of(xss_resp.body) == "string" { xss_resp.body } else { "" };
      #{ hit: xss_resp.status == 200 && stridx(b, "\"><b>" + mk + "</b>") >= 0 }
    store_as: xres

  - id: xss-report
    action: match
    source: xss_resp.body
    pattern: "NOCTIS"
    condition: "xres.hit"
    on_match:
      finding:
        title: "MYRE Real Estate Software findagent.php cross-site scripting (CVE-2011-3393)"
        description: "findagent.php returned a random bold-tag marker sent in country1 with the quote and tags unescaped, so markup or script supplied in country1, state1 or city1 runs in the browser of anyone who follows a crafted link."
        remediation: "HTML-encode country1, state1 and city1 before printing them; upgrade MYRE Real Estate Software to a release that fixes CVE-2011-3393."
        cves: [CVE-2011-3393]
        cvss: 4.3
        severity: medium
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/findagent.php: country1 marker returned inside unescaped \"><b> markup"

  - id: control-plain
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/findagent.php?page=1"
    condition: 'idx.status == 200 && type_of(idx.body) == "string" && stridx(idx.body, "MYRE Real Estate Software") >= 0'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl1

  - id: control-true
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/findagent.php?page=1+and+1%3D1"
    condition: 'ctl1.status == 200 && type_of(ctl1.body) == "string" && !ereg("error in your SQL syntax", ctl1.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl2

  - id: inject
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/findagent.php?page=%27"
    condition: 'ctl2.status == 200 && type_of(ctl2.body) == "string" && !ereg("error in your SQL syntax", ctl2.body)'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: inj_resp

  - id: check
    action: script
    code: |
      let b = if type_of(inj_resp.body) == "string" { inj_resp.body } else { "" };
      #{ err: inj_resp.status >= 200 && inj_resp.status < 600 && ereg("You have an error in your SQL syntax;", b) }
    store_as: res

  - id: report
    action: match
    source: inj_resp.body
    pattern: "error in your SQL syntax"
    condition: "res.err"
    on_match:
      finding:
        title: "MYRE Real Estate Software findagent.php SQL injection (CVE-2011-3394)"
        description: "The valid conditions page=1 and page=1 and 1=1 returned the page, while page=' made MySQL print a You have an error in your SQL syntax message: the value reaches an SQL query unescaped, so an unauthenticated attacker can run arbitrary SQL against the application database."
        remediation: "Cast page to an integer or use prepared statements in findagent.php; upgrade MYRE Real Estate Software to a release that fixes CVE-2011-3394."
        cves: [CVE-2011-3394]
        cvss: 7.5
        severity: high
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/findagent.php: page=1 and page=1 and 1=1 answer normally, page=' answers with a MySQL syntax error"
      stop: true

View these feeds on GitHub