How Mining Scripts Work

The best example of mining script usage comes from the time when The Pirate Bay – a popular destination for software and media piracy – has been caught with a script that mined Monero from visitors’ computers. Many users found themselves unknowingly giving the site the revenue it needs to keep running (and then some) by using their computer power to mine a cryptocurrency. The owners of the website did this to avoid displaying ads. Mining scripts like these work because they execute on the client side. While scripting languages like PHP usually use the server’s resources to send data to the client on how they should display a particular page, languages like JavaScript rely almost entirely on the resources of the visitor, delegating some of the tasks of presenting page elements to the browser that visits the site. For example, one could write a script in JavaScript that asks the browser to get an ad from a third-party provider, much like how Google AdSense works. In the case of mining scripts, the code asks the browser to donate its computing power to mine a cryptocurrency. And the browser abides this request, not knowing any better.

How to Tell If You’re Being Hijacked

The simplest way to detect this kind of script running on a page is to look through your tasks and see if anything is consuming an unusual amount of CPU power. If your CPU usage hits 100% on one core while you’re just visiting a text-based page (and you see that one of your browser tasks is the culprit), then you’re probably being hijacked. To stop the hijack in its tracks, just close the tab you think is eating up all of your resources. If you’re using a browser that executes multiple tasks in your task manager (or processes in your system monitor for those of us who use Linux), then you can just close the culprit task and it will kill the tab for you.

What Are Browser Developers Doing About This?

I don’t know if the folks at Mozilla or any other browser developers have looked at this yet, but it is likely since Google engineers at the Chromium project are beginning to show awareness about the issue. Ojan Vafai, one of the engineers, has responded to an earlier bug report on 19 October 2017 and proposed some solutions to the problem, including an idea that involves automatically throttling tabs using the CPU heavily. This doesn’t necessarily mean that a solution is coming overnight, but since engineers are already aware of the issue, we can be sure they’re working on protecting the browser’s users as soon as they build a consensus on what to do about mining scripts. Since browsers usually follow each other’s leads, it’s likely that other solutions will be brought to the fray as time passes. What do you think browser developers should do to combat mining scripts? Do you consider them a valid alternative to advertising (if they don’t hog all of your CPU power)? Tell us all of your thoughts in a comment!