Magento & WordPress Search Function Hijacking for Link Spam


Over the last couple of days, we noticed a new trend across a couple of sites with clients running WordPress and Magento

Either in the Crawl Stats section of Google Search Console or using a site: command, we’ve seen results like this

I’ve substituted our clients site with a fake site called which doesn’t exist

hacked site results in google

The link then goes to something like this

This command will show you all the pages indexed in the last 7 days. Simply replace with yours

How Are They Doing This

The spammers are taking advantage of two things

  1. A lot of sites don’t disable the search functionality in WordPress or Magento even if they are not using it
  2. Depending on the setup, the search results screen may return the original query entered
    1. This will depend on how customised your WordPress or Magento setup is

You’ll then get a page that looks something like this

hijacked search result

The spammers then create a list of links on their site to your site that look something like

  • (Magento)
  • (WordPress)

We discovered the links via the URL Inspection tool in Google Search Console results froom Google inspection URL

Google and Bing follow these links to the site, crawls them and in some cases have indexed them

Why Are They Doing This?

We are assuming that they are doing to this to piggyback onto Magento and WordPress sites are already indexed in Google or Bing

No doubt they are hoping that Google will then pick up the spam content on the page and the mentions on the page will push it up the ranking

Steps You Can Take

While you can’t stop people from linking to the site, there are three practical steps you can take

1) Add a Disallow in the robots.txt
This will tell the search engines to ignore the search results and probably should be in there anyhow unless you have a very good reason why you want your site search results to be indexed

Adding Disallow: /*/catalogsearch/result/?q= (Magento)
Adding Disallow: /*s= (WordPress)

2) Add a Noindex Tag to the search results page
Adding a the no index meta tag to search results page will send a pretty clear message that you don’t want the page index
<meta name=”robots” content=”noindex”>

3) Use the Google Search Console Removal Tool

Google Search Console allows you to submit a request to remove all results if they follow a pattern.

Google search console removals

When adding a new request, use the remove all URLs with the prefix and then enter the URL for your sites search result page

ThGoogle Search Console removal pattern