Forum Moderators: phranque

Message Too Old, No Replies

Block Users / IP Addresses

         

soquinn

5:25 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



Wondering if there is a way to collect and band users from your website by IP address? I have a problem with Nigerian counterfeit check scammers using our classified ad sites to solicit money from unsuspecting customers. Can the IP be collected in a form when they reply to the ad and then banned somehow? Has anyone else’s site been hit by these attacks?

Thanks in advance.

bakedjake

6:01 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Can the IP be collected in a form when they reply to the ad and then banned somehow?

Sure. The exact method would depend on your environment, but the process would go something like this:

1. Read REMOTE_ADDR, store it in a seperate field in the row containing the rest of the form variables
2. Build an administration that reads those REMOTE_ADDR correlating it to their related entries (do it with an entry ID)
3. Have someone manually scan entry IDs, then go in and disable the entries
4. Program your form to ensure that IP addresses on the banned list can't post. You could even use that banned list to prohibit them from accessing the site.

soquinn

6:26 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



Thanks bakedjake.

I'm not that technical so bare with me…the application is written in perl and the form source looks like:

<form method="POST" action="$script_name">
<input type="hidden" name="request" value="submit_reply">
<input type="hidden" name="session" value="$session">
<input type="hidden" name="website" value="$as{'website'}">
<input type="hidden" name="ad_id" value="$as{'ad_id'}">
<input type="hidden" name="x" value="$as{'x'}">
<input type="hidden" name="headline" value="$user_ad_fields[2]">
<input type="hidden" name="referrer" value="$ENV{'HTTP_REFERER'}">

plus the others like name, email...etc.

Where would REMOTE_ADDR go? If I can get the IP to display in the email reply I can manually add it to a list to block – which leads me to where & how does the list get referenced?

Thanks

bakedjake

6:35 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Where would REMOTE_ADDR go?

Again, I'm not sure what parameters your script takes. If it just cycles through the variables you feed it, and spits them out to an email, you could use:


<input type="hidden" name="IP" value="$ENV{'REMOTE_ADDR'}">

If I can get the IP to display in the email reply I can manually add it to a list to block – which leads me to where & how does the list get referenced?

The script that is used to process the form submission would have to do the check. You'd need to update the script that you are using. It wouldn't be hard; just a simple "if this IP address in on this list, then disallow use of the post feature".

soquinn

7:01 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



bakedjake, that worked great to get the IP displayed in the email... can you show me an example of the code to use to call the list of IPs… javascript? I know some IPs are ranges and it might block/disable many users not just a single scammer… is that true?

Thanks.

wkitty42

9:43 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



yes, that is true but the real question is do you get any real users from those ip ranges? if not, then block them all and be done with it...

sometimes we have to stop and look at the larger picture...

bakedjake

11:28 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



can you show me an example of the code to use to call the list of IPs… javascript?

Well, I wouldn't do it in JavaScript. I would do it in:

a) The form script (perl) that you use. That would have the added advantage of letting users view the site, but not use the form. When the form finds a bad IP address, it wouldn't post the entry, but you could have it email to you the entries that they submitted, and submit them manually if it is a valid user.

b) Do it in .htaccess (or similar for your webserver). This would just outright block all users.

Without seeing the script that your form users, it would be hard to write proper code that you could simply cut and paste and have work.

I know some IPs are ranges and it might block/disable many users not just a single scammer… is that true?

Sure, especially if they're dynamic IPs. More so if they're using a big ISP (such as Earthlink or AOL) that has a mega-proxy. So option A I presented above would probably be more desirable to you.

yes, that is true but the real question is do you get any real users from those ip ranges? if not, then block them all and be done with it...

You'll never know if you outright block them without proper research. That helps further the argument for option A. If you repeatedly see an offending IP, just filter it in your mail client to a BAD folder. Then review once a month or so.

sometimes we have to stop and look at the larger picture...

True, but while looking at the bigger picture is important, but it's just as important not to kill a fly with a nuclear bomb.

wkitty42

12:18 am on Aug 13, 2003 (gmt 0)

10+ Year Member



sometimes we have to stop and look at the larger picture...

True, but while looking at the bigger picture is important, but it's just as important not to kill a fly with a nuclear bomb.


hehehe... true... and only one would know where their target audience visits from... that's mainly what i was aiming at... if one doesn't desire to cater to folk in nigeria then simply blocking the entire range that services that area would be more efficient, take less work, and not need much, if any, follow up...

besides, nuking flys is such fun! i especially love the way the bits glow in the dark :):o:)

soquinn

1:14 am on Aug 13, 2003 (gmt 0)

10+ Year Member



Thanks for the suggestions… looking at your A option bakedjake, I think I would like to block from perl but not have to manually pass good vs. bad inquires. Is there a way to just add some code that says if a specified “bad IP” submits the form they get an error message or set it so they just can’t access that reply to ad page at all?

I guess there is a way to look up IPs to find out if it is a big ISP (such as Earthlink or AOL) that has a mega-proxy or just a small range in a questionable area?

Thanks.

lorax

1:48 am on Aug 13, 2003 (gmt 0)

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



>> set it so they just can’t access that reply to ad page at all?

Use .htaccess - if they're from a known 'bad' IP then send them to a seperate page that doesn't include the form controls. It they're not on that list - send them to the fully functional form.

soquinn

2:07 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



What’s the best to look up IPs to find out if it is a big ISP (such as Earthlink or AOL) or if they're dynamic IPs or just a single access point that’s causing our problems?

Thanks.

bakedjake

2:11 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is there a way to just add some code that says if a specified “bad IP” submits the form they get an error message or set it so they just can’t access that reply to ad page at all?

Yes, and yes. The answer to your questions are my options A and B respectively, above.

The easiest is just to block (or redirect) the reply to ad page in .htaccess, as lorax suggested (This is option B). The other method is to update your form script to check a list of IPs when accessed to see if the IP is on the bad list (this is option A).

What’s the best to look up IPs

Start at ARIN's lookup - www.arin.net.

If the IP address is delegated in the Americas, ARIN will tell you who it belongs to. If not, ARIN will tell you which registry to go look in to find out who it belongs to.

soquinn

3:13 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



I have this IP for example: 81.23.XXX.XX where is it comming from?

[edited by: DaveAtIFG at 3:27 pm (utc) on Aug. 13, 2003]
[edit reason] "Generalized" the IP [/edit]

bakedjake

3:19 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



81.23.XXX.XX

Try it for yourself, first. :) It's easy!

It is assigned to an ISP in Ireland.

[edited by: DaveAtIFG at 3:28 pm (utc) on Aug. 13, 2003]

soquinn

3:57 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



Sorry for putting the full IP... but I found the same answer in my lookup wanted to be sure Now if I blocked that IP would it stop all users using that ISP? With a quick search on google I found that the Ireland Web-Sat service is independent of telephone lines or any local ISP connection. The system consists of 2 PCI interface cards (which fit inside your PC/Server), 0.84M receive/transmit antenna and CD with installation software. Downlink speed: up to 4Mbit/s.

It appears that Web-Sat is using that IP range for Nigerian connections.

It appears that Web-Sat customers are our problem?

[edited by: soquinn at 6:08 pm (utc) on Aug. 13, 2003]

bakedjake

4:00 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



soquinn, you'll want to kill the references to that company before a mod does, methinks.

From there, the easiest way to deal with abuse is to contact the ISP in question, or simply block the users from your site.

That's an administrative decision you'll have to make. Every webmaster deals with abuse differently.