Forum Moderators: phranque

Message Too Old, No Replies

Unwanted Bittorrent traffic? = Great Firewall of China

         

Solution1

6:01 pm on May 11, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



If you're seeing lots of 404's for urls starting with /announce?info_hash= and Bittorrent useragents on your website with dedicated IP, you're probably a victim of DNS poisoning by the Great Firewall of China.

I'd like to discuss what to do about this.

Since this year, I'm seeing lots of Bittorrent traffic on my biggest website, that shouldn't be there, as my site has nothing to do with Bittorrent. Visitors seem exclusively from China. At first, I saw lots of 404's. After I started filtering out traffic with a HOST header not for my website, I found that all this traffic was not for my site at all. It's mostly subdomains from:

  • tracker.thepiratebay.org - This is the vast majority
  • avast.com
  • cloudfront.net
  • edgecastcdn.net
  • facebook.com
  • deviantart.com
  • flickr.com
  • dropbox.com
  • twitter.com

Some have checked Chinese DNS servers for these domains, and found that they return a different IP address every time. The consensus seems to be, that Chinese DNS servers are manipulated to return random IP addresses, for domains that Chinese censorship wants to block. DNS poisoning in the service of the Great Firewall of China.

You don't want to be at the receiving end of this, as it's a kind of DDoS attack. Very unethical.
So, what to do about it?

What I did, is responding with a HTTP Status 400 to any request that doesn't have a HOST header for my website. It reduces the load for my site, as it doesn't need to waste resources on my user friendly 404 page. 400 Bad Request seems the most appropriate, as this is basically a client side error.

In the main .htaccess file I have:

ErrorDocument 400 /400.shtml

RewriteEngine On
RewriteCond %{HTTP_HOST} !^((www|subdomain)\.)?example\.com [NC]
RewriteRule ^(.*)$ - [L,R=400]


The file 400.shtml contains a short error message.

Any other ideas?

lucy24

10:28 pm on May 11, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Frankly it seems like a lot of extra trouble when an ordinary domain-name-canonicalization redirect would have taken care of the whole thing. It doesn't sound as if they're going to follow up on a 301, so why bother with anything else?

I guess technically you can return any response you like-- my host currently uses a 418 for mod_security for example-- but personally I'd proceed directly to a 403. Or, heck, return a 404 manually. Saves work for the server, and sends back the same information.

Incidentally, you can just say "\bexample\.com" without opening anchor. The \b is to cover the remote possibility that your own domain name is contained within the name of one of the offending domains.

Solution1

5:56 am on May 12, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks for your thoughts about this, lucy24.

Having "\bexample\.com" for a simpler regex seems a good idea. I'm using an entry in my local hosts file with www.notexample.com and my site's IP to test this, so I'm going to need the \b.

Actually, I do think 301's would get followed, as this is traffic from several kinds of clients, not just Bittorrent. I've had Baidu spiders (from Baidu IP addresses) visiting my site using these wrong DNS's.