The hijacking of CPU cycles through crypto-mining JavaScript code has surged over the past few days, according to security biz Trend Micro.

The reason appears to be a distribution campaign that piggybacks on Google's DoubleClick ads that appear on YouTube among other sites.

"We detected an almost 285 per cent increase in the number of Coinhive miners on January 24," said Trend Micro researchers Chaoying Liu and Joseph C. Chen on Friday in a blog post, noting that traffic to five malicious domains picked up on January 18. "After closely examining the network traffic, we discovered that the traffic came from DoubleClick advertisements."

Coinhive is JavaScript code designed to mine Monero, a cryptocurrency favored by online criminals and others because of its privacy features. Its creators position the code as a way for websites to make money without relying on ads.

Stealth web crypto-cash miner Coinhive back to the drawing board as blockers move in READ MORE

It's when the code gets used without consent that there's a problem. And that's been happening more frequently because it's almost a victimless crime. People may complain when their data gets stolen, but few even notice when their computer is asked to do covert calculations.

Liu and Chen say that the scheme relies on two separate web mining scripts, hosted on AWS, called from a web page that presents the DoubleClick ad. When the web page is loaded, a legitimate ad gets presented while a randomly generated number decides which of the two mining scripts gets called.

Ninety per cent of the time, coinhive.min.js runs; the other 10 per cent of the time, it's a script named mqoj_1.js – configured to contribute to a separate mining pool as a means of avoiding the 30 per cent CoinHive commission.

At least that's the breakdown seen by Trend Micro. Variant code posted to Pastebin shows the mqoj_1.js file being run only 3 per cent of the time.

Either way, the scripts are set to consume 80 per cent of the CPU resources on the computer in question.

Google says it took action against the ads once it became aware of them.

"Mining cryptocurrency through ads is a relatively new form of abuse that violates our policies and one that we’ve been monitoring actively," a spokesperson told The Register in an email. "We enforce our policies through a multi-layered detection system across our platforms which we update as new threats emerge. In this case, the ads were blocked in less than two hours and the malicious actors were quickly removed from our platforms."

The problem Google faces is that those abusing its systems rely on cloaking techniques to conceal the nature of the code and fake accounts that can be abandoned without consequence. As with email spammers, it's a game of Whac-A-Mole.

Google confronted a similar issue in November when it emerged that miscreants were misusing Google Tag Manager to distribute coin crunching code. The Chrome extension SafeBrowse was also spotted quietly taxing processors to collect Monero. ®