SQL Injection Tutorial With Havij

According to a survey the most common technique of hacking a website is SQL Injection. SQL Injection is a technique in which hacker insert SQL codes into web Forum to get Sensitive information like (User Name , Passwords) to access the site and Deface it. The traditional SQL injection method is quite difficult, but now a days there are many tools available online through which any script kiddie can use SQL Injection to deface a webite, because of these tools websites have became more vulnerable to these types of attacks.

One of the popular tools is Havij, Havij is an advanced SQL injection tool which makes SQL Injection very easy for you, Along with SQL injection it has a built in admin page finder which makes it very effective.

Warning - This article is only for education purposes, By reading this article you agree that RHA is not responsible in any way for any kind of damage caused by the information provided in this article.

Supported Databases With Havij

  • MsSQL 2000/2005 with error.
  • MsSQL 2000/2005 no error union based
  • MySQL union based
  • MySQL Blind
  • MySQL error based
  • MySQL time based
  • Oracle union based
  • MsAccess union based
  • Sybase (ASE)


Now i will Show you step by step the process of SQL injection.

Step1: Find SQL injection Vulnerability in tour site and insert the string (like http://www.target.com/index.asp?id=123) of it in Havij as show below.

Step3: Now click on the Analyse button as shown below.

Now if the your Server is Vulnerable the information about the target will appear and the columns will appear like shown in picture below:

Step4: Now click on the Tables button and then click Get Tables button from below column as shown below:

Step5: Now select the Tables with sensitive information and click Get Columns button.After that select the Username and Password Column to get the Username and Password and click on the Get Table button.


Here are some of the countermeasures you can take to reduce the risk of SQL Injection

1.Renaming the admin page will make it difficult for a hacker to locate it

3.Use a Intrusion detection system and compose the signatures for popular SQL injection strings

4. One of the best method to protect your website against SQL Injection attacks is to disallow special characters in the admin form, though this will make your passwords more vulnerable to bruteforce attacks but you can implement a capcha to prevent these types of attack.

About Author: 

This article was written by Muhammad Haseeb Javed. He blogs at his blog http://www.hackthepc.blogspot.com/ , If you are are also looking forward to write a guest post on RHA, read the guidelines here

Subscribe to our Newsletter and receive updates directly via email - Get Ethical hacking and security tips directly to your inbox. Alternatively you can Join our Hackers Community on Facebook , Google+ and Twitter .

At RHA Infosec we provide different types of Security Testing from small business sites to Corporate Sites. Click Here to know more about our complete list of services.

Subscribe to RHA

Enjoyed this article?
Subscribe to "Rafay Hacking Articles" and get daily updates in your inbox for free!


Kindly Bookmark it and Share it with Friends:


  1. Wooohhhhhh thanks rafay with your inspiration i have also successfully launched my book on "Learn Facebook Hacking" today...
    Please see at www.krackoworld.tk and comment..

  2. I just downloaded THC Hydra for my ubuntu. but I don't know to install the software..kindly tell me how to install it..

  3. i just downloaded hydra for my ubuntu.but i don't know to compile it.kindly tell me to do it..

  4. nice...

    Thanx for sharing :)

  5. On what principle this SQL works?

  6. @SParkiNeuron
    Are you asking how SQL injection works or how SQL works?

  7. I googled it ..i couldn't find it..

  8. @Muralimohan.A.R
    Can you tell me what version of Ubuntu are you using?

  9. I use Ubuntu 10.10 Maverick Meerkart(desktop edition)...

  10. Nice Tool however,
    Go to ubuntu forums [dot] com or else get .deb archive, it will install automatically without use of terminal.

  11. I have to compile it first before installing..That's the prblm...

  12. So many dam n00bies now a days in Linux, just go back to Windows.

    Open up the damn terminal:
    make install

    Was that so damn hard?

  13. @damn Anonymous

    What is your damn problem?? LOL

  14. Very awesome if you guys need SQL Sites to practice this SQL Injection tutorial type this code into google and do a seach:


    It will list all pages that use SQL

    Have fun

    I trieded it and it works very awesome!!

    After you get the username and password go here to see how to add both after the website and login.



    Thanks for this amazing site!

  15. can u upload c99 shell...? using havij

  16. Hello dude, warmest welcome from Mauriitus... Well,a ctually am using havij and have found a website vulnerable to it, all is well, but when am trying to get the data of the admins, its invisble, havij is working, we can see it shifting to other line as well but i cant see the username and password?? help pleasee. thnxx in advance

  17. There is no input to inject :S ? WHat does that mean

  18. hey what program are you using in this tutorial ?

  19. I am getting error message saying there is no input to inject whats that

  20. I am not a programmer but I have this SQL subject this session and have to prepare for it. What all topics should be covered in it?
    And has anyone studied from this course www.wiziq.com/course/125-comprehensive-introduction-to-sql of SQL tutorial online?? or tell me any other guidance...
    would really appreciate help

  21. hai rafay your site is very informative and nice iam regular visitor of your blog
    i want information regarding hacking servers plz provide the tutorial on this
    i hope u will post
    i sent you request to join in rha
    my mail id vishwanathc9@gmail.com


Blog Archive


Recent Comments


Rafay Baloch is an Independent security researcher, Internet marketer, Entrepreneur and a SEO consultant, He is the founder of RHA blog and multiple other blogs. Rafay got famous after finding a Remote Code Execution bug inside PayPal for which PayPal awarded him a sum of 10,000$ Read More..

Join In!

RHA © 2013. All Rights Reserved.