tutorial
- Sabtu, April 25, 2009 - 0 komentar
Sql injection - HSC Guides - Web App Security
Written by Ethical Hacker
Sunday, 17 February 2008 17:06
SQL Injection is an attack method that targets the data residing in a database through the firewall that shields it. It attempts to modify the parameters of a Web-based application in order to alter the SQL statements that are parsed to retrieve data from the database.
Naturally, the first step in this direction should be to uncover web applications that are vulnerable to the attack. The attack takes advantage of poor code and website administration. In SQL injection, user controlled data is placed into a SQL query without being validated for correct format or embedded escape strings. It has been known to affect majority of applications which use a database backend and do not filter variable types. It has been estimated that at least 50% of the large e-commerce sites and about 75% of the medium to small sites are vulnerable to this attack. The dominant cause is the improper validation in CFML, ASP, JSP, and PHP codes. Attackers go about uncovering the susceptible web application by looking at web pages for anything resembling an ID number, category, or name. The attacker may sift through all forms of variables as well as cookies. Many a times session cookies are stored in a database and these cookies are passed into SQL queries with little or no format checks. They may try placing various strings into form fields and in query variables. However, typically, someone looking for SQL vulnerability will start off with single and double quotes and then try with parenthesis and the rest of the punctuation characters. The response expected is any response signifying an error.
(OLE DB Errors)
The user filled fields are enclosed by single quotation marks ('). So a simple test of the form would be to try using (') as the username.
When we just enter in a form that is vulnerable to SQL insertion. If you get OLE Database error, then you can try SQL injections.
[example]
Attackers start by using the single quote in the User ID field of the login page. It returned an error just as they wanted it.
[Error Type]
Microsoft OLE DB Provider for ODBC Drivers (Ox80040E14)
[Microsoft] [ODBC SQL Server Driver] [SQL Server] Unclosed quotation mark before the character string '''.
/corner/asp/checklogin1.asp, line 7
Browser Type:
Mozilla/(version) (compatible; MSIE 6.0; Windows NT 5.0)
Page: #
POST 36 bytes to /corner/asp/checkloginl.asp
POST Data:
userid=%27&userpwd=%27&Submit=Submit
This output is the first lead the attacker can use. He has a greater chance of succeeding if he can find out which database he is pitted against. This is called database footprinting. Database footprinting is the process of mapping out the tables on the database. Identifying the configuration of the server is crucial in deciding how the site will be attacked. The method chosen to do this will depend on how poorly the server has been configured. In the error statement shown above, it is clear that the site is using a SQL Server. Note that SQL Injection is the attack on the web application, not the web server or services running in the OS. It is typical of an HTML page to use the POST command to send parameters to another ASP page. On a closer look at the source code we find the "FORM" tag,
0 Responses to "Sql injection - HSC Guides - Web App Security"
Posting Komentar