Humax — 1 vulnerability check

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

← All products · Feeds on GitHub

Humax HG100R GatewaySettings.bin Unauthenticated Backup Download and 404-Page XSS

CVECVE-2017-7315, CVE-2017-7316, CVE-2017-7317
Severitycritical · CVSS 9.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, script, match, tcp_connect · highest QoD 75
Feedtests/vulnerabilities/humax/humax-hg100r-gatewaysettings-download.yaml

Detects Humax Digital HG100R gateways that hand out their configuration backup without authentication. The test requests /view/basic/GatewaySettings.bin without credentials and reports the device when it answers 200 with Content-Type application/x-download, a Content-Disposition attachment named GatewaySettings.bin and a non-empty, non-HTML file body. This backup stores the admin and root passwords in plaintext (CVE-2017-7315, CVE-2017-7317); the file content is never copied into the finding. On a device identified this way, the test also requests a path carrying a <script> element with a random per-run marker and reports the reflected XSS of the 404 page (CVE-2017-7316) when the element comes back unescaped. Nothing is changed on the target.

How noctis detects it

  1. HTTP(S) request GET /view/basic/GatewaySettings.bin
  2. Parses / computes the next value with a Rhai script
  3. Checks an.summary for ^gatewaysettings-backup-served$ → finding QoD 75: Humax HG100R Configuration Backup Downloadable Without Authentication (CVE-2017-7315)
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET /%3Cscript%3Ealert('{{xss.tok}}')%3C/script%3E HTTP/1.0
  6. Checks xss_resp.banner for <script>alert\('noctis[0-9a-f]{12}'\)</script> → finding QoD 75: Humax HG100R Reflected XSS on the 404 Page (CVE-2017-7316)

References:

Feed source — tests/vulnerabilities/humax/humax-hg100r-gatewaysettings-download.yaml
# Humax Digital HG100R (VER 2.0.6) — unauthenticated download of the
# configuration backup /view/basic/GatewaySettings.bin, which holds the admin
# and root credentials in plaintext (CVE-2017-7315, CVE-2017-7317), plus the
# reflected XSS on the same device's 404 page (CVE-2017-7316).
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_humax_gateway_file_dwnld_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.106917, GPL-2.0-only). The NASL GETs
# <dir>/view/basic/GatewaySettings.bin and requires
# `Content-Type: application/x-download` and
# `Content-disposition: attachment; filename=GatewaySettings.bin` in the
# response headers. Advisory: Full Disclosure 2017/Jun/45 (no vendor fix).
#
# Detection:
#   1. Backup download (CVE-2017-7315 / CVE-2017-7317, QoD 75): same request
#      and header markers as the NASL, plus a 200 status and a non-empty body
#      that is not an HTML page — the file itself was served without
#      credentials. The body is reduced to a fixed summary in a script step
#      before matching, so no credential from the backup ever reaches the
#      finding or the logs.
#   2. 404-page XSS (CVE-2017-7316, QoD 75): only once step 1 identified the
#      device, GET /<script>alert('<random marker>')</script> sent the way a
#      browser sends it (percent-encoded, verbatim via tcp_connect) and the
#      decoded, unescaped <script> element with the per-run marker required in
#      the reply. Reported on its own finding (step-level `cves:`).
#
# Deviations from the NASL (intentional, better coverage):
#   - 200 status + real non-HTML file content required on top of the headers,
#     so a portal answering every path with those headers (or an empty
#     attachment) is not reported.
#   - CVE-2017-7316, listed but never tested by the NASL, is probed.
#
# CVSS: NVD v3.0 — 9.8 for CVE-2017-7315/7317, 6.1 for CVE-2017-7316.
uid: 771151b0-54c5-46ea-b27e-6f4616d30515
name: "Humax HG100R GatewaySettings.bin Unauthenticated Backup Download and 404-Page XSS"
description: |
  Detects Humax Digital HG100R gateways that hand out their configuration
  backup without authentication. The test requests
  /view/basic/GatewaySettings.bin without credentials and reports the device
  when it answers 200 with Content-Type application/x-download, a
  Content-Disposition attachment named GatewaySettings.bin and a non-empty,
  non-HTML file body. This backup stores the admin and root passwords in
  plaintext (CVE-2017-7315, CVE-2017-7317); the file content is never copied
  into the finding. On a device identified this way, the test also requests a
  path carrying a <script> element with a random per-run marker and reports
  the reflected XSS of the 404 page (CVE-2017-7316) when the element comes back
  unescaped. Nothing is changed on the target.
cves: [CVE-2017-7315, CVE-2017-7316, CVE-2017-7317]
cvss: 9.8
severity: critical
confidence_base: 0.20
category: file-read
tags: [humax, hg100r, router, gateway, backup, config-download, credentials, xss]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7315"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7316"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7317"
  - "https://seclists.org/fulldisclosure/2017/Jun/45"

steps:
  - id: init-backup
    action: set_var
    var_name: backup
    var_value: {status: 0, body: null, headers: {}}

  - id: fetch-backup
    action: http_request
    method: GET
    port: "{{port}}"
    path: "/view/basic/GatewaySettings.bin"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: backup

  # Reduce the reply to booleans: the backup holds plaintext passwords, and a
  # match step copies its source into the finding.
  - id: analyze-backup
    action: script
    code: |
      let h = backup.headers;
      let ct = if type_of(h) == "map" && "content-type" in h { tolower("" + h["content-type"]) } else { "" };
      let cd = if type_of(h) == "map" && "content-disposition" in h { tolower("" + h["content-disposition"]) } else { "" };
      let body = if type_of(backup.body) == "string" { backup.body } else { "" };
      let headers_ok = ct.contains("application/x-download")
        && ereg("attachment\\s*;\\s*filename\\s*=\\s*\"?gatewaysettings\\.bin", cd);
      let is_html = ereg("^\\s*<", body) || ereg("(?i)<html|<body|<!doctype", body);
      let ok = backup.status == 200 && headers_ok && body.len() > 0 && !is_html;
      #{
        ok: ok,
        size: body.len(),
        has_admin: ok && ereg("(?i)admin", body),
        summary: if ok { "gatewaysettings-backup-served" } else { "no-backup" }
      }
    store_as: an

  - id: confirm-backup
    action: match
    source: an.summary
    pattern: "^gatewaysettings-backup-served$"
    condition: "an.ok == true"
    on_match:
      finding:
        cves: [CVE-2017-7315, CVE-2017-7317]
        cvss: 9.8
        severity: critical
        title: "Humax HG100R Configuration Backup Downloadable Without Authentication (CVE-2017-7315)"
        confidence_delta: 0.60
        qod: 75
        evidence: "GET /view/basic/GatewaySettings.bin without credentials returned 200, Content-Type application/x-download and a GatewaySettings.bin attachment of {{an.size}} bytes (non-HTML; account name 'admin' present in the file: {{an.has_admin}}). The backup stores the admin and root passwords in plaintext; its content is not reproduced here."
        remediation: "Restrict the HG100R web interface to the LAN, block remote access to /view/basic/GatewaySettings.bin, change the admin and root passwords, and replace the device if no fixed firmware is available from the ISP or vendor."

  - id: gen-marker
    action: script
    code: |
      #{ tok: "noctis" + rand_hex(6) }
    store_as: xss
    condition: "an.ok == true"

  - id: init-xss
    action: set_var
    var_name: xss_resp
    var_value: {connected: false, banner: null}

  # Browser form of http://host/<script>alert('tok')</script>.
  - id: probe-xss
    action: tcp_connect
    port: "{{port}}"
    condition: "an.ok == true"
    send: "GET /%3Cscript%3Ealert('{{xss.tok}}')%3C/script%3E HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: xss_resp

  - id: confirm-xss
    action: match
    source: xss_resp.banner
    pattern: "<script>alert\\('noctis[0-9a-f]{12}'\\)</script>"
    condition: "an.ok == true && type_of(xss_resp.banner) == \"string\" && xss_resp.banner.contains(\"<script>alert('\" + xss.tok + \"')</script>\")"
    on_match:
      finding:
        cves: [CVE-2017-7316]
        cvss: 6.1
        severity: medium
        title: "Humax HG100R Reflected XSS on the 404 Page (CVE-2017-7316)"
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /%3Cscript%3Ealert('{{xss.tok}}')%3C/script%3E returned the decoded <script>alert('{{xss.tok}}')</script> element unescaped in the error page."
        remediation: "Restrict the HG100R web interface to the LAN and replace the device if no fixed firmware is available from the ISP or vendor."

View these feeds on GitHub