SlideShare una empresa de Scribd logo
1 de 61
Dr. Brigitte Lewis
It’s Hammertime: SQL Injection For Beginners
@briglewis
#CyberCon #W0m3nWh0HackM3lb0urn3 @deloitte
#projectfreidman
1
Candid footage of me on a Sunday morning
3
4
5
SELECT
blind
SQL Injection
9
Dewey Decimal System Hashtags
FML ?
What You’re Going to Learn
• Checking for SQL Injection Vulnerabilities is quick and you
can do it too!
• How to execute a SQL Injection
• How to fix SQL vulnerabilities
Why SQL Injection (SQLi?)
15
What is Truth?
19
20
21
27
• SQL Injection is the act of querying or sending requests, otherwise known
as questions, to a database.
• Know Thy Database.
Creating a Conversation with the Database
From the table called users, check that the username
Jo@influencer4lyfe.com.au is there and that Jo's password which is
Influencerlyfe2019! also matches the password Jo supplied.
Speaking in Database Tongue
30
SELECT *
FROM Users
WHERE user = Jo@influencer4lyfe.com.au and password =
influencerlyfe2019!
SQL Query 101
31
7 Steps to SQLi Heaven
32
1. Get the Database Language
33
1.1 Identify the Database Language
Error Based SQL Injection
SQLi Hunting in the Wilds of the Internet
Google Dorks Query
Format for advanced search in
Google
where-you-want-to search:keyword
inurl: php?id=
inurl – Get URL’s or website
addresses
Google Dorks Results
SQLi Hunting in the Wilds of the Internet
37
Statement / Equation True or False
1 + 1= 2 True
2 +2 = 4 True
1=1
a=a
True
True
Speaking in Truths
38
' OR ‘1’ = ‘1
The Classic SQL Injection (SQLi)
39
1.2 Login without a username or password
40
2. Get the Contents of the Database You’re
Currently Talking To
42
Database 101
ID Username Password Signature
1 admin adminpass g0t r00t?
2 adrian somepassword
Zombie
Films
Rock!
3 john monkey ######
4 jeremy password ######
5 bryce password ######
6 samurai samurai ######
7 jim password ######
8 bobby password ######
9 simba password ######
ID Credit Card
1 543556770082
2 543599755432
3 543554332153
4 543555588882
5 543525252183
6 543576464648
7 5435111172934
8 543523232902
9 5435116373849
3. Count the columns to speak to other tables
in the database (using ORDER BY)
%3d is the = sign in URL language
3.1 Count the columns to speak to other
tables in the database
‘ ORDER by 1#
‘ ORDER by 2#
‘ ORDER by 3#
3 Columns in the table
45
4. Checking for the vulnerable column
46
4. Checking for the vulnerable columns
47
4.2 Checking for the vulnerable column
48
5. Get the Database Version
+union select 1,version(),3
49
6. Get the Database Name
+union select database(),2,3
50
'UNION SELECT 1, group_concat(table_name) from
information_schema.tables where table_schema=database()%23
7. Get all the other database names to talk to
them too
51
3. Count the columns to speak to other tables in the database
4. Check for the vulnerable column
5. Get the database version
6. Get the database name
7. Get all the other database names to talk to them too.
1. Get the database to tell you the language it speaks
7 Steps to SQLi Heaven
2. Get the contents of the database you’re currently talking to
Enter SQLi Heaven
54
Fixing SQL Vulnerabilities
1. Never Trust the User
- Validate all input on the user and server side
2. Input sanitisation
- Clean it up before it is sent to the database
3. Parameterisation or pre-prepared statements.
Thank-you for listening! That was:
It’s Hammertime: SQL Injection For Beginners
#CyberCon #W0m3nWh0HackM3lb0urn3 @Deloitte
Dr. Brigitte Lewis | @briglewis
I am
SQL Injection for Beginner's: It's Hammertime

Más contenido relacionado

Último

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Destacado

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Destacado (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

SQL Injection for Beginner's: It's Hammertime

  • 1. Dr. Brigitte Lewis It’s Hammertime: SQL Injection For Beginners @briglewis #CyberCon #W0m3nWh0HackM3lb0urn3 @deloitte #projectfreidman
  • 2. 1
  • 3. Candid footage of me on a Sunday morning
  • 4. 3
  • 5. 4
  • 6. 5
  • 10. 9 Dewey Decimal System Hashtags FML ?
  • 11. What You’re Going to Learn • Checking for SQL Injection Vulnerabilities is quick and you can do it too! • How to execute a SQL Injection • How to fix SQL vulnerabilities
  • 12. Why SQL Injection (SQLi?)
  • 13.
  • 14.
  • 15.
  • 17.
  • 18.
  • 19.
  • 20. 19
  • 21. 20
  • 22. 21
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. 27 • SQL Injection is the act of querying or sending requests, otherwise known as questions, to a database. • Know Thy Database. Creating a Conversation with the Database
  • 29. From the table called users, check that the username Jo@influencer4lyfe.com.au is there and that Jo's password which is Influencerlyfe2019! also matches the password Jo supplied. Speaking in Database Tongue
  • 30.
  • 31. 30 SELECT * FROM Users WHERE user = Jo@influencer4lyfe.com.au and password = influencerlyfe2019! SQL Query 101
  • 32. 31 7 Steps to SQLi Heaven
  • 33. 32 1. Get the Database Language
  • 34. 33 1.1 Identify the Database Language Error Based SQL Injection
  • 35. SQLi Hunting in the Wilds of the Internet Google Dorks Query Format for advanced search in Google where-you-want-to search:keyword inurl: php?id= inurl – Get URL’s or website addresses
  • 37. SQLi Hunting in the Wilds of the Internet
  • 38. 37 Statement / Equation True or False 1 + 1= 2 True 2 +2 = 4 True 1=1 a=a True True Speaking in Truths
  • 39. 38 ' OR ‘1’ = ‘1 The Classic SQL Injection (SQLi)
  • 40. 39 1.2 Login without a username or password
  • 41. 40 2. Get the Contents of the Database You’re Currently Talking To
  • 42.
  • 43. 42 Database 101 ID Username Password Signature 1 admin adminpass g0t r00t? 2 adrian somepassword Zombie Films Rock! 3 john monkey ###### 4 jeremy password ###### 5 bryce password ###### 6 samurai samurai ###### 7 jim password ###### 8 bobby password ###### 9 simba password ###### ID Credit Card 1 543556770082 2 543599755432 3 543554332153 4 543555588882 5 543525252183 6 543576464648 7 5435111172934 8 543523232902 9 5435116373849
  • 44. 3. Count the columns to speak to other tables in the database (using ORDER BY) %3d is the = sign in URL language
  • 45. 3.1 Count the columns to speak to other tables in the database ‘ ORDER by 1# ‘ ORDER by 2# ‘ ORDER by 3# 3 Columns in the table
  • 46. 45 4. Checking for the vulnerable column
  • 47. 46 4. Checking for the vulnerable columns
  • 48. 47 4.2 Checking for the vulnerable column
  • 49. 48 5. Get the Database Version +union select 1,version(),3
  • 50. 49 6. Get the Database Name +union select database(),2,3
  • 51. 50 'UNION SELECT 1, group_concat(table_name) from information_schema.tables where table_schema=database()%23 7. Get all the other database names to talk to them too
  • 52. 51 3. Count the columns to speak to other tables in the database 4. Check for the vulnerable column 5. Get the database version 6. Get the database name 7. Get all the other database names to talk to them too. 1. Get the database to tell you the language it speaks 7 Steps to SQLi Heaven 2. Get the contents of the database you’re currently talking to
  • 54.
  • 55. 54 Fixing SQL Vulnerabilities 1. Never Trust the User - Validate all input on the user and server side
  • 56. 2. Input sanitisation - Clean it up before it is sent to the database
  • 57. 3. Parameterisation or pre-prepared statements.
  • 58.
  • 59.
  • 60. Thank-you for listening! That was: It’s Hammertime: SQL Injection For Beginners #CyberCon #W0m3nWh0HackM3lb0urn3 @Deloitte Dr. Brigitte Lewis | @briglewis I am

Notas del editor

  1. https://www.youtube.com/watch?v=8gbqued-9VQ
  2. Table name and database name
  3. Source: https://jqueryform.github.io/posts/html5-form-features-6.html
  4. https://www.youtube.com/watch?v=q8WSdypJ4WA