note 32281 deleted from function.popen by nlopess

From: Date: Thu, 15 Apr 2004 16:09:20 +0000
Subject: note 32281 deleted from function.popen by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-68168@lists.php.net to get a copy of this message
Note Submitter: egal at staerk dot de ---- On a standard Linux/Apache/php-Configuration, this Skript takes over control as testuser (root is also possible), whose password is known as password and replaces the content of his file "file" by hallo: $process=popen("/bin/bash", "w"); fputs($process, "su testuser -c 'echo hallo>file' 2>fehler.htm\npassword\n"); fclose($process); If an error occurs, for example su is only possible from a console (seems not to be php standard configuration), the error message can be found under fehler.htm So, be aware that with a standard configuration, the php-script can do everything as root if his password is known. In such way, the password of root can also easily be found out by a dictionary-attack.

« previous php.notes (#68168) next »