Lesson Plan Title: How to Perform a SQLInjection

Concept / Topic To Teach:
SQL injection attacks represent a serious threat to any database-driven site. The methods behind an attack are easy to learn and the damage caused can range from considerable to complete system compromise. Despite these risks, an incredible number of systems on the internet are susceptible to this form of attack.

Not only is it a threat easily instigated, it is also a threat that, with a little common-sense and forethought, can easily be prevented.

It is always good practice to sanitize all input data, especially data that will used in OS command, scripts, and database queiries, even if the threat of SQL injection has been prevented in some other manner.

General Goal(s):
For this exercise, you will perform SQLInjection attacks. You will also implement code changes in the web application to defeat these attacks.

Solution:
Choose Larry to log in with password larry. Select yourself from the list and make sure that WebScarab will intercept the next request. Replace the id 101 with following:
101 OR 1=1 ORDER BY salary desc

With '101 OR 1=1' we have a SQL Statement which is always true. It will get all the employees from the db but only return one of them. That is why we have to ensure we get the "Big Fish" which is the employee earning most. With 'ORDER BY SALARY DESC' we guarantee exactly this.