Critical alert

PHP2Shell: hackers can take over any unpatched PHP site with a single request.

WordPress, WooCommerce, Joomla, Drupal and Magento are all exposed. Emergency PHP upgrade, $195 flat. I’m doing a lot of these right now, but same-day service is still likely.

Japanese Keyword Hack: Remove Japanese Spam From Google

By · Updated · 6 min read

The Japanese keyword hack is an infection where attackers generate thousands of spam pages on your site, written in Japanese and stuffed with links to counterfeit-goods stores, then get those pages indexed by Google under your domain. You usually discover it by searching for your own site and finding results full of Japanese characters for pages you never created. The site itself often looks untouched, because the spam pages are shown to Google and hidden from you.

I've cleaned this exact infection more times than I can count. It has a documented playbook, and once you know the playbook, the weird parts stop being scary. It's also one of the infections where cleanup is only half the job; the other half is getting several thousand junk URLs back out of Google's index.

What the Japanese keyword hack looks like

Search Google for site:yourdomain.com. On an infected site you'll see your normal pages mixed with results like yourdomain.com/wp-oct.php?cat=... or clean-looking directory URLs, with titles and snippets in Japanese, usually advertising brand-name bags, watches, or sneakers at suspicious prices. Click one and you may land on a spam storefront, or get bounced to another domain entirely, or see your own 404 page, because many of these pages only render for Googlebot.

Site owners often find out from a customer, or from a sudden Search Console email about a spike in indexed pages. One client came to me after noticing their little bakery site supposedly had 40,000 pages in Google. They had about 30 real ones.

Check who owns your Search Console. Seriously.

Here's the part almost nobody expects: attackers running this campaign frequently add themselves as verified owners of your property in Google Search Console. They upload a verification file or token during the break-in, and once verified they can submit spam sitemaps, monitor how well their campaign is indexing, even request changes.

Open Search Console, go to Settings, then Users and permissions, and look at every verified owner and user. If there's an account you don't recognize, remove it, and also delete the verification token that let it in, usually a google[random].html file in your web root or a stray meta tag or DNS record. If you skip the token, they just re-verify themselves next week. On several cleanups I've found the attacker's sitemap still listed in Search Console months after the site owner thought everything was fixed, quietly feeding Google fresh spam URLs.

Where the spam actually lives

The machinery is usually a few PHP files the attacker dropped in, plus rewrite rules that route made-up URLs to them. The generator script often sits in the web root or in wp-content/uploads wearing an innocent name, and it builds pages on demand. The content is cloaked: when Googlebot asks, it gets a keyword-stuffed Japanese page; when you ask, it serves a redirect or your normal 404. There's typically a spam sitemap or two as well, sometimes physical XML files, sometimes generated dynamically.

Because of the cloaking, your browser proves very little; the checks in the next section show you what Google received. My free site checker catches some of this from the outside, and my indicators checklist lists the file-level evidence worth collecting before you delete anything.

Finding the generator: signatures, commands, and what a hit looks like

This is the part that separates a cleanup from a guess. Work through it before deleting anything, and keep notes on every file you flag.

1. Compare what Googlebot gets with what you get. From a shell, fetch a spam URL as a normal browser and then as Googlebot:

U="https://example.com/the-spam-url"
curl -s -o /dev/null -w "%{http_code} %{size_download}\n" "$U"
curl -s -o /dev/null -w "%{http_code} %{size_download}\n" -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "$U"
curl -s -A "Googlebot/2.1" "$U" | LC_ALL=C.UTF-8 grep -c -P "[\x{3040}-\x{30FF}\x{4E00}-\x{9FFF}]"

A hit is a 404 or a small redirect for the first request and a 200 with tens of kilobytes of Japanese text for the second. A clean result proves less than it seems: better variants verify the crawler by IP address, so a spoofed user-agent from your laptop gets nothing. In that case use URL Inspection, run Test Live URL, and open View Tested Page to read the HTML Google actually received.

2. Look for PHP that has no business existing. Uploads should hold images and documents, not code:

find wp-content/uploads -name "*.php" -o -name ".htaccess"
grep -rIlE "eval\s*\(\s*(base64_decode|gzinflate|str_rot13)" --include=*.php .
grep -rIlE "HTTP_USER_AGENT.{0,200}(googlebot|bingbot|yahoo)" --include=*.php .
wp core verify-checksums
wp plugin verify-checksums --all

On a clean site the first command prints nothing, or only an .htaccess that a security plugin placed there to block PHP. The checksum commands report File should not exist for stray files in core and plugin folders, and File doesn't verify against checksum for modified ones. Plugins from outside wordpress.org can't be verified this way, so read those by hand.

3. Read the rewrite rules. A stock WordPress .htaccess ends its rewrite block with RewriteRule . /index.php [L]. Any other RewriteRule that sends arbitrary paths to a .php file you don't recognize, or a block sitting outside the # BEGIN WordPress and # END WordPress markers, is the router. Check subfolders too, since this campaign likes to drop a second .htaccess next to the generator.

4. Find the sitemaps and robots lines. Run curl -s https://example.com/robots.txt and read every Sitemap: line. Then request /sitemap.xml and /sitemap_index.xml with the Googlebot user-agent. A sitemap that exists only for crawlers is part of the machine.

5. Measure the damage in Search Console. In Performance, open Search results, add a Query filter set to Custom (regex), and enter [^\x00-\x7F]. Any query containing non-ASCII characters appears, and for an English-language business that list is almost entirely Japanese spam. Switch to the Pages tab to get the exact URL patterns to return as 404 or 410.

What you seeWhat it meansNext move
Spam URL: 404 for you, 200 Japanese for GooglebotUser-agent cloakingStep 2 grep, then step 3
Spam URL returns 200 Japanese to everyoneNo cloaking; the generator is wide openFind the file named in the rewrite rule
Both requests look normal but Google still lists the URLIP-verified cloaking, or a stale index entryURL Inspection, Test Live URL
.php files inside uploadsGenerator or backdoorSave a copy, remove it, then find the entry point
Sitemap you didn't createSpam feedDelete the file or rule, then check Search Console owners

Cleaning it up

The removal work follows the same discipline as any serious infection. Take a full copy of files, database, and logs first. Then find and remove the generator scripts, the rogue rewrite rules in .htaccess, any spam sitemaps, and whatever backdoor the attacker left so they could come back. Compare WordPress core files against fresh copies, since this campaign loves modifying them. Then close the entry point, which in my experience is most often an outdated plugin or theme, and rotate every credential. The full process is the same one I describe in my malware removal walkthrough.

Don't stop at deleting the spam pages themselves. They're output. The generator, the rewrite rules, and the backdoor are the machine, and the machine will happily print another ten thousand pages the night after your cleanup.

Getting thousands of spam URLs out of Google

Once the site is clean, the spam URLs should return 404 or 410 and a fresh, honest sitemap should be submitted. The mechanics, including what the Removals tool really does, are in my guide to removing spam URLs from Google. If Search Console shows a security issue or manual action, fix everything first and then request a review that says plainly what you removed and how you closed the hole.

Expect the index cleanup to take weeks, sometimes a couple of months for very large infections. That's normal and doesn't mean the hack is still active. What would mean trouble is the indexed count creeping up again, so keep an eye on it, and consider some ongoing monitoring during the recovery window.

Does the Japanese keyword hack hurt my rankings?

While it's live, yes. Google is indexing tens of thousands of low-quality pages under your domain, your crawl budget is being spent on spam instead of your real content, and if the campaign trips a manual action for spam or cloaking, your whole site can be demoted or filtered. Some owners also see their legitimate pages drop simply because the site's overall quality signals have been diluted by forty thousand pages of counterfeit handbag text.

The recovery pattern I see is consistent: rankings stabilize soon after the cleanup, then climb back toward normal as the spam URLs fall out of the index over the following weeks. A site that was healthy before the hack nearly always gets back to where it was. What genuinely hurts is letting the infection run for months, or cleaning it badly three times, because each reinfection restarts the clock and erodes Google's trust a little more.

How it got in, and keeping it out

In the cases I've handled, the entry point is boring: a plugin or theme that hadn't been updated in a year, or occasionally a password reused from some other breached account. This campaign is fully automated, and the bots running it scan constantly for known holes. Nobody chose your site. It answered.

So prevention is boring too, and it works: update on a schedule, drop plugins you don't use, use unique passwords with two-factor on your admin accounts, and put the basics from my security best practices guide in place. After this particular hack I also recommend re-checking your Search Console owners list once a month for a while. It takes thirty seconds, and it's the one place this attacker loves to linger.

If you'd rather not fight this alone

This is one of the more tedious infections to clean properly, and the Search Console side trips people up constantly. If you want it handled, my Bulletproof Cleaning is $195 and covers the whole sequence: evidence snapshot, removal of the generator and backdoors, entry-point closure, ownership audit in Search Console, and the deindexing work afterward. Hand it to me and go run your business while the Japanese spam disappears from your results.

Related reading: doorway pages, getting the spam URLs out of Google.

Common questions

What is the Japanese keyword hack?

It is a common infection where attackers generate thousands of Japanese-language spam pages on your site, promoting counterfeit goods, and get them indexed by Google under your domain. The pages are usually cloaked, meaning Google sees the spam but you see a normal site or a 404 page. The point is to steal your domain's reputation to rank their spam.

How do I know if my site has Japanese spam in Google?

Search Google for site:yourdomain.com and scan the results. Infected sites show pages with Japanese titles and snippets you never created, often at strange URLs. A sudden spike in indexed pages reported by Search Console is another giveaway. Because the pages are cloaked, visiting them in your browser often shows nothing unusual.

Why is there a stranger listed as an owner in my Search Console?

Attackers behind the Japanese keyword hack routinely verify themselves as owners of your Search Console property using a token uploaded during the break-in. It lets them submit spam sitemaps and track their campaign. Remove the unknown owner, then find and delete the verification file, meta tag, or DNS record they used, or they will simply re-verify.

How long does it take for Japanese spam pages to leave Google's index?

After a real cleanup, most of the spam URLs drop out over several weeks, and large infections can take a couple of months. You can speed it up by returning 404 or 410 for the spam URLs, submitting a clean sitemap, and using the Removals tool for the worst patterns. A rising indexed-page count after cleanup means the generator is still alive.

Can I just delete the spam pages I find?

No, because the pages are output from a generator script hidden on your server, usually paired with rewrite rules and a backdoor. Delete the visible pages and the machine prints new ones, often the same night. A proper fix removes the generator, the rewrite rules, the spam sitemaps, and the backdoor, then closes the entry point the attacker used.

Prices & services

Everything I do, and what it costs.

Fixed prices where the job is predictable, an honest quote where it is not. Every job is done by me personally, and every one comes with a report.

Fixed prices
Custom work, quoted

Not sure what you need? Run a free site scan or just ask. Free plugins and tools are on the plugins page.