[waraxe-2007-SA#049] - Multiple vulnerabilities in Phorum 5.1.20 ==================================================================== Author: Janek Vind "waraxe" Date: 19. April 2007 Location: Estonia, Tartu Web: http://www.waraxe.us/advisory-49.html Target software description: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Phorum 5.1.20 http://www.phorum.org/ Vulnerabilities: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. critical sql injection in "pm.php" parameter "recipients" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's look at source code of "include/db/mysq.php" ~ line 1881 : ------------------[source code]---------------------- function phorum_db_user_get($user_id, $detailed) { $PHORUM = $GLOBALS["PHORUM"]; $conn = phorum_db_mysql_connect(); if(is_array($user_id)){ $user_ids=implode(",", $user_id); } else { $user_ids=(int)$user_id; } $users = array(); $sql = "select * from {$PHORUM['user_table']} where user_id in ($user_ids)"; $res = mysql_query($sql, $conn); if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql"); ------------------[/source code]---------------------- As we can see, if "$user_id" is array, then there is no sanitize against data before using in sql query. After some research I have found a way to use this bug for sql injection. For this, first of all, potential attacker must have valid user account in specific Phorum-powered website and he/she must be logged in. And then let's try this proof-of-concept html file: ------------------[PoC exploit]-----------------------