473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

header injection in mail

I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF? It seems to me it easily could and
should, but does it?

Jeff
Sep 1 '08 #1
14 1801
..oO(Jeff)
I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF?
No. mail() is a rather low-level tool. You are responsible for feeding
it correct data.

BTW: CR and LF are not the only things to worry about in the TO: field.
This header also allows multiple comma-separated mail addresses ...
>It seems to me it easily could and
should, but does it?
May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.

Micha
Sep 1 '08 #2
Michael Fesser wrote:
.oO(Jeff)

> I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF?

No. mail() is a rather low-level tool. You are responsible for feeding
it correct data.

BTW: CR and LF are not the only things to worry about in the TO: field.
This header also allows multiple comma-separated mail addresses ...

>It seems to me it easily could and
should, but does it?

May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.

Micha
Are you saying PhpMailer filters out comma separated email addrs,
CRLF's, etc., ... from headers?
--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Sep 1 '08 #3
Michael Fesser wrote:
>.oO(Jeff)

>> I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF?

No. mail() is a rather low-level tool. You are responsible for
feeding it correct data.

BTW: CR and LF are not the only things to worry about in the TO:
field. This header also allows multiple comma-separated mail
addresses ...
>>It seems to me it easily could and
should, but does it?

May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get
easier. Micha

Are you saying PhpMailer filters out comma separated email addrs,
CRLF's, etc., ... from headers?
Well, with hype like :

" strategies to get your emails past spam checkers, and specifications
for popular servers.
... more "

on their opening page, I'd say they should be drilled into the ground
until they meet lava and than another quarter mile just for good
measure. That soured me on them pretty quickly - they're spammer
friendly and the only good spammer is a dead spammer.

Sep 2 '08 #4
Twayne wrote:
>Michael Fesser wrote:
>>.oO(Jeff)

I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF?
No. mail() is a rather low-level tool. You are responsible for
feeding it correct data.

BTW: CR and LF are not the only things to worry about in the TO:
field. This header also allows multiple comma-separated mail
addresses ...

It seems to me it easily could and
should, but does it?
May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get
easier. Micha

Are you saying PhpMailer filters out comma separated email addrs,
CRLF's, etc., ... from headers?

Well, with hype like :

" strategies to get your emails past spam checkers, and specifications
for popular servers.
... more "

on their opening page, I'd say they should be drilled into the ground
until they meet lava and than another quarter mile just for good
measure. That soured me on them pretty quickly - they're spammer
friendly and the only good spammer is a dead spammer.

You misunderstand. ISP mail servers have become more stringent about
requiring certain protocols. Phpmailer is assuring you that it will get
you through all the proper protocols, not that it will perpetrate deception.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Sep 2 '08 #5
..oO(Chuck Anderson)
>Michael Fesser wrote:
>>
May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.

Are you saying PhpMailer filters out comma separated email addrs,
CRLF's, etc., ... from headers?
Headers are secured, but the addresses are still your task. There's no
input validation for them in PHPMailer. The script can't know if you
want to use a single address or multiple ones, so you have to check that
yourself before creating the email.

Micha
Sep 2 '08 #6
Michael Fesser wrote:
May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.
Does it get past Hotmail's spam filtering?

Sep 2 '08 #7
Michael Fesser wrote:
.oO(Jeff)
> I'm writing my php "form mail" script.

Does mail do any checking for header injection in the "to" and
"subject" parameters? CR and/or LF?

No. mail() is a rather low-level tool. You are responsible for feeding
it correct data.

BTW: CR and LF are not the only things to worry about in the TO: field.
This header also allows multiple comma-separated mail addresses ...
>It seems to me it easily could and
should, but does it?

May I suggest PHPMailer?
Yes!
>
http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.
Certainly looks like a snap to send attachments and multipart. Not easy
in perl!

A few questions though.

Do you have to set the mail transport and host?

why this?:

$body = eregi_replace("[\]",'',$body) ; // for html

and for plain text do I just need to set word wrap and do:
$mail_instance->Body = $message;?

Jeff
>
Micha
Sep 2 '08 #8
Jeff wrote:
Michael Fesser wrote:
>.oO(Jeff)
>May I suggest PHPMailer?
>
Do you have to set the mail transport and host?
if you want to send via SMTP, yes. That's not set by default.

or instead of isSMTP(), you can send by calling IsSendmail or IsQmail or even
IsMail
>
why this?:

$body = eregi_replace("[\]",'',$body) ; // for html
good question, why strip backslashes? are they worried about stray \r\n or \n?
and for plain text do I just need to set word wrap and do:
$mail_instance->Body = $message;?
it's just a string, yes. Setting a wordwrap would seem to be up to you.
Sep 2 '08 #9
RJ_32 wrote:
Michael Fesser wrote:
>May I suggest PHPMailer?

http://phpmailer.codeworxtech.com/

This class does all the things you want and need. It's not that
difficult to get used to it and it works just great. Can't get easier.

Does it get past Hotmail's spam filtering?

Like using the mail() command - if you set your headers up correctly, it
does.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 2 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2754
by: Simon | last post by:
Hi, I was looking at mail injection, http://securephp.damonkohler.com/index.php/Email_Injection And I was wondering if my mail(...) was safe. I ask in a form for 1 Name 2 Email address
10
1852
by: xmp333 | last post by:
Hello, A spammer is apparently using email injection on my form, however my I thought email injection requires mainpulation of the headers parameter in mail() and I'm not using that parameter. My mail call looks like: mail($to,$subj,$body) So how is the spammer getting me? Is mail() translating to a raw
8
3861
by: stirrell | last post by:
Hello, One problem that I had been having is stopping email injections on contact forms. I did some research, read up on it and felt like I had created a working solution. I hadn't gotten any suspicious bouncebacks in quite some time and got many custom alerts I had set up for notifying me of injection attempts. However, just the other day, I got a bounceback from an AOL address which leads me to believe that an injection attempt was...
21
4742
by: H9XLrv5oXVNvHiUI | last post by:
Hi, I have a question about injecting friend functions within template classes. My question is specific to gcc (version 3.4.5) used in combination with mingw because this code (or at least code that gets the same result) works as expected in visualc++. I know that this is probably not the right behavior for a compiler but it's the kind of behavior I'm searching for so I was hoping there was a way to do the same thing in gcc. As you know...
4
1682
by: Mufasa | last post by:
I have a website that somebody is trying to hack with SQL Injection. (He was already successful but I have fixed the vulnerability) I have already fixed the website so it's 'safe' from the injection. I even have it redirect to another web site (not mine but an innocuous third party) when it get's things that don't match my criteria. Is there any way to stop/block this yahoo from attempting this? It's getting old. I have the system e-mail...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.