PHP My Wind bypasses filtering SQL injection (Restrictions)

Source: Internet
Author: User

PHP My Wind bypasses filtering SQL injection (Restrictions)

PHPMyWind design defects bypass filtering SQL Injection

Will I tell you in the title that it is actually a global variable overwrite? Register_globals = on is required.

/Include/common. inc. php:

Foreach (array ('_ get',' _ Post') as $ _ request) {foreach ($ _ request as $ _ k = >$ _ v) {if (strlen ($ _ k)> 0 & preg_match ('# ^ (GLOBALS | _ GET | _ POST | _ SESSION | _ COOKIE )#', $ _ k) {exit ('variable names that do not allow requests! ') ;}$ {$ _ K }=_ RunMagicQuotes ($ _ v );}}


People who know this can understand it. The code matches GLOBALS to prohibit the submission of global variables GLOBALS to prevent overwriting of variables, but only checks for $ _ GET and $ _ POST, therefore, you only need to submit in $ _ COOKIE to bypass RunMagicQuotes.

There may be many injection points. For example, phpmywind/product. php

<? Phpif (! Empty ($ keyword) {$ keyword = htmlspecialchars ($ keyword); $ SQL = "SELECT * FROM 'dede _ infoimg 'WHERE (classid = $ cid OR parentstr LIKE' %, $ cid, % ') AND title LIKE' % $ keyword % 'AND delstate = ''AND checkinfo = true order by orderid DESC "; // here spell SQL} else {$ SQL = "SELECT * FROM 'dede _ infoimg 'WHERE (classid = $ cid OR parentstr LIKE' %, $ cid, % ') AND delstate = ''AND checkinfo = true order by orderid DESC";} $ dopage-> GetP Age ($ SQL, 9); while ($ row = $ dosql-> GetArray () {if ($ row ['picurl']! = '') $ Picurl = $ row ['picurl']; else $ picurl = 'templates/default/images/nofoundpic.gif '; if ($ row ['linkurl'] = ''and $ response _isreurl! = 'Y') $ gourl = 'productshow. php? Cid = '. $ row ['classid ']. '& id = '. $ row ['id']; else if ($ pai_isreurl = 'y') $ gourl = done'; else $ gourl = $ row ['linkurl'];?>



Here we add a cookie named GLOBALS [keyword]
 



Print $ keyword:
 



The filter is bypassed and'

Payload:

 




 

Solution:

Check cookie in global Filter Function

 

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.