Hacked site SEO: finding spam injections and recovering
Hackers often inject spam pages or hidden links without breaking your site. Here is how to spot the damage, clean it up, and ask Google to review.
Most hacked sites still load fine. The owner sees nothing wrong, while thousands of spam pages sit in Google's index under their domain. This is the quiet kind of hack, and it is the one that wrecks rankings for months before anyone notices.
This guide covers how to spot an SEO spam hack, how to clean it up, and how to get Google to review the fix. It also covers what AI engines may do with a compromised site, which is less clear.
What SEO spam hacks look like
Attackers rarely deface a site anymore. They want your site's authority, so they hide inside it. Google's own documentation describes a few common patterns.
- Gibberish or keyword-stuffed pages generated in bulk, often with odd URLs.
- Japanese or other foreign-language product pages that appear in your index, sometimes called the Japanese keyword hack.
- Hidden links or hidden text added to your real pages, usually pointing at casino, pharma, or counterfeit shops.
- Cloaking, where Googlebot is served spam while human visitors see your normal page.
- Malicious redirects that fire only for visitors who arrive from a search result.
The cloaking and referrer tricks exist for one reason: to keep you from seeing the problem. If you only check your site by typing the address into a browser, you will probably miss it.
How to detect it
Check from Google's side, not yours. These are the fastest checks.
- Open the Security issues report and the Manual actions report in Search Console. A hacked content flag shows up here, but not every hack triggers one.
- Search for your domain with the site: operator plus spam words like casino, viagra, or cheap. Unexpected results are a strong signal.
- Look at the Pages report in Search Console for a sudden jump in indexed URLs that you did not publish.
- Run the URL Inspection live test on a suspect URL and compare the rendered page and HTML to what you see in a browser. A difference points to cloaking.
- Check your server logs for requests to URLs you never created, and for new files in your web root.
Also review your Performance report. A spike in impressions for strange queries, with no clicks, often means spam pages are being indexed and shown.
Clean-up steps
Deleting the spam pages is not enough. If the way in stays open, the spam comes back. Work in this order.
- Take a full backup of the infected site first, so you can investigate later.
- Put the site in maintenance mode if visitors are being redirected or served malware.
- Restore from a backup made before the hack, if you have a clean one. Otherwise remove injected files and code by hand.
- Check for new admin users, unknown plugins, changed theme files, and edits to .htaccess or server config.
- Update the CMS, plugins, and themes. An outdated plugin is the usual way in.
- Change every password: hosting, database, FTP, CMS admin, and API keys. Revoke old sessions.
- Review your sitemap and robots.txt. Attackers sometimes add their own sitemap or change crawl rules.
Handling the spam URLs
Once the files are gone, those URLs should return a 404 or 410 status. A 410 tells crawlers the page is gone on purpose. Do not redirect them to your homepage, since that can look like a soft 404. Do not block them in robots.txt either, because Google then cannot recrawl them to see they are gone.
Asking Google to review the fix
If Search Console shows a security issue or a hacked content manual action, you can request a review after cleaning up. Explain what you found and what you changed. Be specific. A vague note gets the same result as no note.
Review times vary, and Google does not promise a schedule. Rankings may not snap back right away even after the flag clears. The spam pages need to drop out of the index, and your site needs to be recrawled. Expect a slow recovery, not an instant one.
What about AI engines?
There is no published guidance on how AI answer engines treat a site that was hacked. Several of them draw on search indexes, so spam in the index could plausibly show up in their results too. That is an inference, not a documented behavior. The safe move is the same: clean up fast, and confirm the fix in the search index.
What to do this week
Run the site: search with spam keywords today. Open the Security issues report. Inspect one live URL in Search Console and compare it to what you see in a browser. Then turn on automatic updates and set up regular backups, so the next hack is a restore, not a rebuild.