How To Block Cryptocurrency Mining In Your Web Browser – 4 Best ways

Apart from ransomware, cryptocurrency mining malware is rising in popularity at an exponential rate. As crypto-mining has gained popularity, the website owners are now using cryptocurrency mining scripts to use the CPU power of the visitors for earning profits. A few days back, the world’s most popular torrent website, ‘The Pirate Bay’ drew sharp criticism from users as it admitted to hiding details about testing a new service that intentionally used visitors’ CPU power to generate Cryptocurrency profits for itself. They said they were trying to generate revenue instead of using ads. This was followed by some other reports of similar nature – An update of the Google Chrome extension ‘SafeBrowse’ integrated a JavaScript miner as well in the extension and led to the removal of the extension from Google’s Chrome Web Store.

block-Cryptocurrency-mining-in-web-browser

Cryptocurrency is a digital asset designed to work as a medium of exchange using cryptography to secure the transactions and to control the creation of additional units of the currency. Cryptocurrencies are digital or virtual currencies that make use of encryption for security. As they are anonymous and decentralized in nature, one can use them for making payments that can’t be tracked by governments.

This crypto-mining has also fueled the ethics debate as the website owners are found to be keeping the visitors in the dark. This has also inspired some developers to come up with methods to block cryptocurrency mining in the web browser via different methods. Before knowing how to block websites from mining cryptocurrencies using your CPU via your browser, find out if you’re already becoming a target of such mining activities.

How to find out if my PC is secretly mining cryptocurrency?

Here’s how you can spot a website which is using your web browser to mine crypto-coins.

If you ever visited a website and felt a sudden slowness in your computer, there could be possible chances that your web browser is running a script to mine cryptocurrencies. The best way to spot the miner is by checking the CPU usage. You can use this technique to see if a particular website is sweating your processor and earning money. Look for those huge spikes in your CPU usage.

How To Block Cryptocurrency Mining In Your Web Browser?

Most of the websites are using Coin Hive for mining. And they are using JS based minor. There are few simple ways to block such activities:

1. Use Chrome extensions:

Installing Chrome extensions is the most straightforward method to stop coin mining in the web browser. No Coin and MinerBlock are two handy browser extensions specifically designed to block popular crypto miners on web pages from using your computing power. Both the extensions allow one-click mining blocking solution. You just need to install any of these extensions and you will see an icon in address bar.

A) No Coin Chrome Extension

no-coin-extension

No Coin is an open-source extension which is a reliable and safe way to control how a website is interacting with your web browser.

As soon as you visit a website which has installed a miner, No Coin will detect and show if any such activity is going on. While this extension blocks any such activity, it also allows you to whitelist a website for a period of time. It means you can choose to remove certain sites from your list of blocked domains in case you want to deliberately lend your CPU for usage. Clicking on the icon in the address bar shows you a button to pause/unpause its function.

B) MinerBlock Chrome Extension

minerblock-extension

Alternatively, you can use ‘MinerBlock’ extension. Just like No Coin, minerBlock Chrome extension is also an open-source tool that allows users to block cryptocurrency miners in the web browser. This extension also allows users to blacklist and whitelist a website for a period of time.

2. Use Adblocker

adblock

Adblock is indeed a great extension for blocking ads. However, you can also manually add the crypto miners in question to your list of blocked domains using Adblocker.

In Chrome, install the Ad Blocker extension and then go to Customize > Block an ad by its URL. Then add the following URL in the text box

https://coin-hive.com/lib/coinhive.min.js

Most of the people are using Coinhive for bitcoin mining, this will block mining from most of the websites. Depending on your web browser, you can find relevant settings to block particular domains.

3. Block coin mining domains in hosts file

This is the manual way of blocking particular domains that you find harmful or irritating. Due to such blocking, your browser won’t be able to connect to these domains. We can edit the hosts file of the operating system so that those domains redirect to localhost (IP address 0.0.0.0).

To add Bitcoin mining domains to the hosts file:

  • On Linux, you need to open the hosts file by running “sudo nano /etc/hosts” command and add “0.0.0.0 coin-hive.com” to the end of the document. On Mac OS X, you can run sudo nano /private/etc/hosts. Replace nano with whatever editor you favor.
  • For Windows, navigate to C:WindowsSystem32driversetc and edit the hosts document to add “0.0.0.0 coin-hive.com” at the end.

hosts-file-block-bitcoin-mining

TIP: Make sure you press the Tab-key after entering the IP address 0.0.0.0 and save the document.

Please note that this change blocks the mining scripts which are hosted only by coin-hive.com, but not any sub-domain such as www.coin-hive.com. So, you may need to add these variants if they are used as well to the hosts file. In case you come across other mining script domains, you can add them further down the line.

4. Use JavaScript-blocking extensions

Script-Safe

JavaScript-blocking extensions like NoScript Security Suite (for Firefox) or ScriptSafe (for Chrome) can also help. They allow only active content to run only from sites you trust and protect you against XSS and Clickjacking attacks.

Before using NoScript to block cryptocurrency mining in the web browser, please note that it’s pretty aggressive and it could break lots of websites as it disables all scripts running on pages.

firefox-noscripts

Now you know how to block Cryptocurrency mining. You can use any one of these methods to get rid of the cryptocurrency mining in the web browser.

Stay alert, stay safe!

Source