VTLS Virtua — 1 vulnerability check

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

← All products · Feeds on GitHub

VTLS Virtua InfoStation.cgi login SQL injection

CVECVE-2014-2081
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/vtls-virtua/CVE-2014-2081.yaml

Looks for the VTLS Virtua InfoStation log-in page (/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login) under the web root and the usual install directories (/virtua, /vtls, /mgmt, /libmgmt). It then submits two failed log-ins: a control whose user name and password contain only doubled (balanced) single quotes, and a probe whose user name is a single quote followed by a random marker and whose password is a single quote. The finding fires when the probe returns the database error "SQL command not properly ended" together with the marker, while the balanced control returns no SQL error: the log-in fields are concatenated into the SQL query. The POST form is tried first, then the same parameters in a GET request. Both requests are ordinary failed log-ins; no data is read or changed.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en with a crafted body
  5. HTTP(S) request POST {{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=process&database=1&lang_co…
  8. HTTP(S) request GET {{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=process&database=1&lang_co…
  9. Parses / computes the next value with a Rhai script
  10. Checks v.method for . → finding QoD 75: VTLS Virtua InfoStation.cgi login SQL injection
  11. Checks v.method for . → finding QoD 70: VTLS Virtua InfoStation.cgi login SQL injection

References:

Feed source — tests/vulnerabilities/vtls-virtua/CVE-2014-2081.yaml
# VTLS Virtua InfoStation.cgi login SQL injection (CVE-2014-2081).
#
# Ported from OpenVAS/Greenbone NVT `2014/gb_vtls_virtua_mult_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.804759, GPL-2.0-only). The NASL GETs
# <dir>/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en for
# "/", /virtua, /vlts, /mgmt, /libmgmt, requires "Virtua<" and ">InfoStation - Log In<",
# then POSTs mod=login&func=process&database=1&lang_code=en&report_group=Adm&filter=test
# &username=%27SQL-Injection-Test&password=%27 and reports
# "SQL error.*SQL command not properly ended.*SQL-Injection-Test" (ORA-00933 followed by
# the failing statement). Advisory (J. Tozo, Full Disclosure 2014/Aug/64) gives the same
# parameters sent with GET. Fixed in 2013.2.4 and 2014.1.1.
#
# Better than the NASL:
#   - Random marker instead of the fixed "SQL-Injection-Test" string (a page that merely
#     echoes a known scanner string no longer matches), matched case-insensitively.
#   - Quote-parity control: the same login with every quote doubled (valid SQL) must
#     NOT raise the SQL error, so the error is caused by our unbalanced quote breaking
#     the statement, not by a generic error page. Control clean → QoD 75; control
#     missing or also failing → QoD 70.
#   - Falls back to the advisory's GET form when the POST form raises nothing.
#   - Also tries /vtls (the NASL list has "/vlts").
# Both requests are failed logins; nothing is read or written.
uid: ec99c293-c5b3-4824-a0cc-3f0725d65cbe
name: "VTLS Virtua InfoStation.cgi login SQL injection"
description: >-
  Looks for the VTLS Virtua InfoStation log-in page
  (/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login) under the web
  root and the usual install directories (/virtua, /vtls, /mgmt, /libmgmt).
  It then submits two failed
  log-ins: a control whose user name and password contain only doubled
  (balanced) single quotes, and a probe whose user name is a single quote
  followed by a random marker and whose password is a single quote. The finding
  fires when the probe returns the database error "SQL command not properly
  ended" together with the marker, while the balanced control returns no SQL
  error: the log-in fields are concatenated into the SQL query. The POST form
  is tried first, then the same parameters in a GET request. Both requests are
  ordinary failed log-ins; no data is read or changed.
category: sqli
cves: [CVE-2014-2081]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [vtls, virtua, infostation, library, oracle, sqli, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2081"
  - "https://seclists.org/fulldisclosure/2014/Aug/64"
  - "http://packetstormsecurity.com/files/127997/VTLS-Virtua-SQL-Injection.html"
  - "OpenVAS/Greenbone NASL 2014/gb_vtls_virtua_mult_sql_inj_vuln.nasl (GPL-2.0-only)"

steps:
  - id: gen
    action: script
    code: |
      #{ m: "noctis" + rand_str(10) }
    store_as: rv

  # Loop group: every following step runs once per directory. Pre-initialise the
  # stored results so a failed request never leaves them undefined or stale.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/virtua", "/vtls", "/vlts", "/mgmt", "/libmgmt"]

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

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

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

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

  - id: login-page
    action: http_request
    method: GET
    path: "{{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    store_as: page

  - id: gate
    action: script
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      b.contains("Virtua<") && b.contains(">InfoStation - Log In<")
    store_as: is_virtua

  # Control: every quote doubled — valid SQL, must not raise the SQL error.
  - id: control-post
    action: http_request
    method: POST
    path: "{{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: "is_virtua"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "mod=login&func=process&database=1&lang_code=en&report_group=Adm&filter=test&username=%27%27{{rv.m}}&password=%27%27"
    store_as: ctl

  - id: inject-post
    action: http_request
    method: POST
    path: "{{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=login&lang_code=en"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: "is_virtua"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "mod=login&func=process&database=1&lang_code=en&report_group=Adm&filter=test&username=%27{{rv.m}}&password=%27"
    store_as: inj

  - id: post-verdict
    action: script
    code: |
      let pat = "(?s)SQL error.*SQL command not properly ended.*" + rv.m;
      let b = if type_of(inj.body) == "string" { inj.body } else { "" };
      is_virtua && ereg(pat, b, true)
    store_as: post_hit

  # Advisory form: same parameters in the query string of a GET.
  - id: control-get
    action: http_request
    method: GET
    path: "{{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=process&database=1&lang_code=en&report_group=Adm&filter=test&username=%27%27{{rv.m}}&password=%27%27"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: "is_virtua && !post_hit"
    store_as: gctl

  - id: inject-get
    action: http_request
    method: GET
    path: "{{dir}}/web_reports/cgi-bin/InfoStation.cgi?mod=login&func=process&database=1&lang_code=en&report_group=Adm&filter=test&username=%27{{rv.m}}&password=%27"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: "is_virtua && !post_hit"
    store_as: ginj

  - id: verdict
    action: script
    code: |
      fn body_of(r) {
        if type_of(r) == "map" && type_of(r.body) == "string" { r.body } else { "" }
      }
      fn replied(r) { type_of(r) == "map" && r.status > 0 }
      let pat = "(?s)SQL error.*SQL command not properly ended.*" + rv.m;
      let err = "SQL command not properly ended";
      let get_hit = is_virtua && !post_hit && ereg(pat, body_of(ginj), true);
      let c = if post_hit { ctl } else { gctl };
      let clean = replied(c) && !ereg("SQL error|" + err, body_of(c), true);
      let method = if post_hit { "POST" } else { "GET" };
      let hit = post_hit || get_hit;
      #{ ok: hit && clean, weak: hit && !clean, method: method,
         ctl_state: if replied(c) { "also returned a SQL error" } else { "got no reply" } }
    store_as: v

  - id: sqli-confirmed
    action: match
    source: v.method
    pattern: "."
    condition: "v.ok"
    on_match:
      finding:
        title: "VTLS Virtua InfoStation.cgi login SQL injection"
        description: "The VTLS Virtua InfoStation log-in (web_reports/cgi-bin/InfoStation.cgi) concatenates the username and password fields into its SQL query, so an unauthenticated attacker can run arbitrary SQL against the library database."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{v.method}} {{dir}}/web_reports/cgi-bin/InfoStation.cgi func=process with username='{{rv.m}} and password=' returned \"SQL command not properly ended\" together with the marker; the same log-in with balanced quotes (username=''{{rv.m}}, password='') returned no SQL error."
        remediation: "Upgrade VTLS Virtua to 2013.2.4, 2014.1.1 or later. Until then, restrict access to the InfoStation reporting interface to trusted staff networks."
      stop: true

  - id: sqli-uncontrolled
    action: match
    source: v.method
    pattern: "."
    condition: "v.weak"
    on_match:
      finding:
        title: "VTLS Virtua InfoStation.cgi login SQL injection"
        description: "The VTLS Virtua InfoStation log-in (web_reports/cgi-bin/InfoStation.cgi) concatenates the username and password fields into its SQL query, so an unauthenticated attacker can run arbitrary SQL against the library database."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{v.method}} {{dir}}/web_reports/cgi-bin/InfoStation.cgi func=process with username='{{rv.m}} and password=' returned \"SQL command not properly ended\" together with the marker; the balanced-quote control {{v.ctl_state}}."
        remediation: "Upgrade VTLS Virtua to 2013.2.4, 2014.1.1 or later. Until then, restrict access to the InfoStation reporting interface to trusted staff networks."
      stop: true

View these feeds on GitHub