How to Tell If Your Website Has Been Hacked

The Venbit TeamUpdated November 8, 20269 min read

The short answer

A hacked website shows up as a Google warning, a red browser screen, redirects to spam, pages in your search results you never wrote, unknown admin users, or spam sent from your server. Many hacks hide from the owner, so check Search Console and run a site: search. Contain first, clean second, ask Google for a review last.

What to know

  • Search Console's Security Issues report files hacked sites under three headings: hacked content, malware and unwanted software, and social engineering.
  • A hack can show different content to you and to Google, and some redirects fire only on phones or only for visitors who arrive from Google.
  • Take the site offline from outside the infected server before you clean anything, and change passwords from a computer you have scanned.
  • A review requested before the cleanup is finished prolongs the warning. Spam reviews take up to several weeks, malware reviews a few days, phishing reviews about a day.
  • A blocklist listing clears only after the source of the spam is gone. Spamhaus never charges for removal.

Something about your site looks wrong: a warning under your listing in Google, a customer who clicked your link and landed on a pharmacy ad, a Japanese page you never wrote sitting in your search results. To tell whether it has been hacked, pick the sign you saw in the finder below. It says what that sign means and what to do in the first hour. If you would rather talk it through with a person, call (425) 314-1415.

Find your cause

Has your site been hacked?

Choose what you noticed. Each answer ends in what it means and the first steps to take. Your answers stay in your browser.

What did you notice?

Pick the one that worried you first. You can run the finder again for the others.

Work through it

The first hour after a hack

Do these in order. Ticks stay in this browser.

0 of 12 done

Contain it
Keep the evidence
Find it and clear it
Get cleared

Signs Google and your browser show you

Search Console's Security Issues report sorts what Google finds into three headings. Hacked content is anything added to your site without your permission because of a security hole. Malware and unwanted software and social engineering, which covers phishing pages, make up the other two. A green check mark at the top means nothing is flagged. A flagged site shows a count, sample URLs and the date Google first detected the problem, and the same report is where you request a review after the cleanup.

Verified owners in Search Console should also get an email when Google suspects a hack. If you never verified the site, nobody received it, so verify it today. You need it for the review request anyway. The warning itself comes in two shapes. "This site may be hacked" under a search listing marks hacked content. The full-screen block appears before the page loads: "Deceptive site ahead" for social engineering, and a separate screen for malware. Our walkthroughs for the search label and the red screen cover each cleanup in detail.

Signs you cannot see yourself

A hack is built to dodge the one person who would notice it. The site shows a different page to different visitors, which Google calls cloaking, so a spam page can look empty to you while a search engine receives spammy words and links. Redirects use the same trick. The malware switches on only for visitors arriving from Google Search, or redirects that fire only on smartphones. Four checks catch what a quick look at your homepage misses.

  • Switch your phone to mobile data, search for your business in Google and tap your own listing. Repeat for the inner pages customers land on as well as the homepage.
  • Type site:yourdomain.com into Google, with your own domain. It lists the pages Google has indexed, including any a hacker added. Look for URLs you did not create and snippets in Japanese or gibberish. If Google shows nothing, try another search engine.
  • In Search Console, paste a suspicious address into the URL Inspection tool to see what Google received. It shows the page your browser may hide.
  • In analytics, watch mobile visitors. Mobile users, and only them, suddenly spending much less time on the site is the pattern Google describes for a mobile redirect.

Google's malware guide has a technical version of the redirect test: fetch the suspect page with cURL or Wget, once plain and once with a Google referrer, and keep infected pages out of your browser. If that is not your world, the person fixing the site can run it.

Signs inside your own accounts

Open your CMS user list. In WordPress that is Users, then All Users, and the Administrator filter. A freshly created administrator and pages you did not add are both on the warning list in Google's hacked-site FAQ. Write down the names and dates before you delete anything, because they show later how the attacker worked.

Search Console keeps a user list of its own, under Settings and then Users and permissions, and hackers add themselves as owners. Google's guide to the Japanese keyword hack says a notice that someone you do not know has verified your site makes a hack a strong possibility. Remove the unknown owner and the verification token they left, which is an HTML file on the server or a rewrite rule in .htaccess.

Changed files are the third place. The same Google guides name the targets: index.php, wp-load.php, 404.php and view.php, and an .htaccess file with rewrite rules you did not write. Look for code built from base64_decode, eval or gzinflate, and give a second look to any file modified around the time the trouble began. A developer can compare your files with fresh copies of WordPress core, your theme and your plugins and show what does not belong.

SignWhere to checkWhat confirms it
Google label or red screenSearch Console, Security IssuesA category and sample URLs
Redirect to spamYour phone on mobile data, tapping your Google listingYou land on a site you never chose
Pages you never wrotesite:yourdomain.com in Google, then URL InspectionUnknown URLs, Japanese or gibberish snippets
Unknown admin userCMS Users list, Search Console Users and permissionsA name and date you did not add
Host suspensionThe host's email and billing or support areaA notice that names malware or spam
Spam sent from your serverHost's outbound mail log, bounce messages, check.spamhaus.orgMail you did not send, or a listing for your domain or IP
Each sign, where to check it and what confirms it

When the server is sending spam

Bounce messages for mail you never sent, a note from your host about outgoing volume and a blocklist entry for your domain all describe one event: something on the server is sending mail. A planted script calling PHP's mail function in a loop does it, and so does a hijacked contact form or a mailbox with a stolen password. WordPress.org's hacked-site guide describes the fallout: sites abused to send spam get their IP addresses flagged by email blocklists, and the flagged IP can be the same server that sends your real email.

Verify at the source

The From line on a spam message proves nothing, since anyone can type yours. The server's own records show where the mail started. Ask your host for the outbound mail log and the mail queue, and look for a spike of messages you did not send. On a cPanel server, mail from a script goes out as the user nobody unless PHP runs under each account's own user, which makes the log harder to trace. cPanel also has an experimental option that records the sending account as actual_sender in Exim's log, /var/log/exim_mainlog.

PHP can name the guilty script itself. Switch on mail.add_x_header, which PHP's manual lists as off by default, and every message carries an X-PHP-Originating-Script header with the script's user ID and filename. The mail.log setting records every mail() call with the script's full path, line number and To address. If you forward a bounce message to whoever is investigating, include the full headers.

Outbound mail limits decide how bad the flood gets

Hosts cap how much mail an account can send. On cPanel the Max hourly emails per domain setting defaults to Unlimited, and cPanel's documentation recommends a value that is not Unlimited. With a limit set, messages over it are queued for the next hour or discarded, depending on a second setting. A separate rule blocks a domain's outgoing mail when the share of failed or deferred messages and their count both pass thresholds. The server log then records a line such as "Domain example.com has exceeded the max defers and failures per hour (7/5 (20%)) allowed" while the message is discarded.

The limit counts every message from the domain, so real quotes and contact-form notifications sent during a flood can be discarded along with the spam. After the cleanup, ask your host what limit applies to your account and whether it can be lowered.

Blocklists and how delisting works

A blocklist is a public list of IP addresses and domains that mail servers check before they accept a message. Look up your domain and your server's IP address at check.spamhaus.org, Spamhaus's IP and Domain Reputation Checker, and it says which list holds you. Three of Spamhaus's lists matter here:

  • The SBL lists IP addresses of spam sources. Removal requests come from the internet provider in charge of the address, which on shared hosting means your host, and Spamhaus always wants to know how the problem was solved.
  • The XBL lists IP addresses with evidence of a compromised machine behind them. Listings expire on their own after a period once the bad behavior is no longer detected, and removal goes through the checker. An IP whose problem has not been corrected is relisted.
  • The DBL lists domains with a poor reputation, subdomains included. Listings expire without intervention once the domain stops matching the criteria. Eligible domains can be submitted through the checker, though Spamhaus says using the form does not guarantee removal.

Delisting is free. Spamhaus states there is never a charge to remove a listing, and that anyone offering to remove one for a fee is running a scam. Once a removal is approved it takes effect right away, though some systems take up to 24 hours to catch up. File the request after the source is gone. A request filed while the script is still running gets you listed again.

If your mail goes to spam and no hack is behind it, why business emails land in spam covers the records.

The cleanup order

Google's recovery guides run in a fixed order, and each step makes the next one safe.

  1. 01Take the site offline. Stop the web server, or have your host point the domain at a static page on another server that returns a 503. A 4xx or 5xx sent by the infected site does not protect visitors, and a robots.txt disallow only blocks crawlers. Google says a temporary outage is unlikely to hurt your future ranking.
  2. 02Tell your host and lock the accounts. Delete accounts you did not create and change the password on everything that touches the site: CMS, FTP, database, hosting panel and email. Do it from a computer you have scanned, since attackers run trojans on administrators' computers that capture FTP and wp-admin logins.
  3. 03Save two copies of the infected site and label them. They are your evidence, and your fallback if the cleanup breaks something.
  4. 04Find the damage and the entry point. Compiling the list of damaged files is one of the longest steps in recovery. Record when the hack began, since that date decides which backups are clean, and check software versions against security advisories. Keep looking after the first find, because Google warns that several independent hacks can be in place at once.
  5. 05Restore or clean. A backup from before the hack, restored and patched at once, beats picking through files by hand. With no clean backup, clean the files on your damage list. A clean install beats an upgrade over the top, since leftover infected files cause reinfection, so reinstall CMS core, plugins and themes from fresh copies and delete plugins you no longer use. WordPress.org advises against the reinstall buttons inside wp-admin, because they overwrite existing files and hacks add new ones. Copy /wp-admin and /wp-includes over by SFTP instead, at the same WordPress version your site runs.
  6. 06Update everything and change the passwords again. Google's recovery guide asks for a final password change after the clean install. In WordPress, new secret keys in wp-config.php sign out anyone still logged in.
  7. 07Request the review. In Search Console, open Security Issues, choose Request a review, and describe what you removed and how you closed the hole. Spam reviews take up to several weeks, malware a few days and phishing about a day. Do not resubmit while one is pending. If Google rejects the request, the report may list more sample URLs, and the warning stays until those are cleaned.
  8. 08Check the blocklists. Look up the domain and the server IP at check.spamhaus.org once the source is gone, and watch Security Issues until the green check mark appears.

What keeps it from happening again

Google's list of how sites get hacked is short: weak or reused passwords, missed security updates, insecure or outdated themes and plugins, phishing, loose security policies and leaked data. The defenses match the list. Use unique, strong passwords and two-step authentication on every login. Apply updates when they ship. Vet third-party plugins and ads, and delete the ones the site no longer uses. Keep automated backups running so a clean copy always exists, and keep the computers you sign in from free of malware, since trojans on those machines capture site logins. Two of our guides go deeper: what happens when plugin updates pile up and how to back up a WordPress site yourself.

When to get help

Call when your host has suspended the account, when a review comes back rejected, when the spam returns after you cleaned it, when no backup predates the hack, or when you cannot find how they got in. Google's hacked-site guide lists hiring a professional as an option beside fixing it yourself, and a cleanup you are not comfortable doing is the time to take it. We are a web studio in Mill Creek, Washington, and emergencies get handled right away. Our maintenance plans include security patches, malware scans and daily off-site backups, which cover the missed-update and no-backup problems above. Call (425) 314-1415.

Think your site was hacked?

Call and we will go through the signs with you and tell you what to do in the first hour.

More website guides

Every question in this series, from Fix website problems.

Symptoms & emergencies17
What happens if...11
Plans & hiring1
Ownership & switching11
Platform-specific3
Seattle & local1

Questions & Answers

  • Open the Security Issues report in Search Console, then search site:yourdomain.com in Google for pages you did not write. Test your site on a phone using mobile data, and read your CMS user list for administrators you did not add. Each of these catches something a quick look at your homepage misses.

  • Yes. Google describes cloaking, where a site shows different content to different types of visitors, so a spam page can look empty in your browser while a search engine receives spammy words and links. The Security Issues report in Search Console and a site: search on your domain show what a browser hides.

  • For Google, open the Security Issues report in Search Console. For mail blocklists, enter your domain and your server's IP address at check.spamhaus.org, which says which Spamhaus list holds you. Removal from Spamhaus is free, and the cause has to be fixed first.

  • Yes. Stop the web server or point the domain at a static page on another server that returns a 503. An error code sent by the infected site does not protect visitors, and a robots.txt disallow only blocks crawlers. Google says a temporary outage is unlikely to hurt your future ranking.

  • After you request a review, Google says spam reviews can take up to several weeks, malware reviews a few days and phishing reviews about a day. If Google finds the site clean, it says browser and search warnings should clear within 72 hours.

  • Yes, if the backup was made before the hack. Record when the suspicious activity began, since that date decides which backups are clean. Restore a clean current backup, then update the site and close the hole. With an older clean backup, restore it, upgrade it and compare it with the infected copy to see what changed.

  • Google lists weak or reused passwords, missed security updates, insecure or outdated themes and plugins, phishing, loose security policies and leaked data. Finding which one applies is the entry-point step of the cleanup, and skipping it leaves the same door open.

Keep reading

Letโ€™s grow your business

Tell us about your business. We would love to hear from you. Or call us at (425) 314-1415.

Join the local businesses that grow with us

  • Pawn Fathers
  • Protectee
  • Pinnacle Energy Services
  • See Clearwater Beach
  • Q Blinds
  • Domaine des Florines
  • Track & Field AI
  • Edgewater Commercial Park
  • Colour Play Salon
  • Houston Hurricane & Security