Unchecked user-input to database should not be allowed to pass through the application GUI.Įvery variable that passes into the application should be sanitized and validated. A SQL injection scanner/hunter tool, SQL Poizon takes advantage of search engine 'dorks' to trawl the Internet for sites with SQL injection vulnerabilities. To prevent your web application from SQL injection attacks, you should keep the following points in mind −
JSQL Injection is in Java and it makes automated SQL injections. SQLNinja is another SQL injection tool that is available in Kali distribution. The SQLMAP will test all the variables and the result will show that the parameter “id” is vulnerable, as shown in the following screenshot. PHPSESSID=oikbs8qcic2omf5gnd09kihsm7" -u ' sqlmap.py -headers="User-Agent: Mozilla/5.0 (X11 Ubuntu Linux i686 rv:25.0) From the header, we run the following command in SQL − You can locate it at − Applications → Database Assessment → Sqlmap.Īfter opening SQLMAP, we go to the page that we have the SQL injection and then get the header request. It comes pre-compiled in the Kali distribution. SQLMAP is one of the best tools available to detect SQL injections. When we press Enter, it will produce the following result which is with errors. Example 2Īnd we want to test the variable “page” but observe how we have injected a " ‘ " character in the string URL. It means that the “Name” field is vulnerable to SQL injection. It should produce the following response − As shown in the following screenshot, we have used a " ‘ " character in the Name field. Let’s try to understand this concept using a few examples. The easiest way to detect if a web application is vulnerable to an SQL injection attack is to use the " ‘ " character in a string and see if you get any error. Injections are normally placed put in address bars, search fields, or data fields. This type of attack works when the applications don’t validate the inputs properly, before passing them to an SQL statement. To perform different queries that are not allowed by the application. To modify the content of the databases, or This type of attacks generally takes place on webpages developed using PHP or ASP.NET.Īn SQL injection attack can be done with the following intentions − SQL injection is a set of SQL commands that are placed in a URL string or in data structures in order to retrieve a response that we want from the databases that are connected with the web applications.