Latest Tweets

Hack Website With SQL Injection


SQL Injection ONLINE LAB:

  • Beginners can use this website to practice skills for SQL injection
  • To Access the LAB Click Here

STEP 1: Breaking the Query

  • Let me try out with error based single quote injection method http://leettime.net/sqlninja.com/tasks/basic_ch3.php?id=1′ 
  • Above figure shows single quote error based not working.
  • Above figure shows integer based method is also not working.
  • Above figure shows double quotes are breaking the database so its vulnerable to SQL injection

STEP 2: Copying the Error Statement

  • Copy and Paste the SQL Error statement into Notepad.
  • Above figure shows that Highlighted double quotes are breaking the backend database
  • When we add double quotes which are mismatching the query like this Select username, Password from table where id =”1″”
  • Now you can found out this is Double quote error based string injection.

STEP 3: Joining the Query

  • Let us add  –+  to join the query http://leettime.net/sqlninja.com/tasks/basic_ch3.php?id=1″ –+
  • Above figure illustrates SQL errors are fixed with –+
  • Whatever malicious code placed will talk with database and as of now you have successfully broken the query, joined the query and finally found out it is Double quote error based string injection.

STEP 4: Finding the Backend Columns

  • It is time to have a conversation with the database to find the number of columns.To enumerate columns we can use order by command.

  • Above Figure shows Database with error statement Unknown column ‘6’ in ‘order clause and this error statement says as “There are only 5 columns in database”.

STEP 5: Finding the Backend Tables

  • SQL backend may contain more Tables names with empty data also.Therefore You should first able to find out which table names are present in this 5 columns.
  • Now we can select all 5 columns with union all select to existing URL

  • Above Illustrated Figure shows Username is: 2 as the value which represents table names is present in the 2nd column of the database. Now we have successfully found out the table location in Database

STEP 6: Finding the Backend Table Names

  • We already knew the location of table path, so will directly ask database name, version etc
  • Above figures show the database name as leettime_761wHole
  • Above figures show the database version as 5.6.36-cll-lve

STEP 7: Dumping Database Tables

  • Group_concat() is the function returns a string with the concatenated non-NULL value from a group.
  • So we can use this Function to list all Tables from the database.
  • In Addition, we can use Information_Schema to view metadata about the objects within a database.
  • The Above Figure shows the dump of all tables as testtable1, userlogs, users.

STEP 8: Dumping all Data in Columns of Tables

  • We can dump userlogs
SQL Injection
  • The Above Figure shows the dump of all columns of tables contains id, username, action,date

STEP 9: Dumping all Usernames

  • Here we can dump all username in the database.
SQL Injection
  • The Above Figure shows the dump of all usernames Zen,Inj3ct0r,Zenodermus,decompiler

STEP 10: Dumping all Date

  • Now we can dump all date
SQL InjectionSQL Injection
  • The Above Figure shows the dump of all user created dates in the database.HAPPY HACKING !!!
Previous
Next Post »
'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();