Samsung DVR — 1 vulnerability check

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

← All products · Feeds on GitHub

CVECVE-2013-3586, CVE-2013-3585
Severityhigh · CVSS 7.6
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/samsung-dvr/web-viewer-cookie-auth-bypass.yaml

Detects the authentication bypass in the web interface of Samsung DVRs with firmware 1.10 and earlier (CVE-2013-3586): the CGIs only check that a cookie is present, so any arbitrary cookie opens the administration pages. Through the user setup page (/cgi-bin/setup_user) this exposes every local account name and its password in cleartext (CVE-2013-3585). The feed first checks that the home page is the Samsung DVR Web Viewer. It then requests /cgi-bin/setup_user without a cookie, which must answer the login redirect, and again with an arbitrary DATA1 cookie. It reports the device when the second reply is the "User" setup page listing the user name and password fields. The finding only gives the number of accounts listed; the names and passwords are never copied into it. If the user setup page is already served without any cookie, a separate finding reports the cleartext password exposure. All requests only read pages; nothing is changed on the device.

How noctis detects it

  1. HTTP(S) request GET /
  2. HTTP(S) request GET /cgi-bin/setup_user
  3. HTTP(S) request GET /cgi-bin/setup_user
  4. Parses / computes the next value with a Rhai script
  5. Checks verdict.proof for ^setup_user unlocked by arbitrary cookie$ → finding QoD 75: Samsung DVR cookie authentication bypass confirmed: GET /cgi-bin/setup_user without a cookie answered the login redirect, and with the arbi…
  6. Checks verdict.proof for ^setup_user served without cookie$ → finding QoD 70: Samsung DVR Web Viewer User Setup Page Readable Without Authentication

References:

Feed source — tests/vulnerabilities/samsung-dvr/web-viewer-cookie-auth-bypass.yaml
# Samsung DVR Web Viewer — cookie authentication bypass and cleartext user
# passwords (CVE-2013-3586, CVE-2013-3585)
#
# Ported from OpenVAS/Greenbone NVT `2013/gb_samsung_dvr_auth_bypass_08_13.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103770, GPL-2.0-only). The NASL checks that "/"
# carries the "Web Viewer for Samsung DVR" title, requests /cgi-bin/setup_user
# without a cookie and exits unless the reply holds the
# "top.document.location.href" login redirect, then repeats the request with
# `Cookie: DATA1=YWFhYWFhYWFhYQ==` and reports when the reply holds
# "<title>User</title>", "nameUser_Name_0" and "nameUser_Pw_0".
#
# Advisory: Andrea Fabrizi, bugtraq 2013-08-20 / EDB-ID 27753, US-CERT
# VU#882286. Firmware <= 1.10 only checks that a cookie is present, so any
# cookie opens every CGI; /cgi-bin/setup_user then lists every local account
# as hidden inputs `nameUser_Name_<n>` / `nameUser_Pw_<n>` with the password
# in cleartext (CVE-2013-3585).
#
# Detection (QoD 75, read-only: three GETs, nothing is changed):
#   1. GET / — must be the Samsung DVR Web Viewer.
#   2. GET /cgi-bin/setup_user without a cookie (control) — must answer the
#      login redirect and no user list.
#   3. GET /cgi-bin/setup_user with an arbitrary DATA1 cookie — the finding
#      fires when the reply is the "User" page listing user name and
#      password fields.
#
# Differences from the NASL:
#   - The leaked user names and passwords never reach the finding: the match
#     runs on a fixed placeholder and the evidence only gives the number of
#     accounts listed.
#   - The bypass reply must answer 200 and must not be the login redirect
#     itself. Redirects are not followed, so a login redirect sent as a 3xx
#     with the JavaScript body still counts as the control.
#   - When the user page is served even WITHOUT a cookie, the NASL stays
#     silent (its control exits). This feed reports it as its own finding
#     (QoD 70, CVE-2013-3585 only): the cleartext passwords are exposed to
#     anyone, but the cookie bypass itself is not shown.
uid: 38ec85fc-3afc-40d8-8ba8-df1f3052f6f9
name: "Samsung DVR Web Viewer Cookie Authentication Bypass and Cleartext Password Disclosure"
description: |
  Detects the authentication bypass in the web interface of Samsung DVRs with
  firmware 1.10 and earlier (CVE-2013-3586): the CGIs only check that a cookie
  is present, so any arbitrary cookie opens the administration pages. Through
  the user setup page (/cgi-bin/setup_user) this exposes every local account
  name and its password in cleartext (CVE-2013-3585).
  The feed first checks that the home page is the Samsung DVR Web Viewer. It
  then requests /cgi-bin/setup_user without a cookie, which must answer the
  login redirect, and again with an arbitrary DATA1 cookie. It reports the
  device when the second reply is the "User" setup page listing the user name
  and password fields. The finding only gives the number of accounts listed;
  the names and passwords are never copied into it. If the user setup page is
  already served without any cookie, a separate finding reports the
  cleartext password exposure. All requests only read pages; nothing is
  changed on the device.
cves: [CVE-2013-3586, CVE-2013-3585]
cvss: 7.6
severity: high
confidence_base: 0.30
category: auth-bypass
tags: [samsung, dvr, web-viewer, cctv, network-device, auth-bypass, cleartext-password]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-3586"
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-3585"
  - "https://www.kb.cert.org/vuls/id/882286"
  - "https://www.exploit-db.com/exploits/27753"

steps:
  # Pre-initialise the stored results so the script below never reads an
  # undefined variable when a request fails or is skipped.
  - id: init-index
    action: set_var
    var_name: index
    var_value: {status: 0, body: "", headers: {}}

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

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

  - id: index
    action: http_request
    method: GET
    path: "/"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 10
    store_as: index

  # Control: the user setup page without any cookie.
  - id: setup-user-no-cookie
    action: http_request
    method: GET
    path: "/cgi-bin/setup_user"
    follow_redirects: false
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 10
    condition: "stridx(index.body, \"<title>Web Viewer for Samsung DVR</title>\") >= 0"
    store_as: control

  # Same page with an arbitrary cookie (base64 of "aaaaaaaaaa").
  - id: setup-user-cookie
    action: http_request
    method: GET
    path: "/cgi-bin/setup_user"
    headers:
      Cookie: "DATA1=YWFhYWFhYWFhYQ=="
    follow_redirects: false
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 10
    condition: "stridx(index.body, \"<title>Web Viewer for Samsung DVR</title>\") >= 0 && control.status > 0"
    store_as: bypass

  # Verdict only — the replies hold cleartext credentials, so later match
  # steps run on fixed placeholders and report counts.
  - id: verdict
    action: script
    store_as: verdict
    code: |
      let dvr = stridx(index.body, "<title>Web Viewer for Samsung DVR</title>") >= 0;
      let ctl_user_page = control.status == 200
        && stridx(control.body, "<title>User</title>") >= 0
        && stridx(control.body, "nameUser_Name_") >= 0
        && stridx(control.body, "nameUser_Pw_") >= 0;
      // The login redirect may come as a 200 page or a 3xx: only its
      // JavaScript marker counts, as in the advisory.
      let ctl_redirect = control.status > 0
        && stridx(control.body, "top.document.location.href") >= 0
        && stridx(control.body, "nameUser_Pw_") < 0;
      let byp_user_page = bypass.status == 200
        && stridx(bypass.body, "<title>User</title>") >= 0
        && stridx(bypass.body, "nameUser_Name_0") >= 0
        && stridx(bypass.body, "nameUser_Pw_0") >= 0
        && stridx(bypass.body, "top.document.location.href") < 0;
      let open = dvr && ctl_user_page;
      let bypassed = dvr && ctl_redirect && byp_user_page;
      let accounts = 0;
      if bypassed {
        accounts = split(bypass.body, "nameUser_Pw_").len() - 1;
      } else if open {
        accounts = split(control.body, "nameUser_Pw_").len() - 1;
      }
      #{
        bypassed: bypassed,
        open: open,
        accounts: accounts,
        proof: if bypassed { "setup_user unlocked by arbitrary cookie" } else if open { "setup_user served without cookie" } else { "" }
      }

  - id: report-cookie-bypass
    action: match
    source: verdict.proof
    pattern: "^setup_user unlocked by arbitrary cookie$"
    condition: "verdict.bypassed == true"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "Samsung DVR cookie authentication bypass confirmed: GET /cgi-bin/setup_user without a cookie answered the login redirect, and with the arbitrary cookie DATA1=YWFhYWFhYWFhYQ== it answered the User setup page listing {{verdict.accounts}} account(s) with cleartext password fields (names and passwords withheld)"
        remediation: "No fixed firmware was announced with the 2013 advisory: apply the latest DVR firmware from Hanwha Vision (formerly Samsung Techwin) if it corrects the Web Viewer session check, otherwise keep the Web Viewer off untrusted networks. Change every DVR account password, since they were readable without authentication."

  - id: report-open-user-page
    action: match
    source: verdict.proof
    pattern: "^setup_user served without cookie$"
    condition: "verdict.open == true"
    on_match:
      finding:
        title: "Samsung DVR Web Viewer User Setup Page Readable Without Authentication"
        cves: [CVE-2013-3585]
        cvss: 5.0
        severity: medium
        confidence_delta: 0.45
        qod: 70
        evidence: "Samsung DVR user setup page readable without any session: GET /cgi-bin/setup_user without a cookie answered the User setup page listing {{verdict.accounts}} account(s) with cleartext password fields (names and passwords withheld)"
        remediation: "Apply the latest DVR firmware from Hanwha Vision (formerly Samsung Techwin), restrict the Web Viewer to trusted networks, and change every DVR account password."

View these feeds on GitHub