UID PHP running on????
| From: | Remco van den Berg | Date: | Tue, 23 Nov 1999 22:53:28 +0000 |
| Subject: | UID PHP running on???? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6777@lists.php.net to get a copy of this message | ||
Guys (girls?),
I was a little bit playing with PHP4 (compiled into Apache 1.3.9) when
I discovered the following...
PHP file source:
----------------
if ( copy('/home/www/html/local/index.html', '/tmp/php.test1') ) {
print("File copy succeeded!<br>\n");
}
else {
print("File copy NOT succeeded.<br>\n");
}
if ( copy('/etc/passwd', '/tmp/php.test2') ) {
print("File copy succeeded!<br>\n");
}
else {
print("File copy NOT succeeded.<br>\n");
}
Result in browser:
------------------
File copy succeeded!
Warning: SAFE MODE Restriction in effect.
The script whose uid is 406 is not allowed to access /etc/passwd
owned by uid 0 in /home/www/html/local/php/file_io_test.php on line 13
File copy NOT succeeded.
--
Weird thing however is that my Apache server is running as nobody.www.
Why is the script saying that it is running as uid 406???
#> ll /tmp/php*
-rwxr-xr-x 1 nobody www 990 Nov 23 23:44 /tmp/php.test1
This proves that it _is_ running nobody.www.
Who can explain this? What is happening?
And why is the destination file executable? The original wasn't!
Thank for any explanation,
-Remco
--
----------------------------------------------------------------------------
Remco van den Berg Admin/SO/helpdesk DSE
ICQ: 47514668 rvdberg@dse.nl http://www.dse.nl/
----------------------------------------------------------------------------