Lucene search
K

videoDB <= 3.1.0 - SQL Injection Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 17 Views

VideoDB SQL Injection Vulnerability in borrow.php allows database content overwrite and information disclosure by revealing server name and dbuser password in the source code

Code

                                                DORK:allinurl:borrow.php?diskid=
DORK:allintitle:videodb

# Vendor: http://www.videodb.net/blog/

 $ -----------#
 | S3C0VERUN  |
 & ------------@

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 could 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 



&#60;?php
/**
 * Borrow Manager
 *
 * Handles lending of disks
 *
 * @package videoDB
 * @author  Andreas Gohr &#60;[email protected]&#62;
 * @version $Id: borrow.php,v 2.20 2008/05/12 13:01:12 andig2 Exp $
 */

require_once &#39;./core/functions.php&#39;;
require_once &#39;./core/output.php&#39;;

// 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    = &#34;DELETE FROM &#34;.TBL_LENT.&#34; WHERE diskid = &#39;&#34;.addslashes($diskid).&#34;&#39;&#34;;
            runSQL($SQL);
		}
		if (!empty($who)) {
			$who = addslashes($who);
            $SQL    = &#34;INSERT INTO &#34;.TBL_LENT.&#34; SET who = &#39;&#34;.addslashes($who).&#34;&#39;, diskid = &#39;&#34;.addslashes($diskid).&#34;&#39;&#34;;
            runSQL($SQL);
		}

        $SQL    = &#34;SELECT who, DATE_FORMAT(dt,&#39;%d.%m.%Y&#39;) AS dt 
                     FROM &#34;.TBL_LENT.&#34; 
                    WHERE diskid = &#39;&#34;.addslashes($diskid).&#34;&#39;&#34;;
        $result = runSQL($SQL);
		
		$who = $result[0][&#39;who&#39;];
		$dt  = $result[0][&#39;dt&#39;];
	}
}

$WHERES = &#39;&#39;;

if ($config[&#39;multiuser&#39;]) 
{
    // get owner from session- or use current user
    session_default(&#39;owner&#39;, get_username(get_current_user_id()));

    // build html select box
    $all = strtoupper($lang[&#39;radio_all&#39;]);
    $smarty-&#62;assign(&#39;owners&#39;, out_owners(array($all =&#62; $all), PERM_READ));
    $smarty-&#62;assign(&#39;owner&#39;, $owner);

    // if we don&#39;t have read all permissions, limit visibility using cross-user permissions
    if (!check_permission(PERM_READ))
    {
        $JOINS   = &#39; LEFT JOIN &#39;.TBL_PERMISSIONS.&#39; ON &#39;.TBL_DATA.&#39;.owner_id = &#39;.TBL_PERMISSIONS.&#39;.to_uid&#39;;
        $WHERES .= &#39; AND &#39;.TBL_PERMISSIONS.&#39;.from_uid = &#39;.get_current_user_id().&#39; AND &#39;.TBL_PERMISSIONS.&#39;.permissions & &#39;.PERM_READ.&#39; != 0&#39;;
    }
        
    // further limit to single owner
    if ($owner != $all) $WHERES .= &#34; AND &#34;.TBL_USERS.&#34;.name = &#39;&#34;.addslashes($owner).&#34;&#39;&#34;;
}

// overview on lent disks
$SQL    = &#34;SELECT who, DATE_FORMAT(dt,&#39;%d.%m.%Y&#39;) as dt, &#34;.TBL_LENT.&#34;.diskid,
                  CASE WHEN subtitle = &#39;&#39; THEN title ELSE CONCAT(title,&#39; - &#39;,subtitle) END AS title,
                  &#34;.TBL_DATA.&#34;.id, COUNT(&#34;.TBL_LENT.&#34;.diskid) AS count, &#34;.TBL_USERS.&#34;.name AS owner
             FROM &#34;.TBL_LENT.&#34;, &#34;.TBL_DATA.&#34;
        LEFT JOIN &#34;.TBL_USERS.&#34; ON owner_id = &#34;.TBL_USERS.&#34;.id
           $JOINS
            WHERE &#34;.TBL_LENT.&#34;.diskid = &#34;.TBL_DATA.&#34;.diskid 
          $WHERES
         GROUP BY &#34;.TBL_LENT.&#34;.diskid
         ORDER BY who, &#34;.TBL_LENT.&#34;.diskid&#34;;
$result = runSQL($SQL);

// check permissions
for($i=0; $i &#60; count($result); $i++)
{
    $result[$i][&#39;editable&#39;] = check_permission(PERM_WRITE, get_userid($result[$i][&#39;owner&#39;]));
}

// prepare templates
tpl_page();

$smarty-&#62;assign(&#39;diskid&#39;, $diskid);
$smarty-&#62;assign(&#39;who&#39;, $who);
$smarty-&#62;assign(&#39;dt&#39;,  $dt);
$smarty-&#62;assign(&#39;editable&#39;,   $editable);
$smarty-&#62;assign(&#39;borrowlist&#39;, $result);

// display templates
tpl_display(&#39;borrow.tpl&#39;);

?&#62;

ADDSLASHES IS THE PROBLEM I ASSUME IT COULD 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&#39;s  article 

if i must say this could 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 could 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

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation