Before learning SQL Injection. You should know what SQL and Database is.
Database:
Database is collection of data. In website point of view, database is used for storing names, User ids, User passwords, Login time and many more things.
Some Types of Database are:
SQL:
Structured Query Language is Known as SQL. In order to communicate with the Database ,we use SQL query. We are querying the database so it is called as Query language.
Definition From Complete Reference:
SQL is a tool for organizing, managing, and retrieving data stored by a computer database. The name "SQL" is an abbreviation for Structured Query Language.
For historical reasons, SQL is usually pronounced "sequel," but the alternate pronunciation "S.Q.L." is also used. As the name implies, SQL is a computer language that you use to interact with a database. In fact, SQL works with one specific type of database, called a relational database.
Simple Basic Queries For SQL:
Select * from table_name :
this statement is used for showing the content of tables including column name.
For eg:
select * from users;
Insert into table_name(column_names,...) values(corresponding values for columns):
For inserting data to table.
For eg:
insert into users(username,userid) values("TheSec","break");
What Is SQL Injection?
SQL injection is a Famous and Common method of hacking. Using this method an unauthorized person can access the database of the website. Attacker can get all details from the Database.
What an attacker can do?
Now let's dive into the real procedure for the SQL Injection.
Finding Vulnerable Website:
Our best partner for SQL injection is Google. We can find the Vulnerable websites(hackable websites) using Google Dork list. google dork is searching for vulnerable websites using the google searching tricks. There is lot of tricks to search in google. But we are going to use "inurl:" command for finding the vulnerable websites.
Some Examples:
Click Here to Download a huge list of Google Dork.
Click Here to Download Havij v1.17 You Will Need It For SQL Injection
How To Use?
1.Copy one of the above command and paste in the google search engine box and press enter.You will see Many Websites.
2. We have to visit the websites one by one for checking the vulnerability. So Start from the first website.
3. lets say the vulnerable site URL is:- “http://website.com/index.php?module=pages&id=85”
4. Put a single quotation Mark at the end of URL and press enter. If you get error then the site is vulnerable to S.Q.L. injection attack .
5. Now Open Havij and paste the above URL Without any quotation Mark like this http://website.com/index.php?module=pages&id=85
6. After that hit “Analyze” and it will Start scanning the site for SQL injection Vulnerability.
7. It will tell you the type of server and also the type of OS running on the server and will give a message like :- Target Vulnerable if the site is vulnerable.
8. Now go to “Tables” and “Get Database” and after getting data bases check all of them and hit “Get Tables” After getting tables of DB’s , select the admin table and hit “Get Columns” , after getting columns now a hacker can check the password and username column and can hit “Get Data”.
9. You will get data in encrypted form , like mostly in “md5 hash” but we can decrypt it easily by using havij or other online tools present, After decrypting md5 , you have to find “admin page” using havij, find the buttons for decrypting md5 and finding admin page, Point the browser to the admin page, where you have to put the decrypted “password” and “username” of the admin to login into the website.
10. After successful login into the website as admin the hacker can do whatever he wants.
Database:
Database is collection of data. In website point of view, database is used for storing names, User ids, User passwords, Login time and many more things.
Some Types of Database are:
- DB servers,
- MySQL(Open source),
- MSSQL,
- MS-ACCESS,
- Oracle,
- Postgre SQL(open source),
- SQLite,
SQL:
Structured Query Language is Known as SQL. In order to communicate with the Database ,we use SQL query. We are querying the database so it is called as Query language.
Definition From Complete Reference:
SQL is a tool for organizing, managing, and retrieving data stored by a computer database. The name "SQL" is an abbreviation for Structured Query Language.
For historical reasons, SQL is usually pronounced "sequel," but the alternate pronunciation "S.Q.L." is also used. As the name implies, SQL is a computer language that you use to interact with a database. In fact, SQL works with one specific type of database, called a relational database.
Simple Basic Queries For SQL:
Select * from table_name :
this statement is used for showing the content of tables including column name.
For eg:
select * from users;
Insert into table_name(column_names,...) values(corresponding values for columns):
For inserting data to table.
For eg:
insert into users(username,userid) values("TheSec","break");
What Is SQL Injection?
SQL injection is a Famous and Common method of hacking. Using this method an unauthorized person can access the database of the website. Attacker can get all details from the Database.
What an attacker can do?
- ByPassing Logins
- Accessing secret data
- Modifying contents of website
- Shutting down the My SQL server
Now let's dive into the real procedure for the SQL Injection.
Finding Vulnerable Website:
Our best partner for SQL injection is Google. We can find the Vulnerable websites(hackable websites) using Google Dork list. google dork is searching for vulnerable websites using the google searching tricks. There is lot of tricks to search in google. But we are going to use "inurl:" command for finding the vulnerable websites.
Some Examples:
- inurl:index.php?id=
- inurl:gallery.php?id=
- inurl:article.php?id=
- inurl:pageid=
Click Here to Download a huge list of Google Dork.
Click Here to Download Havij v1.17 You Will Need It For SQL Injection
How To Use?
1.Copy one of the above command and paste in the google search engine box and press enter.You will see Many Websites.
2. We have to visit the websites one by one for checking the vulnerability. So Start from the first website.
3. lets say the vulnerable site URL is:- “http://website.com/index.php?module=pages&id=85”
4. Put a single quotation Mark at the end of URL and press enter. If you get error then the site is vulnerable to S.Q.L. injection attack .
5. Now Open Havij and paste the above URL Without any quotation Mark like this http://website.com/index.php?module=pages&id=85
6. After that hit “Analyze” and it will Start scanning the site for SQL injection Vulnerability.
7. It will tell you the type of server and also the type of OS running on the server and will give a message like :- Target Vulnerable if the site is vulnerable.
8. Now go to “Tables” and “Get Database” and after getting data bases check all of them and hit “Get Tables” After getting tables of DB’s , select the admin table and hit “Get Columns” , after getting columns now a hacker can check the password and username column and can hit “Get Data”.
9. You will get data in encrypted form , like mostly in “md5 hash” but we can decrypt it easily by using havij or other online tools present, After decrypting md5 , you have to find “admin page” using havij, find the buttons for decrypting md5 and finding admin page, Point the browser to the admin page, where you have to put the decrypted “password” and “username” of the admin to login into the website.
10. After successful login into the website as admin the hacker can do whatever he wants.
Sign up here with your email
ConversionConversion EmoticonEmoticon