Foreword
The safety of computer systems has always been you pay attention to, but maybe you have been installing and correcting files, anti-virgin software, and firewalls, delineates non-military districts, but maybe because of the negligence of writing program code, your back is There is a big loophole you create.
SQL INJECTION - Hacker SQL Fill Game
In today's application architecture, most of them contain a database to accommodate a wide range of materials. In various types of databases, the RDBMS RELATIONAL DATABASE Management system based on SGL Structure Query Language is most popular.
The general programming designer is often used to organize the SQL language using third-generation languages such as Visual Basic, and then pass to the relational database system execution to establish or delete the data structure, give or remove the usage permissions. And even new, modified, deleted or query information. Because all of the relational databases are followed by the SQL command, various data maintenance work can be easily completed through this way. But it is also because the SQL language is omnipotent, so a slightly loopholes will make hackers organically multiply. These two articles are a deep discussion on this topic.
The information access of the website is generally dangerous because the internet is an open environment, not as in the internal network of the general company, in addition to the safety design of the computer itself, and filtering the standing background of the screening employee. Internet internet The Dragon Snake Inpass, most of the users have rushing the tollus, but a few people who are changing the regions must invade our system, stealing valuable information. However, the general network management personnel and web designers may have heavy prevention in security settings, such as firewalls, design non-military districts (DMZ), limit the identity of website login, and so on. However, due to the lack of cognition of the SQL language and database management system, the back door of the system is opened.
This article uses MS SQL Server to make a discussion and demonstration for Microsoft ASP website architecture. It is hoped that managers who can provide managers from SQL Injection have a basic understanding. If the author is writing this article, use the search website to find a few There is a member of the member mechanism to test, most of which have the dangers of invading in such ways, and everyone cannot be careful. The author first established a general member website to log in to the webpage, and the architecture of the relevant information sheet is as follows: The Schema of the data sheet is as shown in the program code list 1.
Create Table [TBLUSER] ([Userid] [INT] Identity (1, 1) Not Null, [UserName] [NVARCHAR] (50) Not null, [Password] [NVARCHAR] (50) Not null, [PRI] [Tinyint ] Null constraint [DF_TBLUSER_PRI] Default (0), ConsTRAINT [PK_TBLUSER] Primary Key Clustered ([UserID]))
Program Code List 1: Store Member Information Table Schema.
And join the contents of the data sheet
INSERT TBLUSER (Username, Password, PRI) Values ('admin "(Username, Password, PRI) Values (' Byron ',' Byronpass", 10)
Write in the web page, such as program code list 2.
<% IF Request ("UserName") <> "" and Request ("pass") <> "" "" "" "" AdoDb.Connection "with cnn.connectionstring = Application (" " "). Open 'Use the user entered by the user to combine SQL syntax strsql =" select * from tbluser where username =' "& _Request (" username ") &" 'and password =' "& request (" pass ") & "'" Is handed over to SQL Server execution, this is the most dangerous place to set REC = .execute (strsql) end with wel. "UserName") = Request ("UserName") Response.write "Welcome "" "& Request (" UserName "Elseresponse.Write" Your account / password input error "end ifelse%>