StormHosts Community  

Go Back   StormHosts Community > General > Programming Discussion
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Programming Discussion Need help with some code? Got any code samples you want to share with others? Post it here!

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-28-2008, 04:17 PM   #1
Zoran
Registered User
 
Join Date: Jun 2004
Posts: 76
Zoran is on a distinguished road
Contact/Email Form Exploits (ASP)

I've had some problems with email form exploits in the past. There are basically two things spammers are doing with email forms. Most of us that have been around for a while know about this. For those that don't, here is how it works.

1. The worst one is they use your email form to send out their spam through your email form to others. Gives stormhosts a headache as they don't want to have their server blacklisted.

2. More annoying than anything else, spammers use your email form to send you spam. How desperate can you be to sell viagra??

To take care of #1, just use the function below to validate your all form fields.

Code:
Function ValidForm(strField)	
	If instr(1, lcase(strField), "content-type") > 0 OR inStr(1, strField, "%0a", 1) > 0 OR inStr(1, strField, "%0d", 1) > 0 OR inStr(1, strField, "\n", 1) > 0 OR inStr(1, strField, "\r", 1) > 0 OR inStr(1, lcase(strField), "cc:", 1) > 0 OR inStr(1, lcase(strField), "to:", 1) > 0 Then
		ValidForm = false
	Else
		ValidForm = true
	End If
End Function
If the function returns true, just send your email. If false, exit out to whatever method you prefer.

For #2, I found that checking to see if your email script is being requested from your site, not some other, is enough to stop those annoying spam through your form. Use the following.

Code:
If Instr(1, Request.ServerVariables("HTTP_REFERER"), "yourdomain.com", 1) < 1 Then Response.Redirect("/errorpage.html")
Basically it checks if the email processing script was referred through your website. If not, you send the somewhere else. Personally, I would send them here.
Also, the above will take care of #1 in a lot of cases.

If there are any other ideas to improve or streamline this, I would love to hear it.
Zoran is offline   Reply With Quote
Old 06-04-2008, 04:19 AM   #2
Will
Registered User
 
Join Date: Nov 2003
Location: Bradford, UK
Posts: 283
Will is on a distinguished road
The HTTP referrer idea is good but would prevent anyone with a referrer-less browser from using your form. Some people turn off the referrer header for privacy reasons. spammers are probably also likely not to send the referrer header, or if they're really smart - they'll just set it to the page they're requesting.

Could you give more information on your first function? Is that looking for control characters used by spammers to send multiple emails?
__________________
-----------------------------------------------------------
Docupro - Offering Custom Programming and Websites
Will is offline   Reply With Quote
Old 11-29-2009, 03:22 PM   #3
Mipsuinc
Registered User
 
Join Date: Nov 2009
Location: Finland
Posts: 2
Mipsuinc is on a distinguished road
Send a message via ICQ to Mipsuinc
Contact/Email Form Exploits ASP

Im trying to make an asp page that can edit cascading style sheets. If anyone has any idea on how to do this, or if its even possible, please help.

Thnx.
__________________
Too lazy to set a custom title hedonism jamaica
Mipsuinc is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:40 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Site and Content ©2001 - 2007 StormHosts