eTicket — 1 vulnerability check

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

← All products · Feeds on GitHub

eTicket <= 1.5.7 pri parameter SQL injection

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

eTicket 1.5.7 and earlier put the pri parameter of index.php, open.php, open_raw.php and newticket.php into an SQL query without escaping it, allowing unauthenticated SQL injection against the help-desk database.

Under the web root and /eTicket, this check reads license.txt to identify the product and its version. It then requests index.php with pri=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. When the page hides database errors, an installed version of 1.5.7 or lower is reported instead, with lower confidence. Nothing is written and no data is read from the database.

How noctis detects it

  1. HTTP(S) request GET {{adir}}/license.txt
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{adir}}/index.php?pri=1
  4. HTTP(S) request GET {{adir}}/index.php?pri=1%27
  5. Parses / computes the next value with a Rhai script
  6. Checks res.found for ^ERROR$ → finding QoD 75: eTicket pri parameter SQL injection (CVE-2008-5165)
  7. Checks res.found for ^VERSION$ → finding QoD 70: eTicket <= 1.5.7 pri parameter SQL injection (CVE-2008-5165)

References:

Feed source — tests/vulnerabilities/eticket/CVE-2008-5165.yaml
# eTicket <= 1.5.7 — pri parameter SQL injection (CVE-2008-5165)
#
# The pri (priority) parameter of index.php, open.php, open_raw.php and
# newticket.php is placed into an SQL query without being escaped. No 1.5.x
# source is public any more (the community repository only holds 1.7.3, which
# is fixed), so the probe follows the advisory: an injected quote breaks the
# query and the page prints the database error.
#
# Detection (per candidate install dir: web root, /eTicket):
#   0. license.txt must name the product and version ("eTicket 1.5.7").
#   1. QoD 75 — index.php?pri=1 (control) carries no database error, then
#      index.php?pri=1' (a single quote) answers with a MySQL syntax error.
#   2. QoD 70 — only the version is known: license.txt names a release <= 1.5.7
#      and the injection branch did not answer (error pages disabled).
#
# 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 `2008/gb_eticket_pri_para_mult_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.800141, GPL-2.0-only). Differences: the NASL
# reports on the version alone; here a quote probe with a clean control is
# tried first and the version-only result stays as the fallback.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: df2ab31d-67eb-4e77-9ef8-442638160d97
name: "eTicket <= 1.5.7 pri parameter SQL injection (CVE-2008-5165)"
description: |
  eTicket 1.5.7 and earlier put the pri parameter of index.php, open.php,
  open_raw.php and newticket.php into an SQL query without escaping it,
  allowing unauthenticated SQL injection against the help-desk database.

  Under the web root and /eTicket, this check reads license.txt to identify
  the product and its version. It then requests index.php with pri=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. When the page hides database errors, an
  installed version of 1.5.7 or lower is reported instead, with lower
  confidence. Nothing is written and no data is read from the database.
cves: [CVE-2008-5165]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [eticket, php, sqli, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-5165"

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-lic
    action: set_var
    var_name: lic
    var_value: {status: 0, body: null}
    loop:
      over: ["", "/eTicket"]
      var: adir

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

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

  - id: license
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/license.txt"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: lic

  - id: version
    action: script
    code: |
      let b = if type_of(lic.body) == "string" { lic.body } else { "" };
      let m = eregmatch("eTicket ([0-9]+(\\.[0-9]+)*)", b);
      let v = "";
      let old = false;
      if lic.status == 200 && type_of(m) == "array" && m.len() > 1 {
        v = m[1];
        let p = v.split(".");
        let n = [0, 0, 0];
        for i in 0..3 { if i < p.len() { n[i] = int(p[i]); } }
        old = n[0] < 1 || (n[0] == 1 && (n[1] < 5 || (n[1] == 5 && n[2] <= 7)));
      }
      #{ ok: v != "", old: old, ver: v }
    store_as: ver

  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{adir}}/index.php?pri=1"
    condition: "ver.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?pri=1%27"
    condition: 'ver.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 b = if type_of(inj_resp.body) == "string" { inj_resp.body } else { "" };
      let err = inj_resp.status >= 200 && inj_resp.status < 500 && ereg("(?i)(error in your SQL syntax|mysql_fetch|MySQL server version)", b);
      #{ err: err, old: ver.old, ver: ver.ver, found: if err { "ERROR" } else if ver.old { "VERSION" } else { "" } }
    store_as: res

  - id: report-error
    action: match
    source: res.found
    pattern: "^ERROR$"
    condition: "res.err"
    on_match:
      finding:
        title: "eTicket pri parameter SQL injection (CVE-2008-5165)"
        description: "A single quote appended to the pri parameter of index.php made eTicket 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 help-desk database."
        remediation: "Upgrade eTicket to 1.7.0 or later, which casts and escapes pri before using it in queries."
        confidence_delta: 0.45
        qod: 75
        evidence: "eTicket {{res.ver}} on {{adir}}/index.php: pri=1 answers without a database error, pri=1' answers with an SQL syntax error"
      stop: true

  - id: report-version
    action: match
    source: res.found
    pattern: "^VERSION$"
    condition: "res.old"
    on_match:
      finding:
        title: "eTicket <= 1.5.7 pri parameter SQL injection (CVE-2008-5165)"
        description: "The installed eTicket release is 1.5.7 or earlier, in which the pri parameter of index.php, open.php, open_raw.php and newticket.php is used in SQL queries without escaping. The injection itself could not be observed because the page does not display database errors."
        remediation: "Upgrade eTicket to 1.7.0 or later."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{adir}}/license.txt names eTicket {{res.ver}} (<= 1.5.7)"
      stop: true

View these feeds on GitHub