|
/--------------------------------------------------------------------------= =2D--\ | 7 A 6 9 - A d v C: 0= 11 |--------------------------------------------------------------------------= =2D--| | | [ PHP-Nuke SQL injection ] | \--------------------------------------------------------------------------= =2D--/ | 13/05/200= 3 | \----------= =2D-/ Data. =2D----- + Tipy: SQL injection. + Software: PHP-Nuke + Verions: 6.x (including 6.5) y 5.x + Exploit: Yes + Author: Albert Puigsech Galicia + Contact: ripe@7a69ezine.org Introduction. =2D------------ PhpNuke is a well known content management system programed in PHP by Francisco Bucci, a lot of people use it because it is very easy to install and manage. Descripti=F3n. =2D----------- The PHP-Nuke's file download module includes SQL injection features (as usual). The web user may be able to insert his own SQL code in most of the numeric values included in querys, because the plugin coder didn't use inverted comas. Explotation. =2D----------- If the SQL agent allow us to use an UNION sentence (like MySQL 4 does) it is possible to extract information about anything inside the database, of course this includes passwords, personal data, etc. Otherwise, without UNION posibility we can't access to other SQL tables that web links management, so the only posiblity is to play with hits and votes. Some examples: [*] On getit function: =2D-- sql_query("update ".$prefix."_downloads_downloads set hits=3Dhits+1 WHE= RE lid=3D$lid", $dbi); $result =3D sql_query("SELECT url FROM ".$prefix."_downloads_downlo= ads WHERE lid=3D$lid", $dbi); =2D-- http://www.caxa.ru/modules.php?name=3DDownloads&d_op=3Dgetit&lid=3D2%20<our= _code> [*] On search function: =2D-- $result =3D sql_query("SELECT lid, cid, title, url, description, date, = hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepa= ge =46ROM ".$prefix."_downloads_downloads WHERE title LIKE '%$query%' OR description LIKE '%$query%' ORDER BY $orderby LIMIT $min,$downloadsresults", $dbi); =2D-- http://www.caxa.ru/modules.php?name=3DDownloads&d_op=3Dsearch&min=3D2%20<ou= r_code> [*] Vim index.php... There are a lot. Patch. =2D------ There is no patch for this vulnerability. But is easy to add invert= ed comas on all numeric values. Notes. =2D----- I realy sorprised about PHP-Nuke usage. I can't understand that a software with PHP-Nuke's security historial may be used. Lot of vulnerabilty have been discovered on this software in last months, and there are more bug. Recomandation for PHP-Nuke users: Migrate! The are a lot of CMS coded with security in mind, slashcode, scoop (writen= in perl), postnuke, xsphpcms(nice) (wrinten in php).... and more. =2D- =2D-------------------------- Albert Puigsech Galicia http://ripe.7a69ezine.org =2D--------------------------