Back
Coinhive script clean up from hacked website

How To Clean Up CoinHive Miner Code From The Hacked WordPress Website?

We have noticed that a massive number of hacked WordPress websites are used for Monero cryptocurrency mining. Hackers use CoinHive – a Monero cryptocurrency mining program written in the JavaScript programming language. When embedded into your site, this program mines cryptocurrency by borrowing your website visitors’ computer resources. If you have noticed this, we recommend to perform steps outlined below and clear CoinHive mining code from your website.

Identify modified files

The first thing to do is to identify which files have been changed. You can do this in several ways:

  • Connect to the server (if it is possible). Use command “$ find ./ -type f -mtime -10”, where -10 means day interval.
  • Use the FileZilla program. First, choose Server -> Search remote files… In the window that opens, select search conditions -> date, after, and enter the date, e.g. 10 days earlier than today.
  • Refer to the hosting. If you can’t access your server, you can try to contact your hosting administrator and request a help.

If you do not find any modified files, it is possible that the CoinHive mining code is loaded into the database. In this case, you should look up for “CoinHive” keyword in your database table. If you have access to phpMyAdmin, use the Search tool or try to search using SQL LIKE request for connecting to the server.

View modified files

There should be CoinHive code in the modified files. If all the files look clean, then try searching for a “coinhive” keyword in all the website files. How to do this:

  • If you have access to the server, use the following command: grep -rnw '/' -e 'coinhive'
  • If you are not able to access the server, you can use a code editor such as Notepad ++. Select “Search text string in all files and folders” and start searching.

Clean up CoinHive code

Code example:


Remember that this part of the CoinHive JavaScript miner code TnKJQivLdI92CHM5VDumyS is used to identify the user of the script and may vary. You can also take a look at our removal guide here: How To Clean A Hacked WordPress Site On Your Own

Reduce the risk so that it does not happen again

Change your hosting, database and FTP passwords. Change passwords for all users, make sure all the passwords are strong. Renew WordPress and all plugins, make sure all plugins you use do not have security holes – use our database.

Rasa A.

Similar Posts

WordPress 5.0 to 5.0.1

WordPress 5.0 and its vulnerabilities found in the first week of release

The long awaited WordPress version 5.0 has finally become available from the 2018 December 6. Some users waited for this version with ...

WordPress Security category

WordPress security and performance – two closely related subjects

WordPress security and WordPress performance are two main topics that bother website owners every day. Everyone wants a fast and secure ...

WordPress site hacked after restore

My WordPress website got hacked after restore. Again! Why?

Quite often we hear about the repeated security incidents related to WordPress sites. This is not something specific to WordPress sites, ...