DOS in stream filters
A PHP stream filter using iconv with the IGNORE flag can enter an endless loop when reading from a memory stream. An attacker could exhaust CPU or available PHP processes by triggering this filter.
- Disclosed after 19 months
see bug report https://bugs.php.net/bug.php?id=76249
as simple as
<?php $fh = fopen('php://memory', 'rw'); fwrite($fh, "abc"); rewind($fh); stream_filter_append($fh, 'convert.iconv.iso-10646/utf8//IGNORE', STREAM_FILTER_READ, []); echo stream_get_contents($fh); => one process running in an endless loop ## Impact DOS, process ends up in an endless loop, CPU (or available php processes or both) of affected system get easily exhaustedNot written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the iconv stream filter with the IGNORE flag fails to handle certain input correctly, causing an infinite loop.
Impact
The process enters an endless loop, easily exhausting CPU or available PHP processes.
What the attacker needed
Ability to run PHP code with stream filters
How it was found
- Open a memory stream for reading and writing.
- Write some data to the stream.
- Rewind the stream to the beginning.
- Append the iconv filter with the IGNORE flag for reading.
- Read the stream contents, which causes an endless loop.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A stream filter is a way to transform data as it is read or written in PHP. Here, a specific filter setting causes the program to loop forever instead of finishing, which can tie up the server.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.