May 19, 2013, 06:52:20 PM *
   Home   Help Login Register  
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Pages: [1] 2   Go Down
Print
Author Topic: [XBTIT VULNERABILITY] xbtit "uid" Cookie SQL Injection Vulnerability  (Read 15051 times)
0 Members and 2 Guests are viewing this topic.
Lupin
Administrator
Hero Member
*****
Offline Offline

Gender: Male
Btit Version: xbtit v.2
Posts: 10,737



View Profile WWW
« on: April 12, 2010, 06:09:13 PM »

A vulnerability has been discovered in xbtit, which can be exploited by malicious people to conduct SQL injection attacks.

Input passed via the "uid" cookie to the "userlogin()" function in include/functions.php is not properly sanitised before being used in SQL queries. This can be exploited to manipulate SQL queries by injecting arbitrary SQL code.


very quick and easy fix:
in functions.php find
Code:
 $uid=max(0,$CURUSER['uid']);
replace with
Code:
 $uid=max(1,(int)$CURUSER['uid']);

and replace this string:
Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, $_COOKIE['uid']);

to:

Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, (int)$_COOKIE['uid']);
« Last Edit: April 28, 2010, 10:17:05 AM by Lupin » Logged

Please don't PM me about question already asked in forum!

Help or support requested using PM will be billed 50 euros/hour, minimum 1 hour; support on forum is free.
locker
Guest
« Reply #1 on: April 12, 2010, 07:04:41 PM »

and replace this string:
Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, $_COOKIE['uid']);

to:

Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, (int)$_COOKIE['uid']);
Logged
Peace_Maker
Full Member
***
Offline Offline

Btit Version: None
Posts: 159



View Profile WWW
« Reply #2 on: April 12, 2010, 07:18:23 PM »

and replace this string:
Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, $_COOKIE['uid']);

to:

Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, (int)$_COOKIE['uid']);

thanks, but can one of the staff confirm this alteration.
Logged
zooforum
Guest
« Reply #3 on: April 12, 2010, 11:47:27 PM »

Lupin, I already did the patch you have above from the announcement on the private forum, but did not see anything like the reply by locker on changing that line in the code.
Logged
Peace_Maker
Full Member
***
Offline Offline

Btit Version: None
Posts: 159



View Profile WWW
« Reply #4 on: April 13, 2010, 12:26:03 AM »

one of the fix is to force the variable to be an integer (sine php variable type could be changed on the fly), locker is forcing $_COOKIE['uid'] to be an integer, which wont do any harm (but bring on more protection.
« Last Edit: April 13, 2010, 12:43:09 AM by Peace_Maker » Logged
Lupin
Administrator
Hero Member
*****
Offline Offline

Gender: Male
Btit Version: xbtit v.2
Posts: 10,737



View Profile WWW
« Reply #5 on: April 13, 2010, 10:28:40 AM »

Confirmed, I asked locker to made the post.
Logged

Please don't PM me about question already asked in forum!

Help or support requested using PM will be billed 50 euros/hour, minimum 1 hour; support on forum is free.
treat24
Guest
« Reply #6 on: April 14, 2010, 12:56:52 AM »

A vulnerability has been discovered in xbtit, which can be exploited by malicious people to conduct SQL injection attacks.

Input passed via the "uid" cookie to the "userlogin()" function in include/functions.php is not properly sanitised before being used in SQL queries. This can be exploited to manipulate SQL queries by injecting arbitrary SQL code.


very quick and easy fix:
in functions.php find
Code:
  $uid=max(0,$CURUSER['uid']);
replace with
Code:
  $uid=max(1,(int)$CURUSER['uid']);



thx for fix update.... i cant find the code on functions.php, i even tried searching a piece of the code but nothing Huh

Does it even apply to 1.4.8?

please help
Logged
friendly
xbtiteam
Hero Member
****
Offline Offline

Gender: Male
Btit Version: BtiTracker 1.4x
Posts: 700


View Profile WWW
« Reply #7 on: April 14, 2010, 12:59:36 AM »

the fix is for xbtit 2.0 m8 it wont affect btit 1.4.8  Wink
Logged

(http://friendlystyles.co.uk/)
locker
Guest
« Reply #8 on: April 14, 2010, 03:44:06 AM »

no, it's affected and to last version of Btit

simple fix like in xBtit

- open include/function.php
- find:
Code:
$id = max(1 ,$_COOKIE["uid"]);
- replace to:
Code:
$id = max(1 ,(int)$_COOKIE["uid"]);
Logged
treat24
Guest
« Reply #9 on: April 16, 2010, 10:57:26 PM »

good looking out locker Smiley

just got it replaced

Thx
Logged
dadohannibal
Guest
« Reply #10 on: April 18, 2010, 12:32:34 PM »

Hi all
I don't have this
Code:
$id = max(1 ,$_COOKIE["uid"]);
I've
Code:
  // guest
    $id = (!isset($_COOKIE['uid']))?1:max(1, $_COOKIE['uid']);
and this
Code:
  if (!isset($_COOKIE['pass'])) $_COOKIE['pass'] = '';
  if (($_COOKIE['pass']!=md5($row['random'].$row['password'].$row['random'])) && $id!=1)

Any help?
Thanks Smiley
Logged
locker
Guest
« Reply #11 on: April 18, 2010, 03:51:51 PM »

dadohannibal and for others - read this, before asking )
===============================================================
if you have xBtit:

very quick and easy fix:
in functions.php find
Code:
  $uid=max(0,$CURUSER['uid']);
replace with
Code:
  $uid=max(1,(int)$CURUSER['uid']);

and replace this string:
Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, $_COOKIE['uid']);
to:
Code:
$id = (!isset($_COOKIE['uid']))?1:max(1, (int)$_COOKIE['uid']);

===============================================================

if you have Btit:

- open include/function.php
- find:
Code:
$id = max(1 ,$_COOKIE["uid"]);
- replace to:
Code:
$id = max(1 ,(int)$_COOKIE["uid"]);

===============================================================
Logged
dadohannibal
Guest
« Reply #12 on: April 18, 2010, 04:52:08 PM »

I've readed all the posts, and I remember $id not $uid.
But no matter Smiley
Thanks:)

Logged
BlackDragon
Sr. Member
****
Offline Offline

Gender: Male
Btit Version: xbtit v.2
Posts: 335


/!\ Access Denied /!\


View Profile WWW
« Reply #13 on: May 05, 2011, 04:02:59 PM »

can we do this change on xbtitFM or not ?
Logged
cdx1
xbtiteam
Hero Member
****
Offline Offline

Gender: Male
Btit Version: None
Posts: 842


RUNNING: Xbitfm V1.12/modded xbt backend


View Profile
« Reply #14 on: May 05, 2011, 04:33:15 PM »

dont worry about xbtitfm its protected  Wink

can we do this change on xbtitFM or not ?
Logged


this is for them who steal xbtit private hacks ----> ┌∩┐(◣_◢)┌∩┐

Pages: [1] 2   Go Up
Print
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
xBtit_Default by: TreetopClimber © 2006,2007 | Back To Top
Valid XHTML 1.0! Valid CSS!

Recommended: Wholesale Computers - dresses - Wow Gold - Auto Diagnostic Tool
Online shopping at tmart.com and Worldwide Free Shipping - Get great dresses deals at dressale.com
your link here, contact lupin @ btiteam.org for more info

MKPortal ©2003-2006 mkportal.it