Bug #54350 [Com]: Memory corruption with user_filter

From: Date: Wed, 06 Oct 2021 18:49:33 +0000
Subject: Bug #54350 [Com]: Memory corruption with user_filter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237066@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54350&edit=1 ID: 54350 Comment by: bodik at cesnet dot cz Reported by: decoder-php at own-hero dot net Summary: Memory corruption with user_filter Status: Verified Type: Bug Package: Reproducible crash Operating System: Linux x86-64 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: FYI likely a public PoC for the bug is here https://github.com/mm0r1/exploits/blob/master/php-filter-bypass/exploit.php Previous Comments: ------------------------------------------------------------------------ [2021-01-08 16:36:43] cmb@php.net A respective comment in the sources[1] clarifies: | filter resources are cleaned up by the stream destructor, | keeping a reference to the stream resource here would prevent | it from being destroyed properly So we need to convert stream resources to objects, where we can introduce a cycle, which will eventually be resolved by the garbage collector. [1] <https://github.com/php/php-src/blob/php-8.0.1/ext/standard/user_filters.c#L234-L236> ------------------------------------------------------------------------ [2013-06-05 12:00:25] arjen at react dot com Also broken in 5.4.15: https://gist.github.com/anonymous/5713377 ------------------------------------------------------------------------ [2011-12-27 09:59:27] stas@php.net Oops, wrong bug, sorry. ------------------------------------------------------------------------ [2011-12-27 09:58:54] stas@php.net Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. ------------------------------------------------------------------------ [2011-04-02 03:04:30] cataphract@php.net Unfortunately this bug is just the tip of the iceberg. Resource management in the user filters has several problem. The oncreate and onclose methods also have problems and stack overflows can be caused by stream_filter_remove. It's also possible that unsetting special properties such as .filter and .stream can cause problems. I also don't see how these problems can be reliably fixed without modifying structures so this is going to be tough for PHP 5.3. ------------------------------------------------------------------------ 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=54350 -- Edit this bug report at https://bugs.php.net/bug.php?id=54350&edit=1

« previous php.bugs (#237066) next »