4

how do I stop this?

screenshot

Hundreds upon hundreds of these searches.

7
  • Make sue u have installed latest security patches. Find the cause from log, from where it's generating which page?
    – Jackson
    Aug 23, 2016 at 3:26
  • These are search terms people are using, how can I block these searches, from my research it looks like there trying to compromise my website.
    – SixShields
    Aug 23, 2016 at 3:56
  • Which Magento Version you are using? U have installed latest security patches??
    – Jackson
    Aug 23, 2016 at 4:17
  • Magento version 1.9.1.0
    – SixShields
    Aug 23, 2016 at 4:25
  • 1
    I recommend to check your server logs where these requests are coming from and also set up a firewall/web application firewall. If it's from one or only a few IPs you might set up a manual or automatic firewall rule to block these kind of requests (if they're sent within a short period of time). Aug 23, 2016 at 14:23

1 Answer 1

2

First of all: These were blind attacks that most likely did not have any effect, a successful SQL injection should not be possible with these search queries.

But it's still bad for two reasons:

  1. the sheer number of these requests could take too many resources if they come in short time. As Anna Völk suggested in the comments, check your access logs if they come from certain IP ranges and block these IPs as soon as the requests start coming in.

  2. other users will receive these searches as suggestions because they actually returned results. This is due to Magentos default LIKE search algorithm where you get all results where at least one word matches. Changing this from OR to AND improves the search results and makes searches like these return nothing, so that they won't show up as suggestions anymore.

See also:

Search Type: Like, Full Text or Combined?

Quoting from jharrison.au's answer, change this:

if ($like) {
            $likeCond = '(' . join(' OR ', $like) . ')';
        }

To this:

if ($like) {
            $likeCond = '(' . join(' AND ', $like) . ')';
        }

To get an immediate, massive boost to the relevance of your search results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.