On this page
What this issue is
This is an SEO spam hack. An attacker gets into your site through an outdated plugin, a weak password or a stolen login. They then create many new URLs on your domain, often with random product or keyword names. The pages are filled with Japanese text, online pharmacy terms or casino and gambling terms. Their goal is to rank those pages and send visitors to other sites.
Why it costs you leads or sales
Day 0
A vulnerable plugin or stolen login lets the attacker upload files.
Days 1-7
Spam pages and a spam sitemap appear. Your site looks normal to you.
Weeks 2-4
Spam URLs get indexed. Brand searches show strange titles. Organic traffic and trust drop.
Later
Google may flag the site or apply a manual action.
After cleanup
You remove the spam, close the hole and request a review.
Example: a 40-page site before and after a spam injection. Numbers are illustrative.
How to check if your site has it
Search Google for your own domain
Search
site:yourdomain.comand then add words likeviagra,casino,cialisor a Japanese phrase after it. Any result that is not yours is a red flag. Look at the page titles in the results, not only the URLs.Check Google Search Console
Open Security issues and Manual actions. Then open Pages (indexing) and look for a sudden jump in indexed or 'Discovered' URLs. The Performance report may show queries you never targeted.
Fetch pages as Google would
Use the URL Inspection tool and view the crawled page for a suspect URL. Cloaked spam shows here even when your browser shows a normal page.
Test with a search-engine user agent
Run the command below. It requests your homepage as a Google crawler would. Compare it with a normal request. Different content points to cloaking. This is for checking your own site only.
Look at the server files
Check for recently changed files, unknown PHP files in upload or theme folders, an unfamiliar sitemap file, and changes to
.htaccessorindex.php. Also check the database for unknown posts or options.
curl -s https://example.com/ | head -c 2000
curl -s -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://example.com/ | head -c 2000
# Spam only in the second output suggests cloaking.How to fix it
Put the site in maintenance mode if you can
This limits damage while you work. Keep your real contact forms and checkout in mind and re-enable them as soon as the site is clean.
Change every credential
Reset hosting, FTP/SFTP, database, CMS admin and email passwords, and any API keys. Remove admin users you do not recognise. Turn on two-factor login.
Remove injected files and code
Delete spam folders and unknown files. Replace core files with fresh copies from the official source. Check
.htaccess,index.php, themefunctions.phpandwp-config.phpfor added code, often hidden withbase64_decodeoreval.Clean the database
Look for spam posts, unknown options and injected scripts in content fields. Remove them, and delete unknown scheduled tasks.
Update everything and delete what you do not use
Update the CMS, themes and plugins. Delete unused or abandoned plugins and themes, and never use pirated ones. The unpatched component is the usual way in.
Fix your sitemap and robots.txt
Remove any spam sitemap and any rogue lines. Make sure only your real sitemap is submitted in Search Console.
Make spam URLs return 404 or 410
Once the files and rows are gone, the spam URLs should return 404 or 410. Do not redirect them to your homepage.
Request a review if Google flagged the site
If Search Console shows a security issue or manual action, fix it, then use Request review and describe what you cleaned and how you closed the hole.
Reinstall core files
Go to Dashboard > Updates and choose Re-install version, or replace
wp-adminandwp-includeswith fresh copies by SFTP. Checkwp-content/uploadsfor.phpfiles, which should not be there.Check users, plugins and themes
Under Users, delete unknown administrators. Under Plugins and Themes, delete anything unused, and reinstall the rest from fresh downloads.
Scan and harden
Run a malware scanner plugin from a reputable vendor, and change the salts in
wp-config.phpto log everyone out.
Find recently changed files
On the server, run
find . -type f -mtime -14to list files changed in the last 14 days, then review anything you did not change.Search for obfuscated code
Run
grep -rIl "eval(base64_decode" .to find common hiding tricks. Review each match before deleting it.Restore from version control
If your code is in Git, compare the server to the repository and redeploy from a known clean commit.
Check the theme code
Shopify itself is hosted for you, so injected pages are rare. Check Online Store > Themes > Edit code for unknown scripts, and review installed apps and staff accounts.
Remove risky apps and rotate access
Uninstall apps you do not use, reset staff passwords and turn on two-step authentication.
Check custom code
Review Site settings > Custom code and each page's custom code for scripts you did not add. Review who has Editor and Designer access.
Check connected services
Spam pages here are often caused by a compromised connected tool or a hijacked subdomain, so check DNS records for entries you did not create.
Hacked
- site: search shows thousands of unknown URLs
- Titles in Japanese or about pharma and casino
- Spam sitemap submitted or discovered
Cleaned
- Only your real pages are listed
- Spam URLs return 404 or 410 and drop out over time
- Only your own sitemap is submitted
How to confirm it's fixed
- Spam URLs you listed now return 404 or 410
- The crawler user agent test shows the same page as a normal visit
- URL Inspection shows the real page for a few formerly infected URLs
- No unknown files changed since cleanup, and no unknown admin users exist
- Search Console shows no security issue or manual action
- Only your real sitemap is listed in Sitemaps
site:yourdomain.complus spam words returns fewer spam results week by week
How to prevent it happening again
- Turn on automatic updates for the CMS, plugins and themes where safe
- Delete plugins and themes you do not use
- Use unique strong passwords and two-factor login for every admin
- Give people the lowest access level they need
- Keep off-site backups and test a restore
- Add Google Search Console for every version of your domain and read its emails
- Set a monthly reminder to run a site: search for spam words
How FunnelGuard handles this
Questions people ask
What is the Japanese keyword hack?
It is an SEO spam attack where hackers create many pages on your domain filled with Japanese text, usually selling counterfeit goods. The pages are made to rank in Google under your site's reputation. You often cannot see them by browsing, because they may be cloaked.
How do I know if my site has pharma or casino spam pages?
Search Google for site:yourdomain.com viagra and site:yourdomain.com casino. Also check Search Console for security issues and sudden jumps in indexed pages. Unknown URLs or strange titles in the results are strong signs.
Why does my site look normal but Google shows spam?
The spam is probably cloaked, which means it is only shown to search crawlers or visitors from search results. Use the URL Inspection tool in Search Console, or request the page with a crawler user agent, to see what Google sees.
How do I remove Japanese spam pages from Google?
First delete the injected files and database rows and close the security hole, so the spam URLs return 404 or 410. Then submit only your real sitemap, use the Removals tool for urgent URLs and request a review if Search Console shows a security issue. Remaining URLs drop out as Google recrawls.
How did hackers get spam onto my website?
Most often through an outdated or vulnerable plugin, theme or CMS, or through weak or stolen passwords. Sometimes it is a compromised hosting account. Cleaning the pages without fixing the entry point lets the spam return.
Should I redirect the spam URLs to my homepage?
No. Let them return 404 or 410 so Google learns they are gone. Redirecting them to the homepage can look like a soft 404 and may keep the junk URLs in the index longer.
Does FunnelGuard detect spam pages injected into my site?
No. FunnelGuard does not check for this yet, though it is a possible future check. It monitors your funnel journeys, tracking and lead delivery, so you should use Search Console and a security scanner for spam pages.
Related issues
- OPS-143Hidden spam links in footerFix guide
- OPS-149Backdoor files (web shells) on serverFix guide
- OPS-148Rogue admin user createdFix guide
- OPS-150Search Console security issues / manual actionsFix guide
- OPS-154SEO spam in title/meta for Google only (cloaking)Fix guide
- OPS-138Google Safe Browsing 'Deceptive site' warningFix guide