SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I Block Bot With Empty User-Agents

    I got some click-bombing attacks on my site and the bots that made the attacks have this user agent: "-" . I also have heard that empty user agent as well may be a bad boot. But I am not sure will denying access to visitors with empty user agent may as well block some legitimate users.

    So I use this rewrite condition to block both users with blank and "-" user agent:
    Code:
    RewriteCond %{HTTP_USER_AGENT} ^-?$
    RewriteRule ^ - [F]
    Are there normal visitors that have the blank user agent? I guess all bots with "-" are bad.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    stormy,

    The {HTTP_USER_AGENT} is notoriously unreliable but few legitimate users would even think to modify it so, if you're having problems with blank or "-" as a user agent, go ahead and block. However, I'd change your start anchor only to .? (anything) to guarantee a match.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. If i do not modify it, it will only match this user agent "-". If so, this is everything I need.

    I worry because maybe Google image bot and probably few other "good" bots have Blank User {HTTP_USER_AGENT}.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Stormy,

    No, Google is smart enough to call their bot Googlebot which has a lot of hackers using the same moniker to spoof websites.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •