Forum Moderators: coopster & phranque

Message Too Old, No Replies

Formmail visitors - questions about denying access

         

palmpal

11:14 am on Aug 30, 2003 (gmt 0)

10+ Year Member



Hello,

I posted a message about problems I'm having with visitors to my formmail.cgi in the Tracking and Logging forum. I'm not clear on a few things and wondered if someone from this forum could read my message there and answer my questions. I have a list of IPs that have visited only my *.cgi files and I'm ready to go through and deny them access if this is the best approach. Can anyone help?

Thanks!

Mark_A

9:39 pm on Aug 30, 2003 (gmt 0)

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



you could link to the other message in here.

one approach is to rename the file instead of formmail.cgi or whatever call it something else ...

Many of the hacker attempts just seem to poll
domain/cgi-bin/
for all sorts of formmail files with different endings.

I would go further than deny .. gather the dodgy IPs together from your access and error logs, (make sure they are the dodgy ones :-) sort them into IP order whois / tracerout and collect their service providers details then send an email with all details to their ISP abuse address and demand those user accounts be terminated.

the advantage of renaming your script something other than formmail is that you know anyone polling your cgi-bin for that is up to no good as none of your forms will be requesting it.

Nearly all ISP have clauses in their TOS which do not permit people to try this .. that file on your site is only intended to be interacted with by your form, anyone trying to get direct access to that script is up to no good for the sake of spamming through your script.

BTW2 there are patched versions of that script requiring permitted email and domains to be input server side .. and I think requiring the request to come from your page .. make sure if you have not already that you have one of those later patched versions.

claus

1:11 am on Aug 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I normally ban the requests and not their IP - if/when they retry then i ban their IPs as well.

To ban the requests, i use lines similar to these in my htaccess:

RewriteCond %{REQUEST_URI} (.?mail.?form¦form¦(GM)?form.?.?mail¦.?mail)(2¦to)?\.?(asp¦cgi¦exe¦php¦pl¦pm)?$ [NC]
RewriteRule .* - [F,L]

The lines tell the User-Agent that what they just tried to do is forbidden - the top line has been split in two. If you want to use it, you have to replace the broken pipe "¦" with one you enter from your keyboard. It should be a solid line, but this forum replaces them in posts.

Otherwise, here's a link for a nice script that you can upload and save as "formmail.cgi" or "formmail.pl" - it catches the mail-exploit hunters and bans them. You'll have to rename your real formmail script to something else first, but that should always be done anyhow:

[webmasterworld.com...]

/claus

palmpal

1:15 am on Aug 31, 2003 (gmt 0)

10+ Year Member



Thank you for responding to my concern. I don't have a form that requires this file (unless it is the Poll script.) I thought I deleted the file but it must be somewhere else. My web host is pretty good about helping me find my way around my file manager screen so I can ask for their help with deleting it. Still, having an online form is something I'd like to do someday so your information is really helpful for my future plans. Also, it sounds like the only way that file would be requested is if I had a form on my website that interacted with it. I guess I can assume that the IPs requesting the file are up to no good.

Thanks again! Off to ban those IPs!

Mark_A

9:18 am on Sep 1, 2003 (gmt 0)

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



The file can be requested if it is or is not there.

The difference is that if it is there then attempts to exploit it may also be made, if it is not there these cannot take effect.

Renaming the script is only a partial defense against people that are using simple automation to poll for it, they usually poll for variants of formmail.* , perhaps formmail.cgi formmail.pl etc

Even if you rename it if you are using it to process form outputs then your forms will have to call the renamed script so spammers who wish to take the time could look at the code of your form and find the renamed script.

This is why if your host has not done some work to patch the script, or if you are not using the latest version which has been improved, you are taking a security risk.

I think its instructive that those that can arrange their own or custom scripts generally prefer to use them. There are so many examples of formmail out there that exploits are quickly picked up.

Before I had a fixed one and went after abusers accounts I did have thousands of exploits in a short period of time to an earlier version. Check your logs its usually quite clear if someone is abusing this script and your hosting provider should be as concerned about it as you should be.

Wizcrafts

2:49 am on Sep 9, 2003 (gmt 0)

10+ Year Member



I have written much about this very subject on my website, on this page: <snip>, especially about using an alternate version to the one by Matt Wright.

Wiz

[edited by: jatar_k at 4:43 am (utc) on Sep. 9, 2003]
[edit reason] no personal urls thanks [/edit]

Mark_A

6:35 am on Sep 9, 2003 (gmt 0)

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



Would you sticky me the url Wizcrafts?