The source code of the GhostDNS exploit kit (EK) has been obtained and analyzed by researchers. GhostDNS is used to compromise a wide range of routers to facilitate phishing — perhaps more accurately, pharming — for banking credentials. Target routers are mostly, but not solely, located in Latin America.
The source code used in a GhostDNS campaign was obtained by Avast researchers. Avast Antivirus includes a Web Shield to protect users from malicious web content. One of its users was up to no good, and attempted to upload a RAR archive with malicious content. He forgot to disable Web Shield and password protect the RAR. Web Shield detected it as malicious, automatically analyzed the content, and flagged it as an exploit kit.
“We downloaded the linked file and found the complete source code of the GhostDNS exploit kit,” reports the Avast Threat Intelligence Team. The RAR archive is named KL DNS.rar, indicating its purpose — a DNS hijack redirecting users to a phishing/pharming page where a keylogger is used to extract the user’s credentials or bank card details.
The archive contained everything necessary for a DNS hijack campaign, both from inside the network, or externally from the internet. Internal attacks are often via malvertising. Malvertising allows the EK to directly attack the router from a computer that uses the router. External attacks from the internet require scanning for and locating vulnerable routers before they can be attacked. Everything necessary for both forms of attack were contained in the RAR archive.
Most GhostDNS campaigns target routers in Latin America, and Brazil in particular. According to telemetry obtained from Avast’s antivirus product, 76% of routers in Brazil have weak or default credentials, making the region a lucrative target.
For attacks from the internet, the archive included BRUT, a free internet scanner that locates and attacks routers with a public IP address and an open HTTP port. Avast has found two versions of BRUT. One targets a lower number of devices and ports but with a long list of default and common passwords that could be used, while the other targets a higher number of devices with a smaller number of possible credentials. The latter appears to be the more recent version.
The researchers postulate that this “may be because most users never change the default credentials in their SOHO routers, and therefore using a smaller number of credentials for the attack may be effective enough.” Fewer credentials against more router models may be more effective than many credentials against a limited number of different routers. Interestingly, both sets of credentials include the password ‘deadcorp2017’, which is used by GhostDNS as a new password in infected routers — which means that new campaigns can gain access to routers already infected even if the original password is not included in the current campaign.
The basic attack methodology is to use cross site request forgery (CSRF) requests to change the DNS settings on the router. The process establishes a rogue DNS server that is specified by the attacker for each GhostDNS campaign. There were three different malicious DNS setting in the code found by Avast — none of which are currently operational.
Once the DNS settings have been changed, users can be silently redirected to pre-made pharming pages. The RAR file obtained by Avast included source code for several such pages. These included the biggest banks in Brazil — such as Banco Bradesco, Itau, Santander and CrediCard — and Netflix. The source code indicated that other domains were prepared to work, but that the phishing web pages had not been implemented.
The internal attack associated with a malvertising campaign operates differently. The EK searches for routers with an open port (either 80 or 8080). It produces a BASE64 encoded iframe representing a simple webpage with a function that changes HTTP requests to WebSocket requests. These requests change the DNS settings to the predefined malicious IP addresses. Only eight username/password pairs are found in this attack, but they include the most-used default router logins used in Brazil.
Once the victim has been successfully redirected to a malicious pharming page, a keylogger steals login details and bank card details and emails them to the attacker.
Related: New Exploit Kit Targets SOHO Routers