> while(1) fopen(rand(), "w");
> 
> After a few seconds depending on system speed system will run out of file 
> pointers. I am sure you can see how that would be BAD.

You are _extremely_ incorrect. The previously mentioned code would open
1 file descriptor repeatedly until the script hit max execution time.

This occurs because the garbage collector closes the unused file
descriptor with every iteration.

You could gain the desired effect of abusing file descriptors by using
the following code

while (1) $vars[]=fopen(rand(), "w");

However, quite frankly, this is a lame attack, because all it will do is
consume file descriptors for only the CHILD process the script is
running in. The script will then hit the fd limit of the child process
(most systems around 255 is the default) This will not hurt the process,
because all needed file descriptors were opened before the script was
executed. The beauty of this is that the kernel will the reject all
future calls beyond the limit, which halts i/o usage, and causes the
process to consume more user time, which cause the process to hit max
execution limit.

The argument you make to remove safe mode because it is not perfect is
unfounded. By the same argument you could say we shouldn't use locks on
our doors, because hey "they can be picked".

-Jason





> Ilia
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to