note 53729 deleted from function.shell-exec by betz
| From: | betz@php.net | Date: | Fri, 10 Jun 2005 21:39:12 +0000 |
| Subject: | note 53729 deleted from function.shell-exec by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90243@lists.php.net to get a copy of this message | ||
Note Submitter: bens at effortlessis dot com
----
THE FUNCTION POSTED BY "Jan dot besssai at gmx dot de" IS INCREDIBLY UNSAFE AND SHOULD
NEVER BE USED... HIS POST STARTS WITH "Here is a safe way to create .htpasswd files for
.htaccess"...
Try this: execute the script with an url something like:
http://hostname/scriptname.php?name=a%20b%3Brm%20-rf%20%2f
and you've just deleted EVERY !@!@ FILE writable by whatever user that executes the script -
typically the webserver! (I did not test the script, but it wouldn't be hard to make it work)
Since $nam is treated as a literal, unchecked string and is passed directly to a shell command, YOU
WOULD END UP EXECUTINIG A COMMAND LIKE:
htpasswd -n -b -m a b; rm -rf /
THIS IS TERRIBLE! Always always ALWAYS CHECK YOUR INPUT and use escapeshellarg() for good measure!
NO EXCEPTIONS!
I'm simply amazed that this post has existed for over a year and is still posted here!