Bug #69791 [NEW]: Disallow mail header injections by extra headers
| From: | yohgaki@php.net | Date: | Wed, 10 Jun 2015 08:42:20 +0000 |
| Subject: | Bug #69791 [NEW]: Disallow mail header injections by extra headers | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-193275@lists.php.net to get a copy of this message | ||
From: yohgaki
Operating system: any
PHP version: master-Git-2015-06-10 (Git)
Package: Mail related
Bug Type: Bug
Bug description:Disallow mail header injections by extra headers
Description:
------------
Current mail() and mb_send_mail() accepts additional headers as single
string. Therefore, these functions are weak to mail header injections.
To avoid injections, mail/mb_send_mail should be able to accept
additional headers as array that contains each element as single header.
RFC 2822 "3.6. Field definitions" restricts certain header only once.
https://tools.ietf.org/html/rfc2822#section-3.6
e.g. to, from, cc, bcc, subject, etc.
Except these headers, mail/mb_send_mail should be able to set a headers
multiple times.
Example additional headers array
$extra_headers = ["Bcc"=>"php@php.net",
"X-Other"=>["One", "Two"]];
Since "To" and "Subject" have dedicated parameters, $extra_headers
should not contain "To" and "Subject".
Related bugs
- https://bugs.php.net/bug.php?id=15841
- https://bugs.php.net/bug.php?id=14799
- https://bugs.php.net/bug.php?id=68776
--
Edit bug report at https://bugs.php.net/bug.php?id=69791&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69791&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69791&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69791&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69791&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69791&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69791&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69791&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69791&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69791&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69791&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69791&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69791&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69791&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69791&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69791&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69791&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69791&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69791&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69791&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69791&r=mysqlcfg