Milesight — 1 vulnerability check

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

← All products · Feeds on GitHub

Milesight Network Camera vb.htm Authentication Bypass

CVECVE-2016-2359
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/milesight/CVE-2016-2359.yaml

Detects the authentication bypass in the vb.htm command interface of Milesight network cameras (CVE-2016-2359): vb.htm refuses commands without credentials, but when the unprivileged checkpassword command is sent in the same request, the camera runs the other commands of that request without authentication. The feed sends GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1 without credentials, then the same request without checkpassword as a control. It reports the bypass when the first reply answers the page, main_type and sub_type commands in the vb.htm reply format ("OK" or "UW" followed by the command name) while the control is refused. When the control is answered as well, it reports instead that vb.htm accepts commands without any credentials. Both requests only read; nothing is changed on the camera.

How noctis detects it

  1. HTTP(S) request GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1
  2. HTTP(S) request GET /vb.htm?page=logs&main_type=-1&sub_type=-1
  3. Parses / computes the next value with a Rhai script
  4. Checks probe.body for (OK|NG|UW) ?checkpassword → finding QoD 75: GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1 without credentials had its page, main_type and sub_type commands answered (H…
  5. Checks probe.body for (OK|NG|UW) ?checkpassword → finding QoD 70: Milesight Network Camera vb.htm Commands Accepted Without Credentials

References:

Feed source — tests/vulnerabilities/milesight/CVE-2016-2359.yaml
# Milesight network cameras — vb.htm authentication bypass (CVE-2016-2359)
#
# Ported from OpenVAS/Greenbone NVT
# `2019/milesight/gb_milesight_network_camera_authentication_bypass_vuln_oct19.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.114161, GPL-2.0-only). The NASL sends
#   GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1
# and reports when the reply holds the strings checkpassword, page, main_type
# and sub_type. Its comment quotes the camera's reply:
#   NG checkpassword
#   UW pageUW main_typeUW sub_type
# vb.htm is the camera's CGI command interface: it answers each command of the
# query with "OK <name>[=<value>]", "NG <name>" (refused) or "UW <name>"
# (unknown word). Without credentials it answers 401; adding the unprivileged
# checkpassword command to the same request makes the camera run every other
# command of that request without authentication (K. Kirils, "Milesight IP
# cameras", 2016: "Requesting a privileged action simultaneously with an
# unprivileged one over vb.htm leads to both actions being executed without
# authorization").
#
# Detection (read-only: two GETs, no credentials, the commands only read):
#   1. probe   — the NASL request. The reply must answer the checkpassword,
#                page, main_type and sub_type commands in the vb.htm reply
#                format (OK/NG/UW followed by the command name).
#   2. control — the same request without checkpassword.
#   QoD 75 (CVE-2016-2359): the control is refused (any reply that does not
#     answer the commands, normally 401) while the probe got them answered —
#     the checkpassword command is what lifted the authentication.
#   QoD 70 (no CVE): the control is answered too — vb.htm runs commands for
#     anyone without credentials (authentication disabled), the bypass itself
#     is not shown.
#
# Differences from the NASL: the four names must appear as vb.htm command
# answers (OK/NG/UW before checkpassword; OK/UW before page, main_type and
# sub_type, since NG means the command was refused), not anywhere in the
# reply, so a 401 or error page
# that quotes the requested URL does not match; and the control request tells
# the bypass apart from a camera that does not ask for credentials at all,
# which the NASL also reported as this CVE.
uid: ebbac041-1b64-4392-b4f3-e7cbfe2cc360
name: "Milesight Network Camera vb.htm Authentication Bypass (CVE-2016-2359)"
description: |
  Detects the authentication bypass in the vb.htm command interface of
  Milesight network cameras (CVE-2016-2359): vb.htm refuses commands without
  credentials, but when the unprivileged checkpassword command is sent in the
  same request, the camera runs the other commands of that request without
  authentication. The feed sends
  GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1 without
  credentials, then the same request without checkpassword as a control. It
  reports the bypass when the first reply answers the page, main_type and
  sub_type commands in the vb.htm reply format ("OK" or "UW" followed by the
  command name) while the control is refused. When the control is
  answered as well, it reports instead that vb.htm accepts commands without
  any credentials. Both requests only read; nothing is changed on the camera.
cves: [CVE-2016-2359]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: auth-bypass
tags: [milesight, ip-camera, iot, vb-htm, auth-bypass]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2016-2359"
  - "https://possiblesecurity.com/news/vulnerabilities-of-milesight-ip-security-cameras/"
  - "http://kirils.org/slides/2016-10-06_Milesight_initial.pdf"

steps:
  # Pre-initialise both stored results so the scripts and conditions below
  # never read an undefined variable when a request fails.
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {status: 0, body: "", headers: {}}

  - id: init-control
    action: set_var
    var_name: control
    var_value: {status: 0, body: "", headers: {}}

  - id: init-v
    action: set_var
    var_name: v
    var_value: {probe_ok: false, control_answered: false, control_refused: false}

  # The bypass request: checkpassword sent together with the log commands.
  - id: probe
    action: http_request
    method: GET
    path: "/vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 10
    store_as: probe

  # Same commands without checkpassword — only sent when the probe was answered.
  - id: control
    action: http_request
    method: GET
    path: "/vb.htm?page=logs&main_type=-1&sub_type=-1"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 10
    condition: "ereg(\"(OK|NG|UW) ?checkpassword\", probe.body) && ereg(\"(OK|UW) ?page\", probe.body) && ereg(\"(OK|UW) ?main_type\", probe.body) && ereg(\"(OK|UW) ?sub_type\", probe.body)"
    store_as: control

  - id: verdict
    action: script
    store_as: v
    code: |
      let pb = if type_of(probe.body) == "string" { probe.body } else { "" };
      let cb = if type_of(control.body) == "string" { control.body } else { "" };
      let probe_ok = ereg("(OK|NG|UW) ?checkpassword", pb) && ereg("(OK|UW) ?page", pb) && ereg("(OK|UW) ?main_type", pb) && ereg("(OK|UW) ?sub_type", pb);
      let control_answered = ereg("(OK|UW) ?page", cb) && ereg("(OK|UW) ?main_type", cb) && ereg("(OK|UW) ?sub_type", cb);
      // Fail-closed: the control only counts as refused when it got a reply.
      let control_refused = control.status != 0 && !control_answered;
      #{ probe_ok: probe_ok, control_answered: control_answered, control_refused: control_refused, cstatus: control.status }

  - id: confirm-bypass
    action: match
    source: probe.body
    pattern: "(OK|NG|UW) ?checkpassword"
    condition: "v.probe_ok == true && v.control_refused == true"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /vb.htm?checkpassword=&page=logs&main_type=-1&sub_type=-1 without credentials had its page, main_type and sub_type commands answered (HTTP {{probe.status}}), while the same commands without checkpassword were refused (HTTP {{v.cstatus}})"
      stop: true

  - id: open-vb-htm
    action: match
    source: probe.body
    pattern: "(OK|NG|UW) ?checkpassword"
    condition: "v.probe_ok == true && v.control_answered == true"
    on_match:
      finding:
        title: "Milesight Network Camera vb.htm Commands Accepted Without Credentials"
        description: "The vb.htm command interface of the camera answered the page, main_type and sub_type commands of a request without credentials, with or without the checkpassword command, so the camera does not ask for credentials on vb.htm at all. The checkpassword authentication bypass (CVE-2016-2359) could not be told apart from that open access."
        remediation: "Enable authentication on the camera's web interface, update the firmware to the latest Milesight release, and restrict access to the camera's web ports to the management network."
        cves: []
        cvss: 7.5
        severity: high
        confidence_delta: 0.40
        qod: 70
        evidence: "GET /vb.htm?page=logs&main_type=-1&sub_type=-1 without credentials and without checkpassword had its page, main_type and sub_type commands answered (HTTP {{v.cstatus}})"

View these feeds on GitHub