Based on the Shodan query returns and the site key that used by an attacker for those devices indicates that it mainly focused on Brazil.
In this case, one of the users from Brazil complains that CoinHive code injects that every page that he visits but he can’t solve it even though changing the DNS and removing the router.
Also, a Tweet finds in Twitter say that the exploit used against the MikroTik routers that are not a zero day but for a vulnerability patched by MikroTik on April.
— MalwareHunterBR (@MalwareHunterBR) July 30, 2018
After the patch released by MikroTik, still there are hundreds of thousands of unpatched devices are out there and many of them found in Brazil.
A Researcher from trustwave found that the attacker used the device’s functionality in order to inject the CoinHive script into every web page that a user visited.
How does MikroTik Routers Infected
Intially stage of the attack starts with a custom error page that created by attackers and injects the embedded CoinHive script within it.
Criminals utilized the device functionality to injecting the CoinHive content into each page that a visit by users.
When user receiving the error page while web browsing, they will get this custom error page which will mine CoinHive for the attacker.
According to the researcher, The backend Apache server is connected to the router as well, and somewhere along the way there was an error and it was displayed to me, miner included. What this means is that this also impacts users who are not directly connected to the infected router’s network, but also users who visit websites behind these infected routers. In other words, the attack works in both directions.
So whenever user connecting the router using Wireless connection the CoinHive miners starts its execution and mine the cryptocurrency.
Here mikrotik.php file is unknown and it doesn’t exist in the attacker server, also since the attackers having an extraordinary understanding of the Mikrotik router, It could be the script that injects CoinHive into every HTML page.
Also, it has an ability to change the current site key once the user will replace with another, here attackers perform the scheduled task that downloads and executes a script written for MikroTik routers.
Researchers find the script that attackers used to attack the vulnerable routers and “the script modifies some system settings, enables the proxy, fetches the custom error pages and creates the scheduled tasks for updating if needed. A backdoor account named “ftu” is created as well.”
This coinhive site key finds in over 170,000 MikroTik devices and some time server connected with infected servers also return an error page, another Tweet mention that another 25,000 servers are infected.
Coinhive site key “oDcuakJy9iKIQhnaZRpy9tEsYiF2PUx4” is used in another #cryptojacking campaign targeting MikroTik routers. In this case, over 25,000 affected hosts are found on @censysio
— Bad Packets Report (@bad_packets) August 2, 2018
This attack warning that the reminder to everyone who has a MikroTik device to patch as soon as possible.