Bug #54114 [Nab]: Output Buffer Dumps Data On Error
Edit report at https://bugs.php.net/bug.php?id=54114&edit=1 ID: 54114 User updated by:danhstevens at gmail dot com Reported by:danhstevens at gmail dot com Summary:Output Buffer Dumps Data On Error Status: Not a bug Type: Bug Package:Output Control Operating System: all PHP Version:5.3.5 Block user comment: N Private report: N New Comment: Mike, this is a security issue because users of frameworks like Symfony are highly exposed to this bug. Symfony uses OB for parsing configuration files which often contain sensitive information. One syntax error in your config file and all your config params are on display to the www. It's unexpected behavior, and it can (and in my case, has) caused the release of sensitive information. Previous Comments: [2013-09-30 12:11:25] m...@php.net I'm not sure why this should be security related? Why even output security sensitive information at all? [2011-08-17 13:44:19] nicolas dot grekas+php at gmail dot com Here is an other example that can't be workaround using danhstevens' technique: ---- [2011-03-10 19:41:28] danhstevens at gmail dot com I've found a viable work-around for this bug (although a patch of the core would still be ideal so people don't discover this potential security issue the hard-way). By registering the following shutdown handler before any output buffering the dump of data can be prevented: 1) { //Prevent data in buffer from dumping ob_end_clean(); } } register_shutdown_function('shutdown_fn'); Now when using the examples above that normally cause the buffer to dump to the client the buffer data is disposed of. Of course, this can be extended to use ob_get_contents and redirect the data to file or other means if necessary. This approach is working for me (on PHP 5.3.5). ~Dan [2011-03-06 16:51:52] neweracracker at gmail dot com I've managed to reproduce this in Windows 7 running php 5.2.17 (with php.ini-dist) and php 5.3.5 (with php.ini-development). Here is my test script: I've reported this as bug #54174 which got closed due being a dupe of this one so I am leaving this comment here for reference purposes. Regards, NewEraCracker. -------------------- [2011-02-28 21:40:36] danhstevens at gmail dot com Hi Rasmus, I was still able to create the problem by calling on a non-existing class to create a fatal error. Here is a variation of your code: function eh($errno, $errstr, $errfile, $errline) { $contents = ob_get_contents(); ob_end_clean(); echo "Error: $errno, $errstr, $errfile, $errline\n"; } set_error_handler('eh'); ob_start(); echo 123; nonExistantClass::nonExistantMethod(); echo "After error\n"; Output is: 123 Fatal error: Class 'nonExistantClass' not found in ... Hopefully the above should more accurately illustrate the issue. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54114 -- Edit this bug report at https://bugs.php.net/bug.php?id=54114&edit=1
Bug #54114 [Opn]: Output Buffer Dumps Data On Error
Edit report at http://bugs.php.net/bug.php?id=54114&edit=1 ID: 54114 User updated by:danhstevens at gmail dot com Reported by:danhstevens at gmail dot com Summary:Output Buffer Dumps Data On Error Status: Open Type: Bug Package:Output Control Operating System: all PHP Version:5.3.5 Block user comment: N Private report: N New Comment: I've found a viable work-around for this bug (although a patch of the core would still be ideal so people don't discover this potential security issue the hard-way). By registering the following shutdown handler before any output buffering the dump of data can be prevented: 1) { //Prevent data in buffer from dumping ob_end_clean(); } } register_shutdown_function('shutdown_fn'); Now when using the examples above that normally cause the buffer to dump to the client the buffer data is disposed of. Of course, this can be extended to use ob_get_contents and redirect the data to file or other means if necessary. This approach is working for me (on PHP 5.3.5). ~Dan Previous Comments: [2011-03-06 16:51:52] neweracracker at gmail dot com I've managed to reproduce this in Windows 7 running php 5.2.17 (with php.ini-dist) and php 5.3.5 (with php.ini-development). Here is my test script: I've reported this as bug #54174 which got closed due being a dupe of this one so I am leaving this comment here for reference purposes. Regards, NewEraCracker. ---- [2011-02-28 21:40:36] danhstevens at gmail dot com Hi Rasmus, I was still able to create the problem by calling on a non-existing class to create a fatal error. Here is a variation of your code: function eh($errno, $errstr, $errfile, $errline) { $contents = ob_get_contents(); ob_end_clean(); echo "Error: $errno, $errstr, $errfile, $errline\n"; } set_error_handler('eh'); ob_start(); echo 123; nonExistantClass::nonExistantMethod(); echo "After error\n"; Output is: 123 Fatal error: Class 'nonExistantClass' not found in ... Hopefully the above should more accurately illustrate the issue. [2011-02-28 19:37:32] ras...@php.net I am unable to reproduce this. My test script: Expected result: (no output) Actual result: -- 123 Fatal error: test error in ... -- Edit this bug report at http://bugs.php.net/bug.php?id=54114&edit=1
Bug #54114 [Fbk->Opn]: Output Buffer Dumps Data On Error
Edit report at http://bugs.php.net/bug.php?id=54114&edit=1 ID: 54114 User updated by:danhstevens at gmail dot com Reported by:danhstevens at gmail dot com Summary:Output Buffer Dumps Data On Error -Status: Feedback +Status: Open Type: Bug Package:Output Control Operating System: all PHP Version:5.3.5 Block user comment: N Private report: N New Comment: Hi Rasmus, I was still able to create the problem by calling on a non-existing class to create a fatal error. Here is a variation of your code: function eh($errno, $errstr, $errfile, $errline) { $contents = ob_get_contents(); ob_end_clean(); echo "Error: $errno, $errstr, $errfile, $errline\n"; } set_error_handler('eh'); ob_start(); echo 123; nonExistantClass::nonExistantMethod(); echo "After error\n"; Output is: 123 Fatal error: Class 'nonExistantClass' not found in ... Hopefully the above should more accurately illustrate the issue. Previous Comments: [2011-02-28 19:37:32] ras...@php.net I am unable to reproduce this. My test script: Expected result: (no output) Actual result: -- 123 Fatal error: test error in ... -- Edit this bug report at http://bugs.php.net/bug.php?id=54114&edit=1
[PHP-BUG] Bug #54114 [NEW]: Output Buffer Dumps Data On Error
From: Operating system: all PHP version: 5.3.5 Package: Output Control Bug Type: Bug Bug description:Output Buffer Dumps Data On Error Description: When output buffering is turned on (via ob_start()) and an error is encountered before a call to ob_end_* is called the entire contents of the output buffer is dumped (to STDOUT) and there appears to be no way to prevent the buffer from dumping - not even by setting an error handler, etc. This is a security issue since the output buffer may contain sensitive information that is them dumped over to the user. Using set_error_handler does not stop the dump - it appears the dump simply happens with no way to intercept or prevent it. Test script: --- Expected result: (no output) Actual result: -- 123 Fatal error: test error in ... -- Edit bug report at http://bugs.php.net/bug.php?id=54114&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54114&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54114&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54114&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54114&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54114&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54114&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54114&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54114&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54114&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54114&r=support Expected behavior: http://bugs.php.net/fix.php?id=54114&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54114&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54114&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54114&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54114&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=54114&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54114&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54114&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54114&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54114&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54114&r=mysqlcfg
#42060 [Com]: [PATCH] LDAP: Add pagedResults support and more
ID: 42060 Comment by: danhstevens at gmail dot com Reported By: iarenuno at eteo dot mondragon dot edu Status: Assigned Bug Type: Feature/Change Request Operating System: * PHP Version: 5CVS, 6CVS (2008-11-01) Assigned To: patrickallaert New Comment: Why is this patch still being overlooked? pajoye: You said there would be a patch committed in a few days - that was well over a year ago and as far as I can see nothing has been committed. Can we get this patch pushed through? Is there any good reason this hasn't been implemented yet? PLEASE tell us when to expect this patch, if ever. Previous Comments: [2009-12-17 14:36:28] chris at sogetthis dot com Who is Alexey and where is the updated patch? [2009-09-02 11:34:28] jochen at keutel dot de I still can't see this patch in 5.3.x or HEAD; neither in PHP 6. A lot of people really need this extension; e.g. when talking LDAP to MS Active Directory you *need* the paged results control. Reason: AD returns only 1000 entries without paging. Another scenario often used is password policies; also her you definitely need parsing of extended LDAP responses. Please apply this patch !!! Regards, Jochen. [2009-06-08 11:30:13] dj at krul dot nu pajoye: I can't find the commit you're referring to (either in HEAD or the 5.3 branch). Has it been committed yet? [2009-06-05 15:31:40] paj...@php.net >> get some help :) [2008-11-16 14:57:56] paj...@php.net Alexey has ported the patch to 5.3, it will committed in the next days. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/42060 -- Edit this bug report at http://bugs.php.net/?id=42060&edit=1