
This repo describes a vulnerability affecting the QR code based pairing process of the eWeLink IoT devices (CVE-2020-12702).
Unconstrained Web access to the device's private encryption key in the QR code pairing mode in the eWeLink mobile application (through 4.9.2 on Android and through 4.9.1 on iOS) allows a physically proximate attacker to eavesdrop on Wi-Fi credentials and other sensitive information by monitoring the Wi-Fi spectrum during a device pairing process.
From the user perspective, the QR code-based pairing process between the IoT device and the user’s WiFi, through the eWeLink application, acts as follows:
The QR code label supplied with a supported device (a Sonoff Micro from ITEAD) encodes the following URL https://api.coolkit.cn:8080/add-ap-device?brand=ewelink\&ssid=ITEAD-device_id, where:
During the first step, the application connects to eu-api.coolkit.cc:8080/api/user/fdbaseinfo?deviceid=device_id&other_parameters endpoint, from which it retrieves the device secret-key, along with other device information. According to the above-described flow, the service invoked by the application returns a key that is then used to encrypt (using the AES algorithm) the user’s WiFi credentials before sending them to the IoT device through the dedicated softAP WiFi network.
An encrypted JSON message is sent through an http post request to the open device http server.
The original payload follows the structure reported below:
{"ssid" : "Test-Network", "password" : "Test-Password", "serverName" : "eu-disp.coolkit.cc", "port" : 443}
where the "Test-Network" and "Test-Password" parameters are the network credentials we chose for our testbed configuration, and the eu-disp.coolkit.cc is the cloud platform serving the European region.
We ran different tests, and we noticed that during the pairing process everyone near the WiFi soft AP can retrieve the device_id parameter, since it is part of the device softAP WiFi SSID. To retrieve a particular device secret-key you just need:
As a consequence, just by knowing a device id, the corresponding device secret key can be easily retrieved. This enables a nearby malicious user to grab the user’s WiFi credentials by eavesdropping on the configuration message transmitted by the user’s smartphone to the IoT device. Note that, the device softAP Wifi is open and unprotected by default, so eavesdropping is possible.
After retrieving the secret key from the cloud services (together with the already known device_id parameter), the malicious user could decrypt the configuration message and extract the user’s WiFi credentials. As a consequence, the customer's full home network is compromised.
This vulnerability has been tested with the Android (v4.11.0 and earlier) and iOS (v4.9.1 and earlier) versions of the eWeLink mobile application.
[1] Daniele Granata, and Massimiliano Rak, and Giovanni Salzillo, and Umberto Barbato. "Security in IoT Pairing & Authentication protocols, a Threat Model and a Case Study Analysis", ITASEC 2021.
MIT