Eclime — 2 vulnerability checks

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

← All products · Feeds on GitHub

Eclime 1.1.2b index.php ref parameter SQL injection

CVECVE-2010-4851
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/eclime/CVE-2010-4851.yaml

Eclime 1.1.2b puts the ref and poll_id parameters of index.php and the country parameter of create_account.php into SQL queries without escaping them, allowing unauthenticated SQL injection against the shop database.

Under the web root, /eclime and /eclime/catalog, this check identifies Eclime from the home page, then requests index.php with ref=1 as a control and again with a single quote appended to the value. A database syntax error that appears only for the quoted request proves the value reaches the query unescaped. Nothing is written and no data is read from the database.

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}}/index.php?ref=1
  4. HTTP(S) request GET {{adir}}/index.php?ref=1%27
  5. Parses / computes the next value with a Rhai script
  6. Checks res.sqli for ^true$ → finding QoD 75: Eclime index.php ref parameter SQL injection (CVE-2010-4851)

References:

Feed source — tests/vulnerabilities/eclime/CVE-2010-4851.yaml
# Eclime 1.1.2b — index.php ref parameter SQL injection (CVE-2010-4851)
#
# index.php puts its ref (and poll_id) parameter into an SQL query without
# escaping it; create_account.php does the same with country. Only ref is
# probed. The login.php reason XSS of the same advisory (CVE-2010-4852) is
# the sibling feed CVE-2010-4852.yaml.
#
# Detection (per candidate install dir: web root, /eclime, /eclime/catalog):
#   0. index.php must carry the Eclime markers (">eclime</" and
#      "> e-commerce software.<").
#   1. QoD 75 — index.php?ref=1 (control) carries no database error, then
#      index.php?ref=1' (a single quote) answers with a MySQL syntax error.
#
# Read-only: the only payload is a quote character; nothing is written and no
# data is read from the database.
#
# Ported from OpenVAS/Greenbone NVT `2011/gb_eclime_mult_sql_inj_n_xss_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.801810, GPL-2.0-only). Differences: the NASL
# stops at its first hit and sends the quote without a control request; here
# the quote must differ from a clean control, and the XSS has its own feed.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: 3143e402-85da-4391-bf0f-6dbfc3bbc6e1
name: "Eclime 1.1.2b index.php ref parameter SQL injection (CVE-2010-4851)"
description: |
  Eclime 1.1.2b puts the ref and poll_id parameters of index.php and the
  country parameter of create_account.php into SQL queries without escaping
  them, allowing unauthenticated SQL injection against the shop database.

  Under the web root, /eclime and /eclime/catalog, this check identifies
  Eclime from the home page, then requests index.php with ref=1 as a control
  and again with a single quote appended to the value. A database syntax
  error that appears only for the quoted request proves the value reaches
  the query unescaped. Nothing is written and no data is read from the
  database.
cves: [CVE-2010-4851]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [eclime, php, sqli, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-4851"

steps:
  # Pre-initialise every stored result a script reads: a failed request leaves
  # store_as unset and an undefined var would abort the whole test.
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/eclime", "/eclime/catalog"]
      var: adir

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

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

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

  - id: gate
    action: script
    code: |
      let b = if type_of(home.body) == "string" { home.body } else { "" };
      #{ ok: home.status == 200 && b.contains(">eclime</") && b.contains("> e-commerce software.<") }
    store_as: g

  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/index.php?ref=1"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctl_resp

  - id: inject
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/index.php?ref=1%27"
    condition: 'g.ok && 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: inj_resp

  - id: check
    action: script
    code: |
      let ib = if type_of(inj_resp.body) == "string" { inj_resp.body } else { "" };
      let sqli = g.ok && inj_resp.status >= 200 && inj_resp.status < 500 && ereg("(?i)(error in your SQL syntax|mysql_fetch|MySQL server version)", ib);
      #{ sqli: sqli }
    store_as: res

  - id: report-sqli
    action: match
    source: res.sqli
    pattern: "^true$"
    condition: "res.sqli"
    on_match:
      finding:
        title: "Eclime index.php ref parameter SQL injection (CVE-2010-4851)"
        description: "A single quote appended to the ref parameter of index.php made Eclime print a database syntax error, while the same request without the quote did not: the value reaches an SQL query unescaped, so an unauthenticated attacker can run arbitrary SQL against the shop database (poll_id and create_account.php country are affected the same way)."
        remediation: "Upgrade Eclime past 1.1.2b, or cast ref, poll_id and country to integers / escape them before using them in SQL queries."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/index.php: ref=1 answers without a database error, ref=1' answers with an SQL syntax error"
      stop: true

Eclime 1.1.2b login.php reason cross-site scripting

CVECVE-2010-4852
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/eclime/CVE-2010-4852.yaml

Eclime 1.1.2b prints the reason parameter of a failed login in login.php back into the page without HTML-encoding it, so an attacker can run script in the browser of any user who opens a crafted link (cross-site scripting).

Under the web root, /eclime and /eclime/catalog, this check identifies Eclime from the home page, then requests login.php with a harmless script tag carrying a random marker in the reason parameter. The finding is reported when the tag comes back verbatim, unencoded. Nothing is written to the target.

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}}/login.php?login=fail&reason=%3Cscript%3E{{g.mk}}%3C/script%3E
  4. Parses / computes the next value with a Rhai script
  5. Checks res.xss for ^true$ → finding QoD 75: Eclime login.php reason cross-site scripting (CVE-2010-4852)

References:

Feed source — tests/vulnerabilities/eclime/CVE-2010-4852.yaml
# Eclime 1.1.2b — login.php reason reflected cross-site scripting (CVE-2010-4852)
#
# login.php prints the reason parameter of a failed login back into the page
# without HTML-encoding it. The SQL injections of the same advisory
# (CVE-2010-4851) are the sibling feed CVE-2010-4851.yaml.
#
# Detection (per candidate install dir: web root, /eclime, /eclime/catalog):
#   0. index.php must carry the Eclime markers (">eclime</" and
#      "> e-commerce software.<").
#   1. QoD 75 — login.php?login=fail&reason=<script>MARK</script> (MARK random
#      per run) comes back with the tag unencoded.
#
# Read-only: one GET with a random inert marker, nothing is written.
#
# Ported from OpenVAS/Greenbone NVT `2011/gb_eclime_mult_sql_inj_n_xss_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.801810, GPL-2.0-only). Differences: the NASL
# reflects a fixed alert(document.cookie) payload; here a random inert marker
# is used and the reply must carry the whole tag verbatim.
# CVSS: NVD carries only a CVSS v2 score (4.3).
uid: eac4b28b-8279-4b8c-8b49-de5d96002e18
name: "Eclime 1.1.2b login.php reason cross-site scripting (CVE-2010-4852)"
description: |
  Eclime 1.1.2b prints the reason parameter of a failed login in login.php
  back into the page without HTML-encoding it, so an attacker can run script
  in the browser of any user who opens a crafted link (cross-site scripting).

  Under the web root, /eclime and /eclime/catalog, this check identifies
  Eclime from the home page, then requests login.php with a harmless script
  tag carrying a random marker in the reason parameter. The finding is
  reported when the tag comes back verbatim, unencoded. Nothing is written to
  the target.
cves: [CVE-2010-4852]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [eclime, php, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-4852"

steps:
  # Pre-initialise every stored result a script reads: a failed request leaves
  # store_as unset and an undefined var would abort the whole test.
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/eclime", "/eclime/catalog"]
      var: adir

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

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

  - id: gate
    action: script
    code: |
      let b = if type_of(home.body) == "string" { home.body } else { "" };
      #{ ok: home.status == 200 && b.contains(">eclime</") && b.contains("> e-commerce software.<"), mk: "NCT" + rand_hex(6) }
    store_as: g

  - id: reflect
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/login.php?login=fail&reason=%3Cscript%3E{{g.mk}}%3C/script%3E"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: xss_resp

  - id: check
    action: script
    code: |
      let xb = if type_of(xss_resp.body) == "string" { xss_resp.body } else { "" };
      let xss = g.ok && xss_resp.status == 200 && xb.contains("<script>" + g.mk + "</script>");
      #{ xss: xss }
    store_as: res

  - id: report-xss
    action: match
    source: res.xss
    pattern: "^true$"
    condition: "res.xss"
    on_match:
      finding:
        title: "Eclime login.php reason cross-site scripting (CVE-2010-4852)"
        description: "The reason parameter of a failed login in login.php was returned inside the page with its <script> tag unencoded, so an attacker can run script in the browser of a user who follows a crafted link and act with that user's session."
        remediation: "Upgrade Eclime past 1.1.2b, or HTML-encode the reason parameter before printing it."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{adir}}/login.php?login=fail&reason=<script>{{g.mk}}</script> came back with the script tag unencoded"
      stop: true

View these feeds on GitHub