All articles · Web Security

Has My Website Been Hacked? How to Check a Site for Malware

Cover with the article title next to a shield with a check mark, in green on a dark background

Most hacked websites don’t announce it. There is no skull on the home page and no ransom note. The owner finds out weeks later, when Google shows a red warning, when a customer asks why the site sent them to a casino, or when the host suspends the account for sending spam.

That is by design. A compromised site is worth more to an attacker while it keeps working, so the infection hides: it shows spam only to search engines, redirects only visitors who arrive from Google on a phone, or loads a script from a domain registered last week. This guide walks through the checks that find those infections, from the quickest look from outside to the server itself.

Why “my site looks fine” proves nothing

Three habits of modern malware explain why owners miss it:

  • Cloaking. The injected code checks who is asking. Logged-in administrators, visitors who type the address directly and repeat visitors see the normal page. A first-time visitor from a search result, or Googlebot itself, gets the spam or the redirect.
  • Conditional loading. Scripts fire only on mobile, only once per visitor, or only in some countries. Testing from your desktop, where you are logged in, shows nothing.
  • Hidden content. Spam links sit in the HTML with display:none, off-screen positioning or zero-size text. Visitors never see them; search engines do.

So the checks below look at the site the way strangers and search engines see it, and then at the files and database, where cloaking can’t hide anything.

Check 1: Is the site on a blocklist?

Browsers warn visitors about sites on Google’s Safe Browsing list, and the same list protects Gmail, Android and many other products. Look up your domain in Google’s Safe Browsing site status page. A “Some pages on this site are unsafe” answer means the infection is confirmed and visitors are already being warned.

If the site is verified in Google Search Console, open Security & Manual actions → Security issues. Google lists the type of problem (malware, deceptive pages, hacked content) and sample URLs. Bing Webmaster Tools shows similar warnings for Bing and the search engines it supplies.

Our Website Malware Checker runs this kind of lookup in one go: the page and the third-party scripts and frames it loads go to Google Web Risk, and the domain is also resolved through Quad9’s filtering resolver, which blocks names known to serve malware. A listing there is a confirmed finding, not a guess.

Check 2: Search for your own domain

Search engines see what cloaked malware shows them, so their index is a good mirror. Search for:

site:example.com
site:example.com viagra OR casino OR loan OR replica
site:example.com inurl:.php?

Replace the words with the spam common in your market. Japanese or Chinese titles on an English site, pages you never created, or titles about pharmacies and betting are the classic sign of a “spam injection” hack: the attacker generates thousands of pages on your domain to borrow its reputation. Search Console’s Pages report showing a sudden jump in indexed URLs points the same way.

Then click a result from the search page itself, on a phone if you can. A redirect that only happens when you arrive from Google is a strong sign of infection.

Check 3: Look at the HTML, not the screen

View the page source (Ctrl+U in most browsers) of the home page and one or two inner pages while logged out, ideally in a private window. Look for:

  • <script> tags loading from domains you don’t recognise, especially short random names or new top-level domains.
  • Long blocks of unreadable code: eval(, atob(, String.fromCharCode, or a single line of thousands of characters.
  • Links inside elements hidden with display:none, visibility:hidden or huge negative positions.
  • Anything before <html> or after </html>. Legitimate templates don’t put code there; injected code often does.
  • <iframe> elements with zero width or height.
  • A “verify you are human” box asking visitors to press Win+R and paste something. That is the ClickFix trick, which tricks visitors into installing malware.

Reading source by hand gets tedious. Our scan does it for you: the Malware Signs section of every report checks the HTML, robots.txt, the sitemap and the scripts PageSpeed saw load, and names each sign it finds. The guide on infection signs explains each one and how sure we can be about it.

Check 4: Third-party scripts you didn’t add

Not every infection is on your server. If a script you load from another service is compromised, every site that uses it is affected. That happened with the polyfill.io domain in 2024, when a widely used library host started serving malicious code to visitors of more than 100,000 sites.

List the external scripts your pages load (the report’s script inventory does this) and ask of each one: do we still use it, who runs that domain now, and could we host it ourselves? Pin files to a version and add Subresource Integrity where the host allows it. Our guide on supply-chain scripts covers this in more detail.

Check 5: On the server

The outside checks find most infections, but some only show on the server. If you have access, or your developer or host does, these take an hour:

Admin accounts. List every user with administrator rights. An account you don’t recognise, often with a plausible name like wp-support or admin2, is the attacker’s way back in.

Changed core files. On WordPress, WP-CLI compares your files with the official release:

wp core verify-checksums
wp plugin verify-checksums --all

Any file reported as changed or “should not exist” deserves a look. Other CMSs have similar tools; for a custom site, compare with your Git repository.

Recently modified files. Malware rarely updates the file dates of a whole site at once:

find . -type f -name "*.php" -mtime -14 | sort

PHP files in upload folders (wp-content/uploads on WordPress) are almost never legitimate.

The database. Look for scripts in posts, widgets and options. On WordPress, the siteurl and home options pointing elsewhere, or <script inside wp_posts or wp_options, are red flags.

Scheduled tasks and logs. Unknown cron jobs re-infect a cleaned site. Access logs showing POST requests to odd PHP files point to a backdoor in use.

If you find something

Act in this order, because cleaning first and locking doors later usually means being hacked again within days:

  1. Take a full backup of the files and database as they are now. You may need it to understand what happened.
  2. Change every password: hosting panel, FTP/SFTP, database, CMS administrators and the API keys stored in the site. Assume all of them were read.
  3. Remove unknown admin accounts and sign everyone out.
  4. Clean or restore. Restoring a backup from before the infection is the fastest route, if you know when it started. Otherwise replace core files and plugins with fresh copies from the official sources and remove the injected code and files you found.
  5. Close the hole. Update the CMS, every plugin and theme, and the PHP version. Remove plugins you don’t use. Most infections come through an outdated plugin with a public vulnerability.
  6. Ask for a review. In Search Console, use Request review under Security issues once the site is clean. Google usually answers within days; the browser warning disappears after that.
  7. Watch it. Re-scan for a few weeks. Reinfection within a month is common when a backdoor was missed.

If the site handles payments or personal data, a breach may also have legal notification duties. That is a question for a lawyer, not a scanner.

Keeping it from happening again

Most hacks are not targeted. Bots scan the whole internet for one vulnerable plugin version and infect every site that has it. That makes prevention fairly mechanical:

  • Keep the CMS, plugins and themes updated, and delete what you don’t use.
  • Use strong, unique passwords and two-factor sign-in for every administrator.
  • Give each person their own account with the least rights they need.
  • Keep off-site backups that the website itself can’t delete.
  • Load third-party scripts only from sources you trust, and review the list now and then.
  • Monitor the site, so a new blocklist entry or an unknown script is noticed in days, not months. PerfoMetrix monitors re-scan on a schedule and e-mail you when a malware sign or a new third-party script appears.

What an outside scan can and can’t tell you

A passive scan like ours sees what any visitor and search engine sees: the HTML, the scripts it loads, robots.txt, the sitemap, and the blocklists. That catches blocklisted sites, injected scripts, hidden spam links and ClickFix pages. It can’t see server files, the database, backdoors that only answer special requests, or code that hides from our scanner. A clean result means no signs were visible from outside, not that the site is guaranteed clean. Pair it with the server checks above, especially after any warning.

Run a free check now: paste your address into the Website Malware Checker, or run a full scan to see malware signs next to performance, security and SEO.

Tags:malwarehacked websitewebsite securityWordPressblocklistSearch Console