Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Is there any way to build a script which detects or rates proxies like Maxmind's proxy detection software?

I have already tried to use this code, but it doesn't detect all proxies, in fact it detect quite a low amount of proxies, while Maxmind can detect a lot more.

 if(
        !gethostbyaddr($_SERVER['REMOTE_ADDR'])
        || gethostbyaddr($_SERVER['REMOTE_ADDR']) == "."
        || !$_SERVER['HTTP_ACCEPT_ENCODING']
        || $_SERVER['HTTP_X_FORWARDED_FOR']
        || $_SERVER['HTTP_X_FORWARDED']
        || $_SERVER['HTTP_FORWARDED_FOR']
        || $_SERVER['HTTP_VIA']
        || $_SERVER['HTTP_FORWARDED']
        || $_SERVER['HTTP_CLIENT_IP']
        || $_SERVER['HTTP_FORWARDED_FOR_IP']
        || $_SERVER['VIA']
        || $_SERVER['X_FORWARDED_FOR']
        || $_SERVER['FORWARDED_FOR']
        || $_SERVER['X_FORWARDED FORWARDED']
        || $_SERVER['CLIENT_IP']
        || $_SERVER['FORWARDED_FOR_IP']
        || $_SERVER['HTTP_PROXY_CONNECTION']
        || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
        || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 0)
        || !$_SERVER['HTTP_CONNECTION']
    )
    {
        echo 'proxy';
    }
    else
    {
        echo 'no proxy';
    }

Any solutions?

share|improve this question
    
Based upon a similar response on SE sister sister, the answer is NO . Here is the link. stackoverflow.com/questions/858357/… –  Saladin Mar 19 '13 at 8:20

2 Answers 2

I know this post are old just for someone find this post on google

Check about dnsbl many server are free to use

I use few dnsbl server and many vpn proxy and tor are blocked on my website I recommand to keep for a specific time in a database the user ip so when he continu to visit your website he can load faster. Mine took aroud 5 to 10 second before I do that , Now with the DB every user load faster after the first loading

1- check in your DB if you find the ip. (is inside go step 2 , not go step 4)

2- if is inside ,check the added date if he overpass your time limit , delete the ip and resend a request.(if is in your time limit go step 3 , is overpass go step 4)

3- check in the DB if the ip are blocked (yes stop the script there , no load the page ).

4- ip outdated or no inside the DB send a request to the dnsbl server.

5- check his answer and add the ip in the DB with the current time and if his banned or not

6- load your page like step 3

share|improve this answer

There is no sure way to detect proxy/vpn usage. Aside from what you've done (which won't catch many users tbh), the biggest bang for your buck will be an IP blacklist (which is most likely how maxmind are detecting proxies).

Here are some sites that offer IP blacklisting (I have no experience with any of them):

There are other tricks you can do to attempt to detect web proxies (like google translate, etc), which sometimes add extra headers. The problem is you'd have to add special cases for all of the ones that do (and most don't in any case).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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