Archive

Posts Tagged ‘SQL Injection’

Last 5 days…


Today Diwali. There is till a feeling not enjoying diwali moments with my parents. The last 5days are very busy days, coding the project (this I’ve been doing for last 15 days), submitting the report… We were asked to take an IEEE paper to implement in the area of Networking and Distributed Security System. I’ve chosen “SQL Injection prevention using Parse tree validation”. It involved complex things, some times I messed up with some threading concepts and synchronization issues in between, Got my hands dirt doing random generating long numbers and also getting system time in milli seconds and things like that. At last preparing the report took me to be awake till 3:00 AM one day. I’ve to thank Zql authors for giving me such a wonderful tool(Open source) to parse SQL statements. At last expected my presentation to go smooth. I expect I did so(with a little panic). After the presentation one of my instructor took all of us with him to canteen to give some treat. He narrated his experiences in NITK and all his achievements.. Very Inspiring. When I reached my room back it was around 7:00. Thanks to sir for giving me the treat I skipped breakfast and lunch that treat came at correct time.

Advertisements

SQL Injection Attacks


Our dependance with the web has rapidly increased, now internet has took the world by storm. Most of us use internet for e-banking, online marketing, paying bills and making reservations. We have to ask ourselves how much safe and reliable the webapplications are?. Studies have found that many webapplications’ security is compromised by the sophisticated attacks One of such kinds is “The SQL Injection”. In this attack attacker injects his code in to the web application thereby compromising the security, he can leak very confidential information such as Credit card numbers and even can able to destroy all the data in the database too.

The SQL Injection attack is possible because the given user input is not validated before it is fed to the database SQL engine. A part of the user input is written by the attacker such that the data is totally aired to the attacker. If we go in detail, the main cause of concern of this attack is owing to having been totally stuck up to the management of data using databases(Databases are the best way of organising and storing the data).

One of the counter measure for this kind of attack is that using techniques which will prevent Invalid and destructive User Inputs. Here is an example how is this done.

Let there is are UserName: and Password: fiels in a webspage. When user enters username and password the developer would have written the SQL query to evealuate it Like

1) ResultsSet rs=rs.executeQuery(“Select username, password from User”);

2) if(rs.getString(1)==username&&rs.getString(2)==password)

{

//

}

After this is over assume that there is another textfield to search within the website. At that time the attacker gives the query in this form.

;’ Malicious Qurery ‘;

Select plan from Web where search=”;’Malicious Qurey’;
The first ;(semicolon marks the end of the internal query as shown in the above statement) and the second query executes happily harming the whole database totally breaching the security.

The Malicious Query could be “drop table User” ( Or anything)

One kind of couter measures(or mitigation technique) we have to take against SQL Injection is using PreparedStatements in java while coding for the webapplications. In PreparedStatements it takes whole user input as only text “String” No matter what it is.