Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Crypto-miner script injected on your website: find and remove it

OPS-145Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Cryptojacking means using someone else's computer to mine cryptocurrency without asking. On a website, the attacker adds a script to your pages. When a visitor opens the page, their browser runs it and burns CPU power for the attacker's profit. You pay nothing directly, but your visitors do, and they blame you.

Why it costs you leads or sales

Page speed with and without a minerExample numbers
Page speed with and without a miner (example)Clean page: 2.5 seconds to interactive; Page with miner: 7.5 seconds to interactive0362.57.5Clean pagePage with minerseconds to interactive

Example: illustrative load times on a mid-range phone. Real numbers depend on the miner and the device.

How a hidden script slows the visit

The visitor opens your page, a hidden script starts mining, the page lags and the visitor leaves.

How to check if your site has it

Look for the script
  1. Notice the symptoms

    Open your site on a laptop and listen for the fan. Open Task Manager (Windows) or Activity Monitor (Mac) and see if the browser tab uses a lot of CPU while the page sits idle.

  2. List every script the page loads

    In Chrome, open DevTools (F12), go to the Network tab, filter by JS and reload. Note each domain. Look for domains you do not recognise.

  3. Search the page source

    Press Ctrl+U (Cmd+Option+U on Mac) and search for words such as coinhive, cryptonight, coin-hive, miner, wasm, stratum and webminer. Also look for long strings of unreadable code, eval( and atob(.

  4. Check the Performance tab

    In DevTools, record a few seconds on the idle page. Constant heavy scripting or web workers you cannot explain are suspicious.

  5. Compare against files you know

    Check recently changed files, your theme, your tag manager containers and the custom code areas of your site builder.

How to fix it

Remove the miner and close the entry point
  1. Put the site in maintenance mode if you can

    This stops more visitors being affected while you clean.

  2. Remove the injected code

    Delete the script tag or file. Remove it from every place it was added (see the platform tabs below).

  3. Change every credential

    Reset admin, hosting, FTP/SFTP, database and tag manager passwords. Turn on two-factor authentication. Remove users you do not recognise.

  4. Update everything

    Update the CMS, plugins, themes and any libraries. Delete plugins and themes you do not use.

  5. Restore clean files if needed

    If you cannot find all the changes, restore from a backup made before the infection and then update immediately.

  6. Clear caches

    Purge your CDN, plugin cache and server cache so visitors stop getting the infected version.

Where to look on each platform
  1. Check theme and plugin files

    Look in header.php, footer.php and functions.php of your theme, and in any 'insert headers and footers' plugin settings. Reinstall WordPress core, plugins and themes from fresh copies.

  2. Search the database

    Injected code is often stored in wp_posts, wp_options and widget text. Search for the suspicious domain or strings like coinhive.

  3. Check users

    Go to Users and delete unknown administrators. Reset all passwords.

Search your site files for common miner stringsbash
grep -rIlE "coinhive|coin-hive|cryptonight|webminer|stratum\+tcp" /path/to/your/site
# list files changed in the last 14 days
find /path/to/your/site -type f -mtime -14

How to confirm it's fixed

Confirm the clean-up
  • View source and search again for the script domain and miner keywords: nothing found.
  • Network tab shows no requests to unknown domains.
  • Idle CPU use of the page tab is normal.
  • Test in a private window and on a phone using mobile data.
  • Caches and CDN are purged.
  • All passwords reset and two-factor authentication on.
  • No unknown admin users or staff accounts remain.
  • Check again after 24 hours in case a hidden backdoor re-injects the code.

How to prevent it happening again

Hardening
  • Turn on automatic updates for core, plugins and themes where safe.
  • Use unique strong passwords and two-factor authentication for every admin login.
  • Remove unused plugins, themes, apps and old users.
  • Keep a written list of the third-party scripts your site should load.
  • Limit who can publish in your tag manager.
  • Add a Content Security Policy that only allows script sources you trust.
  • Keep off-site backups and test restoring them.
Example Content Security Policy (adjust to your own script sources)html
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://www.googletagmanager.com https://www.google-analytics.com;">

How FunnelGuard handles this

How an injected miner reaches your visitors
  1. Weak entry pointOld plugin or stolen login
  2. Script injectedAdded to theme or tag manager
  3. Visitor loads pageBrowser runs the miner
  4. Page slows downForms and checkout lag

The break happens at the entry point; every visit after that runs the script.

Frequently asked questions

Questions people ask

How do I know if my website has a crypto miner?

Check for high CPU use on an idle page, a slow site and unknown script domains in the Network tab of your browser's DevTools. Also search the page source for words like coinhive, cryptonight and miner. Review your theme, custom code areas and tag manager too.

Why is my website slow and making my computer fan spin?

One possible cause is a hidden crypto-mining script using your processor. Other causes include heavy ads, large images and too many plugins. Check the Network and Performance tabs in DevTools to see which scripts consume the most time.

How do I remove a crypto miner script from my website?

Back up the site, then delete the injected script from your theme, database, custom code areas and tag manager. Reset all passwords, remove unknown users, update everything and clear caches. If you cannot find it all, restore a clean backup and update at once.

How did a crypto miner get onto my site?

Usually through an outdated plugin or theme, a stolen admin, FTP or tag manager login, or a compromised third-party script. Finding the entry point matters, because removing the script alone lets the attacker put it back.

Can a Google Tag Manager tag contain a miner?

Yes. A Custom HTML tag or custom template can load any script, including a miner. Review every Custom HTML tag, check user access and use version history to roll back unexpected changes.

Will FunnelGuard alert me if a crypto miner is injected?

Only partly. It does not flag unknown third-party scripts, so a quiet miner may not trigger an alert. It does catch broken journey steps, failed forms and missing tracking that a miner might cause, so pair it with a monthly manual script review.

Is a crypto miner on my site a sign of a bigger hack?

Often yes. Someone had write access to your files, database or tag manager, so they may have added other malware, backdoors or admin users. Check for those and reset every credential.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: site safety (Stage 26, daily): known crypto-miner scripts.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.