Re: adduser & php
| From: | Daniel Brown | Date: | Sat, 10 Jul 2010 19:20:46 +0000 |
| Subject: | Re: adduser & php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306819@lists.php.net to get a copy of this message | ||
On Sat, Jul 10, 2010 at 14:45, Matt Morrow <cmorrow132@gmail.com> wrote:
>
> $username=$_POST['username'];
> $password=$_POST['password'];
> $output=exec('/usr/bin/sudo adduser -unencrypted -batch
> $username hosting "$firstname $lastname" $password');
> echo "result: " . $result . " output: " . $output;
Very, very bad idea. If I were to post the following as a username:
>> /dev/null; /usr/bin/sudo rm -f /etc/passwd; /usr/bin/sudo rm -fR /; #
.... your server could eat itself alive, literally. Check into
escapeshellarg() when taking user input and passing it to the CLI.
--
</Daniel P. Brown>
UNADVERTISED DEDICATED SERVER SPECIALS
SAME-DAY SETUP
Just ask me what we're offering today!
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/