<<< Date Index >>>     <<< Thread Index >>>

MyBB 1.0 RC4 XSS Bug



Description: 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. Full control over your discussion
system is presented right at the tip of your fingers, from multiple
styles and themes to the ultimate customisation of your forums using
the template system.

Exploit: The Website field of a users profile doesnt properly sanitize
user input before inserting the data into the database.  This allows
for the injection of HTML and scripting which can be utilized to
affect the way a website displays, steal cookies containing password
hashes, redirect the user completely, and perform various other tasks.
 It affects the current version of MyBB 1.0 RC 4, and should be fixed
by the time the gold release comes out.

Solution: 

Find line 329 in the file usercp.php containing the code `$website =
addslashes($website);`

Place cursor at the end of the line and hit enter twice, then either
type in or paste the following block
of code

// Begin XSS Fix
$website = strip_tags($website); // strip the tags
$filter = array("\"", "\'", "<", ">", "@", "[", "]");  // build an
array of characters to remove
$website = str_replace($filter, "", $website); // remove all of the
items in the array
$website = eregi_replace("[\s]", "", $website); // strips out
whitespace that is left after sanitizing input
// End XSS Fix

This code strips out characters that can appear in XSS as well as
cleans up spaces left after the suspect characters are removed.  This
does not fix XSS already in someones profile, thats a simple matter of
manipulating the database or using the admin panel to remove the code.

-- 
"The Nelson-Shepherd cutoff: The point at which you realise someone is
an idiot while trying to help them."