This is a discussion on "Email injection attack - simple protection method?" within the PHP Forum section. This forum, and the thread "Email injection attack - simple protection method? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Email injection attack - simple protection method?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Email injection attack - simple protection method?
I was thinking about simpler ways to help prevent email injection attack that is used on forms that use PHP's mail() function. I thought about a few complex regexp rules, but then decided - what if I just search through all the text in each field and remove any "@" symbols found except for exactly one, which is allowed in the sender field. Then remove any % symbols to prevent new lines.
Is my understanding of the attack too simplistic? It seems like it doesn't matter if they try to inject recipients into the fields because they couldn't put any more than one working address in, and ONLY in the sender field. |
|
|
|
#2
|
|||
|
|||
|
Re: Email injection attack - simple protection method?
I would sanitise the subject and extra header lines with a regular expression to knock out any \r \n and %0A elements in the subject and extra headers. The rules don't need to be complex.
|
![]() |
| Tags |
| mail, php, security |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| XHR attack | abalfazl | JavaScript Forum | 1 | Nov 30th, 2007 16:46 |
| Best contact form spam protection method? | uqwebdesign | Web Page Design | 3 | May 10th, 2007 12:34 |
| Simple email form | Maverick25r | PHP Forum | 1 | Feb 15th, 2007 17:42 |
| Newbie Question- Basic HTML email method="post" | Bagel | Web Page Design | 4 | Aug 18th, 2006 12:03 |
| Processing Form ASP using GET method to Email | rbrown1972 | Classic ASP | 2 | Feb 25th, 2005 05:23 |