Sign up ×
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.

        || gethostbyaddr($_SERVER['REMOTE_ADDR']) == "."
        || $_SERVER['HTTP_VIA']
        || $_SERVER['HTTP_CLIENT_IP']
        || $_SERVER['VIA']
        || $_SERVER['X_FORWARDED_FOR']
        || $_SERVER['FORWARDED_FOR']
        || $_SERVER['CLIENT_IP']
        || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
        || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 0)
        echo 'proxy';
        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.… – Saladin Mar 19 '13 at 8:20

2 Answers 2

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
There are some new stuff that came out recently for free: [W I T C H] (…) - that's able to run on the server side and detect OpenVPN connections due to their unique MSS values. Combine it with p0f, you're able to pull quite a bit of information. getIPIntel - Uses block lists + machine learning and statistics to detect if an IP is a proxy and/or VPN via a simple API. – S W Aug 14 at 9:50

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

protected by Community Jul 19 at 8:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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