Zikula — 1 vulnerability check

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

← All products · Feeds on GitHub

Zikula < 1.3.11 / 1.4.4 jcss.php backslash directory traversal

CVECVE-2016-9835
Severitycritical · CVSS 9.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/zikula/CVE-2016-9835.yaml

Zikula Application Framework before 1.3.11 and 1.4.x before 1.4.4, when installed on Windows, does not strip backslashes from the `f` parameter of jcss.php, so a request such as jcss.php?f=..\..\jcss.php reaches files outside the theme cache directory.

The check requests jcss.php (at the web root and under /zikula) with several `..\` depths pointing at jcss.php itself and reports the vulnerability when the script answers 500 "ERROR: Corrupted file." (the file outside the cache was found and read). A request for a non-existent file at the same depth must answer 400 "ERROR: Requested file not readable."; if it does not, the target is not reported. Only error messages are read; no file content is returned and nothing is written to the target.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{cfg.dir}}/jcss.php?f={{cfg.up}}jcss.php
  3. HTTP(S) request GET {{cfg.dir}}/jcss.php?f={{cfg.up}}noctis-absent-{{oob_token}}.php
  4. Parses / computes the next value with a Rhai script
  5. Checks res.found for ^TRAVERSAL$ → finding QoD 75: Zikula jcss.php backslash directory traversal (CVE-2016-9835)

References:

Feed source — tests/vulnerabilities/zikula/CVE-2016-9835.yaml
# Zikula 1.3.x < 1.3.11 / 1.4.x < 1.4.4 on Windows — jcss.php backslash directory traversal (CVE-2016-9835)
#
# jcss.php serves cached theme CSS/JS: it strips "/" from the `f` parameter, prefixes
# <temp>/Theme_cache/ and answers according to what it finds there ("Requested file not
# readable" when the path does not exist, "Corrupted file" when the file exists but is not a
# serialized cache entry). Backslashes are not stripped before 1.3.11 / 1.4.4, so on Windows
# `..\..\jcss.php` leaves the cache directory. Fixed upstream (zikula/core 1.3.11) by
# removing backslashes from `f` as well. Both tags checked in the upstream repository.
#
# Detection (QoD 75): differential on the error text. A traversal to the always-present
# jcss.php itself must answer 500 "ERROR: Corrupted file." (the file was found and read),
# while the same traversal to a file that does not exist must answer 400
# "ERROR: Requested file not readable." — a server that answers the first request this way
# for any name (catch-all, honeypot) is not reported. Nothing is written; the content of the
# file read is never returned by the script. Linux hosts do not treat "\" as a separator, so
# they answer "not readable" for both and are (correctly) clean: the CVE is Windows-only.
#
# Better than the source NASL: it matched the error text of a single request; this check
# adds the absent-file control, tries the usual install prefixes and several traversal
# depths (the Theme_cache depth depends on the configured temp directory).
# CVSS: NVD v3.0 base score 9.8 (v2: 7.5).
#
# Source: OpenVAS/Greenbone NVT 2016/gb_zikula_jcss_dir_trav_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.809834, GPL-2.0-only).
uid: 7dd12212-2070-4b04-b25b-acc71317cd62
name: "Zikula < 1.3.11 / 1.4.4 jcss.php backslash directory traversal (CVE-2016-9835)"
description: |
  Zikula Application Framework before 1.3.11 and 1.4.x before 1.4.4, when installed on
  Windows, does not strip backslashes from the `f` parameter of jcss.php, so a request such
  as jcss.php?f=..\..\jcss.php reaches files outside the theme cache directory.

  The check requests jcss.php (at the web root and under /zikula) with several `..\`
  depths pointing at jcss.php itself and reports the vulnerability when the script answers
  500 "ERROR: Corrupted file." (the file outside the cache was found and read). A request
  for a non-existent file at the same depth must answer 400 "ERROR: Requested file not
  readable."; if it does not, the target is not reported. Only error messages are read;
  no file content is returned and nothing is written to the target.
cves: [CVE-2016-9835]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [zikula, php, directory-traversal, windows]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2016-9835"

steps:
  # A loop: step runs together with every following non-loop step once per item
  # ("<install prefix>|<number of ..\ segments>"); pre-initialise the stored results.
  - id: init-probe
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      over:
        - "|2"
        - "|3"
        - "|4"
        - "|5"
        - "|6"
        - "/zikula|2"
        - "/zikula|3"
        - "/zikula|4"
        - "/zikula|5"
        - "/zikula|6"
      var: item

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

  - id: cfg
    action: script
    code: |
      let parts = split(item, "|");
      let up = "";
      for i in 0..int(parts[1]) { up += "..%5C"; }
      #{ dir: parts[0], up: up }
    store_as: cfg

  - id: probe
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cfg.dir}}/jcss.php?f={{cfg.up}}jcss.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe_r

  - id: control
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cfg.dir}}/jcss.php?f={{cfg.up}}noctis-absent-{{oob_token}}.php"
    condition: 'probe_r.status == 500 && type_of(probe_r.body) == "string" && stridx(probe_r.body, "ERROR: Corrupted file") >= 0'
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ctrl_r

  - id: check
    action: script
    code: |
      let pb = if type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      let cb = if type_of(ctrl_r.body) == "string" { ctrl_r.body } else { "" };
      let ok = probe_r.status == 500
        && stridx(pb, "ERROR: Corrupted file") >= 0
        && stridx(pb, "ERROR: Requested file not readable") < 0
        && ctrl_r.status == 400
        && stridx(cb, "ERROR: Requested file not readable") >= 0;
      #{ ok: ok, found: if ok { "TRAVERSAL" } else { "" } }
    store_as: res

  - id: report
    action: match
    source: res.found
    pattern: "^TRAVERSAL$"
    condition: "res.ok"
    on_match:
      finding:
        title: "Zikula jcss.php backslash directory traversal (CVE-2016-9835)"
        description: "The f parameter of jcss.php is not stripped of backslashes: a ..\\ path reaches files outside the theme cache directory (the script answers 'Corrupted file' for an existing file and 'Requested file not readable' for a missing one), which lets an unauthenticated attacker probe for files on the Windows host."
        remediation: "Upgrade Zikula to 1.3.11 / 1.4.4 or later, which removes backslashes from the f parameter."
        confidence_delta: 0.45
        qod: 75
        evidence: "GET {{cfg.dir}}/jcss.php?f={{cfg.up}}jcss.php answered 500 'ERROR: Corrupted file.' (file outside Theme_cache found) while the same traversal to an absent file answered 400 'Requested file not readable'"
      stop: true

View these feeds on GitHub