I am not familiar with the coin-hive service, but actually the script you provided contains the following lines:
var JobThread = function() { this.worker = new Worker(CoinHive.CRYPTONIGHT_WORKER_BLOB); this.worker.onmessage = this.onReady.bind(this); ... };
As you can see, this uses Workers. I have not studied the entire script, but in any case, the use of web workers means that some operations can be performed even after the page is closed. Additional information in this post .
So, the very first answer to your question: YES, users can be infected for some time after closing the page (theoretically, if the script is written this way).
But in fact, the script appears very soon by the system itself. Also, the hive coin platform is not positioned as malware and should be safe for users. I don’t think you should worry about this.
Artem arkhipov
source share