(http://www.cnhacker.cn/asp/list.asp?id=2184)
I have no systematic learning ASP or PHP programming, and there is no systematic learning of Access, SQLSERVER, MySQL and other databases, so I am not a programmer, although I often do some similar programmers. Because I want to build my own site, I have written three times, I also wrote a few thousand lines, coupled with some tests for some forums, message boards, and articles, and found some problems, now discuss now. When writing this article, I have conducted some tests on the XX security website, the ×× Municipal Talent Network, and the website of the XX network company in this article. apology! I am choosing the test started at 2:00 am, and I am only limited to the search operation, so I can surely say that there is almost no impact on your stations, with 1 hour traffic, slightly, I will give you a safety report, I want Will n't losing, huh, huh! 1, BAK file leak ASP source code Many editing tools, such as EditPlus, UltraEdit, by default, when saving files, will automatically back up one .bak file. If you create or edit the config.asp file, the editor will automatically generate a config.asp.bak file. If the file is not deleted, the attacker can pass http://www.bak/config.asp.bak To download the ASP source. You can imagine that your source program is downloaded, and the risk of being attacked is undoubtedly a lot. And if it is a configuration file, huh, user name, password, database name / location ... solution: either directly turn off the auto backup function of the editor, delete all .bak files when you upload it. 2, authentication is bypassed General Website There are many pages that require authentication to pass later, and these pages need to be verified again, but many programmers often ignore this. If an attacker knows the path and file name of these pages, you can bypass authentication and go directly to the page. Such as: You need to log in to the login.asp page and pass authentication to open the Manage.asp page. Attackers can enter the management interface directly through http://www.**.com/manage.asp. Workaround: Confirm the beginning of these pages. Such as: After authentication, pass a session ("login") = "ok", add the following to the program code: if session ("login") <> "t" the response.redirect "Login .asp "End If the above 2 points are the basic issues of programming, the focus of this article is discussed, and the SQL injection attack and prevention are discussed. 3, ASP program database password verification Vulnerability First, about the request object, we know, if you use the get method in the Form form, you should use the querystring collection to retrieve the form data; and use the POST method to pass the data, you should use form collection To retrieve form data. More programmers omitted the collection name directly, use the request ("data") to retrieve data, seem simple, actually efficient, and easy to errors.
The order of the ASP default search collection is queryString, Form, cookie, Serverariable, when discovers the first matching variable, it is determined as members you want to access. Therefore, it is recommended that you don't use this method. After you have finished writing, we turn to the topic. First look at the login.asp file, the following is the program code: ...