From: zlo at canada dot com Operating system: RedHat 7.2 PHP version: 4CVS-2003-02-18 (stable) PHP Bug Type: Apache related Bug description: cgi binary parses itself when called directly
when PHP cgi binary is called from cgi-bin without cgi-redirect, it parses itself (argv[0] of the binary, whatever that happens to be)! i don't think it represents much of a security problem (it still does to some extent, because it reveals path to php and default settings), and no sane person will run the cgi binary without cgi-redirect, but i don't think its the way its supposed to be either.. here is a simple example; this also works with the php binary itself in place of this binary. this results in some binary output and the typical phpinfo() page in the middle: # cat php.c #include <stdio.h> #include <string.h> #include <stdlib.h> const char *PHP_BINARY="/path/to/php/bin/php"; const char * dummy="<?php phpinfo(); ?>"; int main(int argc, char *argv[]){ execl(PHP_BINARY,argv[0],0); return 1; }; p.s. btw this simple wrapper (without the phpinfo() part, or course) can be used as a workaround for the vulnerability with cgi-redirect that resulted in the release of 4.3.1 since it removes parameters before exec'ing php itself.. p.p.s. where can i post "feedback"? i can't seem to find it.. -- Edit bug report at http://bugs.php.net/?id=22270&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22270&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22270&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22270&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22270&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22270&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22270&r=support Expected behavior: http://bugs.php.net/fix.php?id=22270&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22270&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22270&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22270&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22270&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22270&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22270&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22270&r=gnused