VideoDB & lt; = 3.1.0 SQL Injection defects and repair

Source: Internet
Author: User

Keywords: allinurl: borrow. php? Diskid =
Keywords: allintitle: videodb
 
# Vendor: http://www.videodb.net/blog/
 
$ -----------#
| Initialverun |
&------------@
 
Along with this I was able in some sites to determine that you can overwrite the databse contents and also if you look in the source you se there password the server name and the dbuser htis is a problem because most likely the site cocould be taken over
Due to the fact the admin doesnt usually change passwords on the same box
 
 
Vulnerable software is videodb
 
This is an information disclosure vulnerability it appears most sites running this are vulnerable and have the same database structure im not sure if this is an old version or if it is
Completely vulnerable im downloading the new version now from source
 
 
 
<? Php
/**
* Borrow Manager
*
* Handles lending of disks
*
* @ Package videoDB www.2cto.com
* @ Author Andreas Gohr <a.gohr@web.de>
* @ Version $ Id: borrow. php, v 2.20 2008/05/12 13:01:12 andig2 Exp $
*/
 
Require_once './core/functions. php ';
Require_once './core/output. php ';
 
// Check for localnet
Localnet_or_die ();
 
// Permission check
Permission_or_die (PERM_WRITE, PERM_ANY );
 
// Borrowmanagement for single disk
$ Editable = false;
If (! Empty ($ diskid ))
{
If (check_permission (PERM_WRITE, get_owner_id ($ diskid, true )))
{
$ Editable = true;
If ($ return ){
$ SQL = "DELETE FROM". TBL_LENT. "WHERE diskid = '". addslashes ($ diskid )."'";
RunSQL ($ SQL );
}
If (! Empty ($ who )){
$ Who = addslashes ($ who );
$ SQL = "INSERT ". TBL_LENT. "SET who = '". addslashes ($ who ). "', diskid = '". addslashes ($ diskid ). "'";
RunSQL ($ SQL );
}
 
$ SQL = "SELECT who, DATE_FORMAT (dt, '% d. % m. % y') AS dt
FROM ". TBL_LENT ."
WHERE diskid = '". addslashes ($ diskid )."'";
$ Result = runSQL ($ SQL );

$ Who = $ result [0] ['who '];
$ Dt = $ result [0] ['dt'];
}
}
 
$ WHERES = '';
 
If ($ config ['multiuser'])
{
// Get owner from session-or use current user
Session_default ('owner', get_username (get_current_user_id ()));
 
// Build html select box
$ All = strtoupper ($ lang ['Radio _ all']);
$ Smarty-> assign ('owners', out_owners (array ($ all => $ all), PERM_READ ));
$ Smarty-> assign ('owner', $ owner );
 
// If we don't have read all permissions, limit visibility using cross-user permissions
If (! Check_permission (PERM_READ ))
{
$ JOINS = 'left join'. TBL_PERMISSIONS. 'On'. TBL_DATA. '. owner_id ='. TBL_PERMISSIONS. '. to_uid ';
$ WHERES. = 'AND'. TBL_PERMISSIONS. '. from_uid ='. get_current_user_id (). 'AND'. TBL_PERMISSIONS. '. permissions &'. PERM_READ .'! = 0 ';
}

// Further limit to single owner
If ($ owner! = $ All) $ WHERES. = "AND". TBL_USERS. ". name = '". addslashes ($ owner )."'";
}
 
// Overview on lent disks
$ SQL = "SELECT who, DATE_FORMAT (dt, '% d. % m. % y') as dt,". TBL_LENT. ". diskid,
Case when subtitle = ''then title else concat (title, '-', subtitle) end as title,
". TBL_DATA.". id, COUNT (". TBL_LENT.". diskid) AS count, ". TBL_USERS.". name AS owner
FROM ". TBL_LENT.", ". TBL_DATA ."
Left join ". TBL_USERS." ON owner_id = ". TBL_USERS.". id
$ JOINS
WHERE ". TBL_LENT.". diskid = ". TBL_DATA.". diskid
$ WHERES
Group by ". TBL_LENT.". diskid
Order by who, ". TBL_LENT.". diskid ";
$ Result = runSQL ($ SQL );
 
// Check permissions
For ($ I = 0; $ I <count ($ result); $ I ++)
{
$ Result [$ I] ['editable'] = check_permission (PERM_WRITE, get_userid ($ result [$ I] ['owner']);
}
 
// Prepare templates
Tpl_page ();
 
$ Smarty-> assign ('diskid', $ diskid );
$ Smarty-> assign ('who ', $ who );
$ Smarty-> assign ('dt', $ dt );
$ Smarty-> assign ('editable', $ editable );
$ Smarty-> assign ('borrowlist', $ result );
 
// Display templates
Tpl_display ('borrow. tpl ');
 
?>
 
Addslashes is the problem I assume it cocould BE MUCH WORSE IF HE MADE THIS MISTAKE I URGE YOU ALL TOO LOOK INTO THE CODE
 
 
The problem here is the fact he is using addslashes that can be bypassed with a valid multi byte ending in 0x5c describd in chris Shiflett's article
 
If I must say this cocould be either good or bad thing is it just throws an error the injection is possible on all of these
Nnow what are we to do this cocould be huge or small depending on if it is used widely or just small based but this is the new code from sourceforge
 
 
I believe this to B the script that caused the issue most of the sites including the makers demo use borrow few others changed
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.