Amcrest — 1 vulnerability check

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

← All products · Feeds on GitHub

Amcrest IP Camera — unauthenticated Sha1Account1 credential disclosure

CVECVE-2017-13719, CVE-2017-8226, CVE-2017-8227, CVE-2017-8228, CVE-2017-8229, CVE-2017-8230
Severitycritical · CVSS 9.8
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/amcrest/amcrest-sha1account1-credential-disclosure.yaml

Amcrest IP cameras (IPM-721S firmware V2.420.AC00.16.R.20160909 and prior, and V2.420.AC00.17.R.20170322 and prior for CVE-2017-13719) serve the account database /current_config/Sha1Account1 without authentication. The file holds every local account with its password in clear text, giving an unauthenticated attacker administrative access to the camera. The same firmware also ships default credentials (CVE-2017-8226), has no ONVIF brute-force lockout (CVE-2017-8227), lacks an owner check (CVE-2017-8228), allows privilege escalation through its HTTP APIs (CVE-2017-8230) and has a memory corruption flaw (CVE-2017-13719).

How noctis detects it

  1. HTTP(S) request GET /current_config/Sha1Account1
  2. Parses / computes the next value with a Rhai script
  3. Checks acct.disclosed for ^true$ → finding QoD 75: GET /current_config/Sha1Account1 returned the camera's account database without authentication (HTTP 200, "Users" array with populated "Pas…

References:

Feed source — tests/vulnerabilities/amcrest/amcrest-sha1account1-credential-disclosure.yaml
# Amcrest IP cameras — unauthenticated /current_config/Sha1Account1 credential
# disclosure (CVE-2017-8229), reported by OpenVAS together with the rest of the
# Jun 2019 Amcrest advisory (CVE-2017-8226/8227/8228/8230/13719).
#
# Ported from OpenVAS/Greenbone NASL
# 2019/amcrest/gb_amcrest_ip_camera_mult_vuln_jun19.nasl (GPL-2.0-only). The
# NASL fetches /current_config/Sha1Account1 and reports when the body contains
# '"Password" : "'.
#
# Differences from the NASL (deliberate, stronger detection):
#   * No homepage pre-gate. The NASL first requires 'version=@WebVersion@' in
#     the body of '/', which skips Dahua-OEM firmwares and devices whose
#     homepage is a redirect or a different web UI build, although the same
#     file leaks there. Here the proof is the leaked file itself.
#   * Stricter proof. The NASL's '"Password" : "' also matches an empty
#     password field anywhere in any response. Here the reply must be HTTP 200
#     and hold a "Users" array with at least one non-empty "Password" value,
#     i.e. the device's account database really was read without
#     authentication.
#   * Better evidence. The finding names the disclosed accounts and says
#     whether the admin account still has the factory default password
#     (CVE-2017-8226) — password values are never copied into the evidence.
#
# Read-only, one GET, nothing written on the target.
uid: f21e22fa-588f-4936-856a-93f9ff0a47b9
name: "Amcrest IP Camera — unauthenticated Sha1Account1 credential disclosure (CVE-2017-8229)"
description: |
  Amcrest IP cameras (IPM-721S firmware V2.420.AC00.16.R.20160909 and prior,
  and V2.420.AC00.17.R.20170322 and prior for CVE-2017-13719) serve the
  account database /current_config/Sha1Account1 without authentication. The
  file holds every local account with its password in clear text, giving an
  unauthenticated attacker administrative access to the camera. The same
  firmware also ships default credentials (CVE-2017-8226), has no ONVIF
  brute-force lockout (CVE-2017-8227), lacks an owner check (CVE-2017-8228),
  allows privilege escalation through its HTTP APIs (CVE-2017-8230) and has a
  memory corruption flaw (CVE-2017-13719).
cves: [CVE-2017-13719, CVE-2017-8226, CVE-2017-8227, CVE-2017-8228, CVE-2017-8229, CVE-2017-8230]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: exposure
tags: [amcrest, dahua, camera, iot, credential-disclosure, exposure]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8229"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8226"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8227"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8228"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-8230"
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-13719"
  - "OpenVAS/Greenbone NASL 2019/amcrest/gb_amcrest_ip_camera_mult_vuln_jun19.nasl (GPL-2.0-only)"

steps:
  # Pre-initialise the stored result: if the request fails, the script below
  # still sees a defined `resp` instead of aborting the test.
  - id: init-resp
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}

  - id: fetch-account-db
    action: http_request
    method: GET
    path: "/current_config/Sha1Account1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: resp

  # Parse the reply: a real account database is an HTTP 200 JSON document with
  # a "Users" array whose entries carry a non-empty "Password". Collect the
  # account names and flag the default admin/admin account.
  - id: parse-accounts
    action: script
    store_as: acct
    code: |
      let b = if type_of(resp.body) == "string" { resp.body } else { "" };
      let ok = resp.status == 200
        && ereg("\"Users\"\\s*:\\s*\\[", b)
        && ereg("\"Password\"\\s*:\\s*\"[^\"]+\"", b);
      let names = [];
      let default_admin = false;
      if ok {
        // One chunk per account object; read Name and Password independently
        // so the key order inside an object does not matter.
        let users = split(b, "\"Users\"");
        let objs = split(users[users.len() - 1], "{");
        for o in objs {
          let n = eregmatch("\"Name\"\\s*:\\s*\"([^\"]*)\"", o);
          let p = eregmatch("\"Password\"\\s*:\\s*\"([^\"]*)\"", o);
          if n.len() == 2 && p.len() == 2 && p[1] != "" {
            names.push(n[1]);
            if n[1] == "admin" && p[1] == "admin" { default_admin = true; }
          }
        }
      }
      let list = "";
      for n in names { list = if list == "" { n } else { list + ", " + n }; }
      if list == "" { list = "names not parsed"; }
      #{
        disclosed: ok,
        count: names.len(),
        names: list,
        default_admin: default_admin
      }

  - id: report-disclosure
    action: match
    source: acct.disclosed
    pattern: "^true$"
    condition: "acct.disclosed == true"
    on_match:
      finding:
        remediation: "Update the camera to the latest Amcrest firmware, change every account password, and do not expose the web interface to untrusted networks."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET /current_config/Sha1Account1 returned the camera's account database without authentication (HTTP 200, \"Users\" array with populated \"Password\" fields). Accounts disclosed: {{acct.count}} ({{acct.names}}); admin still uses the factory default password (CVE-2017-8226): {{acct.default_admin}}. Password values withheld from this report."
      stop: true

View these feeds on GitHub