Over the years WiFi Routers have been notoriously susceptible to simple attacks. In early 2017, Trustwave SpiderLabs Researcher Simon Kenin identified 43 different models of Netgear Router to be vulnerable for Remote and Local Password Disclosure.
More recently, in May 2017, Felipe Cerqueira and Thiago Musa, both from Trustwave SpiderLabs, have found a remote vulnerability in the HUMAX WiFi Router model HG-100R*. This vulnerability can allow attackers to compromise the WiFi Credentials and, even more dangerous, to retrieve the router console administrative password. The equipment is a default brand/version distributed by a major Internet provider in Brazil (where the vulnerability was discovered) but is also used in many other parts of the world.
The vulnerability starts with bypassing authentication via specially crafted requests to the management console. This works because the router does not validate the session token while returning answers for some methods in "url/api". An attacker can use this vulnerability to retrieve sensitive information such as private/public IP addresses, SSID names and passwords.
The cookie login is basically json data containing uid and pwd encoded in base64:
In the example below you can see a request to the router without providing any authentication as well as the response containing sensitive data such as SSID name, IP addresses and WiFi password.
Another vulnerability allows attackers to bypass authentication in order to access the backup functionality for saving (/view/basic/GatewaySettings.bin ) and restoring (/view/basic/ConfigUpload.html) configuration. Both ignore the absence of the cookies "login" and "login_token" and will accept requests to download and upload the full router configuration.
By using the backup generation/restore functionality provided by the URLs "/view/basic/GatewaySettings.bin" and "/view/basic/ConfigUpload.html" we were able to retrieve, change and finally restore a specially crafted configuration. As an example of the danger of this type of vulnerability, an attacker could use it to change your DNS configuration and redirect your traffic to servers controlled by them in order to steal private information such as passwords or banking account information.
Careful analysis of the file GatewaySettings.bin also showed that the administrative password was stored there without any encryption.
Basically, the file is composed by a header and from the byte 96, it is encoded in base64.
After the codes 00 00 4c c8 (which is the length of the data ahead), all the following data is simply encoded with base64. After decoding the bin file makes a lot of sense.
We can see in this example the password 'AAAAAAAA' in clear text used for the user 'admin'. There is a user 'root' which uses the password 'humax'. Specific uses for this account have not yet been identified. Indeed, this is an interesting topic for further research.
If your router allows remote configuration management via the Internet, attackers can easily gain access to it and change configurations that will impact your Internet traffic. However, even if configuration management is not available on the Internet facing interface, attackers can still exploit the vulnerability in locations where WiFi routers are public, for instance in a café or airport.
How can you avoid this risk?
Unfortunately, despite repeated attempts to disclose this vulnerability to Humax, we have not had any response from the organization. Because of this there is no official patch for this vulnerability. To prevent remote exploitation, make sure your WiFi Router is not exposed to the Internet: Disable the option "Remote Configuration Management" as shown here:
Access your HUMAX WiFi Router via the following URL: http://192.168.0.1 and you should be able to find the credentials on the bottom of the router itself. By default, this configuration is not enabled, but you should double check it to make sure. If you don't have access to your router, try to contact your Internet Service Provider and ask for support or, perhaps, a new router.
For more information please see the full security advisory here: https://www.trustwave.com/en-us/resources/security-resources/security-advisories/