go to bug id or search bugs for
The filtering in header() function is not sufficient and this can lead to header injection and content injection (XSS) when the client is Internet Explorer (in every tested version).
IE accepts %0A%20 or %0D%0A%20 as separator in HTTP while other browser treat the new line beginning with space as the continuation of the previous header. This can lead to header injection or content injection (basically, XSS) in IE:
I'm hosting an instance of the test script here: http://molnar.es/php-header/test.php
<?php header('Content-Type: text/html; charset=' . $_REQUEST['charset']); ?>
This is the content.
Add a Patch
Add a Pull Request
RFC 2616 explicitly allows this as a header, so this seems to be an IE problem. However, RFC 7230 deprecates this functionality, saying:
A sender MUST NOT generate a message that includes
line folding (i.e., that has any field-value that contains a match to
the obs-fold rule) unless the message is intended for packaging
within the message/http media type.
So we may want to drop support for this.
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.
I'm unable to identify the source code commit associated with this fix. Can you help? Also, I don't see this fix in any changelogs at http://php.net/ChangeLog-5.php, although perhaps it's not made it into a formal build yet.
Actually, perhaps this line in the Changelog is the reference.
"Removed support for multi-line headers, as they are deprecated by RFC 7230."