Cybercriminals have developed a new Web-based attack tool to hijack routers on a large scale when users visit compromised websites or view malicious advertisements in their browsers.
The goal of these attacks is to replace the DNS (Domain Name System) servers configured on routers with rogue ones controlled by attackers. This allows hackers to intercept traffic, spoof websites, hijack search queries, inject rogue ads on Web pages and more.
What is DNS?
The DNS is like the Internet’s phonebook and plays a critical role. It translates domain names, which are easy for people to remember, into numerical IP (Internet Protocol) addresses that computers need to know to communicate with each other.
The DNS works in a hierarchical manner. When a user types a website’s name in a browser, the browser asks the operating system for that website’s IP address. The OS then asks the local router, which then queries the DNS servers configured on it — typically servers run by the ISP. The chain continues until the request reaches the authoritative server for the domain name in question or until a server provides that information from its cache.
If attackers insert themselves in this process at any point, they can respond with a rogue IP address. This will trick the browser to look for the website on a different server; one that could, for example, host a fake version designed to steal the user’s credentials.
The attacks typically work like this: Malicious code injected into compromised websites or included in rogue ads automatically redirect users’ browsers to an attack server that determines their OS, IP address, geographical location, browser type, installed plug-ins and other technical details. Based on those attributes the server then selects and launches the exploits from its arsenal that are most likely to succeed.
These types of attacks are possible through a technique called cross-site request forgery (CSRF) that allows a malicious website to force a user’s browser to execute rogue actions on a different website. The target website can be a router’s administration interface that’s only accessible via the local network.
Many websites on the Internet have implemented defenses against CSRF, but routers generally lack such protection.
Depending on the detected model, the attack tool tries to change the router’s DNS settings by exploiting known command injection vulnerabilities or by using common administrative credentials. It uses CSRF for this as well.
If the attack is successful, the router’s primary DNS server is set to one controlled by attackers and the secondary one, which is used as a failover, is set to Google’s public DNS server. In this way, if the malicious server temporarily goes down, the router will still have a perfectly functional DNS server to resolve queries and its owner will have no reason to become suspicious and reconfigure the device.
The vast majority of routers need to be updated manually through a process that requires some technical skill. That’s why many of them never get updated by their owners.
To protect themselves, users should check manufacturers’ websites periodically for firmware updates for their router models and should install them, especially if they contain security fixes. If the router allows it, they should also restrict access to the administration interface to an IP address that no device normally uses, but which they can manually assign to their computer when they need to make changes to the router’s settings.