|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-01-09 09:59 UTC] yohgaki@php.net
Description: ------------ mb_send_mail() parses additional headers and stores into hash. During the parse process, invalid headers are discarded. However, mail() simply check \0 and strip trailing \r\n. Therefore, mail() is vulnerable to mail header injections via additional header parameter. PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 22:00:02 2025 UTC |
When passing unvalidated and unsanitized input as $additional_headers argument, both functions are vulnerable to email header injection. For instance: // $_POST['from'] == "me@example.com\r\nBcc: her@example.com" $from = $_POST['from']; mb_send_mail( 'you@example.com', 'foo', 'bar', "From: $from" ); It seems to me that this is more of an documentation issue.Now it has issues with: mail('', $subject,'',imap_mail_compose($envelope, $body))); Also this version of code: function validateMail($str){ return str_replace(array('\r\r','\r\0','\r\n\r\n','\n\n','\n\0'),'',$str); } mail('', $subject,'',validateMail(imap_mail_compose($envelope, $body))));