Bitcoin mining can be profitable, and that is likely the reason why we have seen desktop miners and now also browser miners being pushed on to user devices.
The Piratebay experimented with running a Bitcoin miner instead of ads recently, and created quite the uproar as users started to notice that the new monetization method would yank up CPU usage to 100%.
Any site you visit in the browser, and any browser extension, may run Bitcoin mining operations. While it seems highly unlikely that popular or user respecting sites or extensions will do that, it seems likely that these first incidents were just the first wave of mining operations to come.
Computer users have a couple of options when it comes to protecting their devices against browser-based Bitcoin mining.
While it is certainly possible to use content blocking extensions to prevent mining scripts to run in first place on sites, these usually won't block extension-based mining.
Probably the best option right now is to block known Bitcoin mining domains. One of the better options to do that is to add these to the hosts file of the operating system so that these domains redirect to localhost.
The effect is that sites and extensions won't be able to contact these domains anymore because of the redirect. Downside is that you need to add new domains and modify existing ones if the need arises manually.
Windows users need to do the following to add Bitcoin mining domains to the hosts file:
- Open Explorer or another file manager on the system, and go to C:\Windows\System32\drivers\etc.
- Open the file hosts in a plain text editor, for instance Notepad.
- Add the line 0.0.0.0 coin-hive.com to the end of the document. Make sure you press the Tab-key after entering the IP address 0.0.0.0.
- Save the document.
What this does is redirect any request to coin-hive.com to the IP address 0.0.0.0 (the local device).
As Ghacks reader Linuxfan mentioned, the line mentioned above blocks only coin-hive.com but not any subdomain such as www.coin-hive.com. So, you may need to add these variants if they are used as well to the hosts file.
Tip: On Linux, you can run sudo nano /etc/hosts, on Mac OS X, sudo nano /private/etc/hosts. Replace nano with whatever editor you favor.
This takes care of Bitcoin mining scripts hosted by coin-hive.com, the service that both the Pirate Bay and the Chrome extension used. Note that this won't take into account self-hosted scripts. You need to add those separately to the hosts file to block them as well.
Check out these resources for additional information on the hosts file:
Now You: Do you use the hosts file to block online resources?