• Resolved wolfccb

    (@wolfccb)


    I am not sure whether it’s a hacker attack or something, but my site get several searches like this everyday:

    Successful searches:

    Query	#	Hits	Clicks
    index/thinktemplatedriverfile/write 	19	1	-
    index/thinkviewdriverphp/display 	6	1	-
    index/thinkrequest/input 	6	1	-

    Unsuccessful searches:

    Query	#
    /index/thinkapp/invokefunction 	66
    /admin/index/dologin 	19
    captcha 	19
    index/thinkapp/invokefunction 	8
    index/thinkcontainer/invokefunction 	8

    Is there a way to add “/” as stopword? I tried to type it in the stopword setting, but it is still possible to search for it.

    Thank you!

    • This topic was modified 2 years, 9 months ago by wolfccb.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes, that’s a very common hacker attack, I see a lot of that on many sites. It doesn’t work, it’s just annoying.

    You can’t use / as a stopword, but you can do this:

    add_filter( 'pre_get_posts', 'rlv_block_search' );
    function rlv_block_search( $query ) {
        if ( ! empty( $query->query_vars['s'] ) ) {
            if ( stripos( $query->query_vars['s'], 'index/' ) !== false ) {
                http_response_code( 410 );
                exit();
            }
         }
    }

    This would make all queries with index/ in them return a “410 Gone” status message. You can also block all queries with just / in them with stripos( $query->query_vars['s'], '/' ), but I can see legitimate users use a slash in their searches sometimes, so this kind of block is probably too dramatic.

    Thread Starter wolfccb

    (@wolfccb)

    Thank you Mikko. I prefer not to modify the code, just afraid of break something…

    Is it possible to add an option for this attack? Thanks.

    Plugin Author Mikko Saari

    (@msaari)

    Relevanssi Premium has a spam blocking feature where you can enter keywords. I have the /think keyword blocked on one of my sites to stop this exact problem. That’s the easy way, but it’s a premium feature.

    Thread Starter wolfccb

    (@wolfccb)

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is it possible to add “/” as a stopword?’ is closed to new replies.