While performing security research on personal storage I found some vulnerabilities in the WD (Western Digital) MyCloud device. Trustwave reported them to WD back in 2017 and now that patches are available we can discuss the technical details.
The first finding was discovering hardcoded administrator credentials in the nas_sharing.cgi binary. These credentials allow anyone to authenticate to the device with the username "mydlinkBRionyg". Considering how many devices are affected this is very serious one. Interestingly enough another researcher independently released details on the same issue less than a month ago.
Another problem I discovered in nas_sharing.cgi is that it allows any user execute shell commands as root. To exploit this issue the "artist" parameter can be used. Figure 1 shows a proof of concept combining these two findings in order to log in using the hard coded credentials and executing a command to create a file. The command is passed inside the "artist" parameter using base64 encoding. In this particular screenshot the command decodes to: a" ; touch /jambon; echo ".
Figure 1: Proof of concept combing the hard coded credentials and the command execution
The final issue with the same nas_sharing.cgi binary is arbitrary file deletion. This is possible via the "path" parameter manipulation. Usually on embedded systems many processes run unrestricted (i.e. as root) so no security checks are performed at all once a command (file deletion in this case) is about to execute. Figure 2 shows a proof of concept combining the hard coded credentials and using the "path" parameter to delete a file. Just like with the "artist" parameter above, the command is passed using base64 encoding.
Figure 2: Proof of concept combing the hard coded credentials and the arbitrary file deletion
WD lists these issues as fixed in firmware version 2.30.172 and mention in their release notes:
"Resolved critical security vulnerabilities that potentially allowed unauthorized file deletion, unauthorized command execution and authentication bypass."
So, as usual, Trustwave urges you to apply updates ASAP. More information about these vulnerabilities can be found here: http://www.trustwave.com/Resources/Security-Advisories/Advisories/TWSL2018-001/?fid=10658