Security · Guide
How to Fix the Japanese Keyword Hack in WordPress
Short answer
The Japanese keyword hack adds auto-generated Japanese pages to your site that sell fake brand goods through affiliate links, and Google shows them under your domain. To fix it, contain the attack, remove the spam generator, rewrite rules and backdoors, and replace changed core, plugin and theme files. Then make every spam URL return 404 or 410, clean up Search Console, and request a review once the site is fully clean.
Key takeaways
- Japanese titles in Google for pages you never wrote are the clearest sign of the Japanese keyword hack.
- Cloaking hides the spam from you: your browser shows a normal page or a 404 while Googlebot sees spam.
- Attackers often add themselves as Search Console owners so they can submit spam sitemaps.
- Spam URLs must return 404 or 410; redirects to the homepage and robots.txt blocks do not remove them.
- A Search Console review can take several days or weeks, and spam URLs fade only as Google recrawls them.
- Deleting spam pages without removing the generator and backdoors lets the hack return within days.
What is the Japanese keyword hack?
The Japanese keyword hack is an attack that adds auto-generated Japanese text pages to your site to sell fake brand goods through affiliate links.
Google describes it as a type of hack that creates autogenerated Japanese text on a site, with pages in random folders such as ltjmnjp/341.html, and the official guide to the Japanese keyword hack explains the pattern and the fix.
Cloaking is the practice of showing one version of a page to search engines and a different version to visitors. Your browser may show a normal page or a 404, while Googlebot receives the Japanese spam page.
The attacker borrows your domain's reputation in Google, so the spam pages can rank for Japanese product searches. A related attack, the pharma hack, fills pages with drug terms instead of Japanese product text, and its cleanup looks in different places.
How do you know your site has the Japanese keyword hack?
Search Google for site:yourdomain.com and look for Japanese titles or pages you never created.
Check these signs, and treat even one as a reason to dig deeper:
- Japanese titles or descriptions in a
site:search for your domain. - A sharp jump in indexed pages in the Search Console Pages report.
- Japanese search queries in the Performance report that you never targeted.
- A “Hacked: URL injection” entry in the Security issues report.
- An owner in Search Console that you do not recognize.
- A spam result that opens your normal page or a 404 when you click it.
Google defines hacked content as any content placed on a site without permission because of security flaws, and it lists “Hacked: URL injection” for new pages a hacker created. Read the Security issues report help to match each label to its fix.
A remote scan adds one more check. Sucuri SiteCheck is a free scanner that checks public pages for known malware, blocklist status, and outdated software, but Sucuri notes that it only sees what is visible at browser level and that results are not guaranteed.
If Google already shows a warning for your site, read how to check if your WordPress site has a Google penalty to tell a hacked-content flag from other penalties.
What do you need before you start cleaning?
You need Search Console access, hosting file access, a full backup, and a way to edit files before you clean anything.
Gather these items first:
- Owner access to Google Search Console for the domain.
- Hosting panel, SFTP, or SSH access to the site files.
- WordPress admin access with an administrator account.
- A full backup of files and the database, stored away from the server.
- A text editor and a way to compare files with fresh copies.
Make the backup before you delete or change anything, and keep it apart from the live site. Follow how to back up WordPress if you have no recent backup, and remember that the backup holds infected files, so never restore it over a clean site.
Plan for a few hours of file work, then weeks of waiting while Google recrawls. The cleanup itself is manual, and rushing it is how backdoors get missed.
How do you contain the hack first?
Contain the hack before you delete anything, so the attacker cannot keep adding pages while you clean.
- Change every password: WordPress admin accounts, hosting, SFTP, and the database.
- Open Search Console, go to “Settings → Users and permissions”, and remove any owner or user you do not recognize.
- Delete the removed owner's verification token, usually an HTML file in the web root with a name like
google1234567890abcdef.html. - Replace the 8 secret keys and salts in
wp-config.phpwith fresh values from the WordPress.org salt generator. - Delete admin accounts you did not create in “Users → All Users”.
Google's guide notes that the hacker will typically add themselves as a property owner in Search Console. If you skip the token file in step 3, a removed owner can verify ownership again.
The token can also hide as a rewrite rule in .htaccess that mimics an HTML file, so check there if no token file exists.
WordPress notes that changing the keys and salts invalidates all existing cookies, so every user must log in again. That step ends sessions held by the attacker, and it takes only a few minutes.
How do you find where the spam code hides?
Look in .htaccess files, wp-config.php, core files, theme files, uploads folders, and rogue sitemaps.
| Hiding place | Sign of the hack | What to do |
|---|---|---|
| .htaccess files | Rewrite rules that send unknown URLs to a PHP file | Remove the rules, then rebuild the file |
| wp-config.php | Added include or eval lines | Remove the lines and compare with a clean copy |
| index.php, wp-load.php, 404.php | Injected code blocks you did not write | Replace the file with a fresh copy |
| wp-content/uploads | PHP files in a folder that should hold media only | Delete files you did not upload |
| Rogue sitemaps | Sitemaps in Search Console that you never submitted | Delete the sitemap file and its Search Console entry |
| Admin users | Accounts with names you do not recognize | Delete the accounts and reset passwords |
Google's guide says attackers commonly inject scripts into files such as index.php, wp-load.php, 404.php, and view.php. Obfuscated blocks often use functions such as base64 decode, rot13, eval, strrev, and gzinflate, so search file contents for those strings.
Check file dates as well as file names. Files changed on a date when you published nothing, or folders with random short names, deserve a closer look before you trust them.
A server-side scan helps with the file hunt. Wordfence's guide to cleaning a hacked site walks through scanning, and its scanner checks core files, themes, and plugins for malware, bad URLs, backdoors, SEO spam, redirects, and code injections by comparing them with the WordPress.org repository.
How do you remove the spam pages and the backdoor?
Remove the generator file, the rewrite rules, and every backdoor, then replace changed core, plugin, and theme files with fresh copies.
- Delete the spam generator file and every PHP file you did not install.
- Clean every .htaccess file on the account, not just the one in the web root.
- Reinstall WordPress core from “Dashboard → Updates” with the “Re-install Now” button.
- Reinstall each plugin and theme from WordPress.org or the vendor's own site.
- Delete unknown admin users and remove spam posts or pages from the database.
- Search the
wp_optionsandwp_poststables for Japanese text or links you did not add. - Run a second full scan and confirm no changed core files remain.
Download fresh copies only from WordPress.org or the vendor, never from a free download site. Nulled plugins are not safe, and a pirated copy can carry the same backdoor you just removed.
Deleting the visible spam pages alone changes nothing while the generator still runs. The rule that routes unknown URLs to the generator will build new pages on demand, so the generator and its rewrite rules must go in the same pass.
How do you make spam URLs return 404 or 410?
Make every spam URL return a 404 or 410 status, and never redirect spam URLs to your homepage.
| Action | What Google sees | Use it? |
|---|---|---|
| 404 Not Found | The page is gone | Yes |
| 410 Gone | The page is gone for good | Yes, best for spam folders |
| Redirect to the homepage | A live page at a spam URL | No |
| Block in robots.txt | A blocked URL that may stay listed | No |
Google's guide to HTTP status codes says indexed URLs that return a 4xx status are removed from the index. A 410 is the clearer choice for a whole spam folder, since it states the pages are gone for good rather than missing for now.
You can return 410 for a full spam folder with one rule in .htaccess:
RewriteRule ^spam-folder/ - [G,L]
Replace spam-folder with the real folder name from your spam URLs, and test one URL after saving. The rule must sit in the .htaccess file that serves those URLs, and a typo here can break real pages, so test before you move on.
How do you clean up Google Search Console?
Delete spam sitemaps, hide the worst spam URLs with Removals, and ask Google to recrawl your real pages.
- Open the Sitemaps report and remove every sitemap you did not submit.
- Open “Removals” under Indexing and hide the worst spam URLs or a whole spam prefix.
- Use URL Inspection on your real pages and select “Request indexing” for cleaned pages only.
- Watch the Pages report over the next weeks for the indexed count to fall.
A temporary removal lasts about 6 months, or 180 days, and the request usually takes up to a day to process. Google's Removals help page states that blocking a URL does not stop Google from crawling it, so the 404 or 410 underneath still does the lasting work.
Do not use robots.txt to block spam URLs, since Google warns against using it as a blocking mechanism. Also do not request indexing for spam URLs, since that only asks Google to look at pages you want gone.
Once the spam is out of the way, get your real pages indexed faster so the clean versions return to results.
How do you request a review, and how long does recovery take?
Request a review only after every listed issue is fixed on every page, then wait while Google rechecks the site.
Open the Security issues report, confirm each listed problem is fixed, and select “Request Review”. A good request explains the exact issue, describes the steps you took, and documents the outcome of your efforts.
Most reconsideration reviews take several days or weeks, and spam-hack reviews sit at the slow end of that range. Do not send a second request while one is pending, since Google warns that an early request can slow the next review or mark the site as a repeat offender.
Fixing only some pages earns no partial return to search results, so check every sample URL Google lists. Spam URLs drop out only as Google recrawls each one, so expect a gradual fall over weeks rather than a clean cut on one day.
If traffic stays low after the warning clears, keep checking the Performance report for Japanese queries. A flat line there, plus a falling indexed count, is the sign the cleanup held.
How do you stop the hack from coming back?
Update everything, tighten file access, and watch Search Console so a return is caught early.
- Update WordPress core, plugins, and themes, and turn on auto-updates where you can.
- Delete plugins and themes you do not use instead of leaving them deactivated.
- Set directories to 755, files to 644, and
wp-config.phpto 400 or 440. - Add
define( 'DISALLOW_FILE_EDIT', true );towp-config.phpto turn off the dashboard file editor. - Use two-factor login for every administrator account.
- Install plugins and themes only from WordPress.org or the vendor's own site.
WordPress has offered automatic updates since version 3.7, and its Hardening WordPress guide states that older versions do not receive security updates. The same guide gives the 755, 644, and 400 or 440 file settings and the file-editor setting above.
A firewall adds a further layer in front of the site. If you use Wordfence, follow how to set up the Wordfence firewall after the cleanup, and keep its scan schedule running.
What mistakes should you avoid?
Do not clean Google first, delete only visible pages, or request a review before the site is fully clean.
- Cleaning Google before cleaning the site, since the generator will rebuild the spam.
- Deleting spam pages but leaving the generator file and its rewrite rules.
- Redirecting spam URLs to the homepage instead of returning 404 or 410.
- Blocking spam URLs in robots.txt instead of removing them.
- Requesting a review before every listed issue is fixed on every page.
- Restoring an infected backup over a clean site.
- Trusting a clean-looking homepage, since cloaking hides the spam from your browser.
Each of these mistakes restarts the clock on recovery. Work through the sections in order, and confirm each step with a live check before you move to the next one.
Frequently asked questions
Can I just delete the Japanese pages from Google Search Console?
No. The Removals tool only hides a URL from results for about 6 months, and it does not delete the page or stop the attack. If the spam generator is still on your server, it will build new pages. Clean the files and backdoors first, make spam URLs return 404 or 410, and use Removals only to hide the worst URLs while Google recrawls.
Why does my site look normal when the hack is active?
The hack uses cloaking, so it shows one version of a page to search engines and a different version to visitors. Your browser may show a normal page or a 404, while Googlebot receives the Japanese spam page. Use Search Console URL Inspection with Test live URL to see the HTML Google actually receives, instead of trusting what your own browser shows.
How long until the Japanese pages disappear from Google?
Expect weeks, not days. Spam URLs drop out only as Google recrawls each one, and a Security issues review can take several days or weeks. The indexed count should fall gradually, and Japanese queries in the Performance report should fade. If the count rises again, the generator or a backdoor is still on the server.
Do I need to reinstall WordPress to fix the hack?
You need to replace every file the attacker changed, which usually means reinstalling WordPress core, plugins, and themes from official sources. Use Dashboard, then Updates, then Re-install Now for core, and fresh copies from WordPress.org or the vendor for plugins and themes. Do not patch infected files by hand when a clean copy is available.
Will a security plugin scan find the Japanese keyword hack?
A server-side scan helps, because it reads the files on your hosting account and compares core, plugin, and theme files with official copies. A remote scan can miss cloaked spam, since it only sees what a visitor's browser sees. Combine a server-side scan with a site search, the Security issues report, and a manual check of .htaccess and wp-config.php.
Is the Japanese keyword hack the same as the pharma hack?
No. Both are SEO spam attacks that borrow a domain's reputation, but the Japanese keyword hack builds auto-generated Japanese product pages that sell fake brand goods, while the pharma hack fills pages with drug terms and links. The signs differ, the spam hides in different places, and the cleanup steps differ, so confirm which one you have before you start.
Sources
- Fix the Japanese keyword hack web.dev (Google)
- How to Find & Fix the Japanese Keyword Hack Sucuri
- Security issues report Google Search Console Help
- Removals and SafeSearch reports tool Google Search Console Help
- Hardening WordPress WordPress Developer Resources
- How to Clean a Hacked WordPress Site Using Wordfence Wordfence
- Sucuri SiteCheck Sucuri
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
