SlideShare a Scribd company logo
1 of 20
SQL Injection Attacks:
Is Your Data Secure?
| Bert Wagner | March 24, 2018
Objective
SQL injection prevention does not have an “easy” solution
Disclaimers
• Try this at home
• Not at work
• Not on other people’s systems
Background
• Business Intelligence Developer
• Tech security enthusiast
• Saw my first injection attempts in ~2001 – MySQL logs
Demo code and slides available at bertwagner.com
Overview
1. Importance of SQL injection protection
2. Dynamic SQL
3. What does SQL injection look like?
4. Common misconceptions
5. Preventing SQL injection
• Data Leaks
• Data Validity
• Server Availability
Dynamic SQL
“Just because you can, doesn’t mean you should.”
• Can’t parameterize
everything
• Adaptable Queries
• Performance
However…
What is SQL Injection?
• Dynamic string execution
• Unsanitized input (could be from a column or parameter)
• Performing something the query wasn’t originally intended to do
What is SQL Injection?
SQL injection can occur without concatenated parameters too
Let’s go back to 1998…
OWASP 2004
OWASP – Present Day
Common Misconceptions
“The structure of my
database isn’t public”
You don’t have a Users table? Products?
Inventory? etc...
“The Amazing Bert”
Common Misconceptions
“I obfuscate my table names”
sys.objects? Errors displayed in app?
Logs, emails, social engineering…?
Common Misconceptions
“The developers should validate, restrict output”
True. But multiple layers of security are better than one.
Front end validation doesn’t stop malicious users Server side validation stops some
Common Misconceptions
“I’m not important enough to get hacked”
Automated injection tools target everyone
https://github.com/sqlmapproject/sqlmap/wiki/Techniques
Common Misconceptions
“I use an ORM to code my SQL queries”
ORMs are still vulnerable if you need to pass an argument that can’t be
parameterized by SQL Server or if you use a vulnerable stored procedure
ORMs are vulnerable other ways too:
https://bertwagner.com/2018/03/06/2-5-ways-your-orm-will-allow-sql-injection/
Protecting Against SQL Injection
Must take a multi-layered approach.
Demos:
• Don’t write dynamic SQL
• sp_executesql
• QUOTENAME()
• REPLACE()
• EXECUTE AS
• Limit inputs
• Homoglyph attacks
• Proactively find injection vulnerabilities
Recap
• No easy, single-approach solution
• Validate, sanitize, escape
• Developers and DBAs both responsible
• Limit executing account privileges
• Use other software to help test, find vulnerabilities
Thank you!
@bertwagner
bertwagner.com
youtube.com/c/bertwagner
bert@bertwagner.com
20
New posts and videos
every Tuesday!

More Related Content

What's hot

So Your Company Hired A Pentester
So Your Company Hired A PentesterSo Your Company Hired A Pentester
So Your Company Hired A Pentester
NorthBayWeb
 

What's hot (13)

AWS Security Ideas - re:Invent 2016
AWS Security Ideas - re:Invent 2016AWS Security Ideas - re:Invent 2016
AWS Security Ideas - re:Invent 2016
 
Computer Network Simulation Projects Assistance
Computer Network Simulation Projects AssistanceComputer Network Simulation Projects Assistance
Computer Network Simulation Projects Assistance
 
Secured Development
Secured DevelopmentSecured Development
Secured Development
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
A5: Security Misconfiguration
A5: Security Misconfiguration A5: Security Misconfiguration
A5: Security Misconfiguration
 
OWASP Top Ten in Practice
OWASP Top Ten in PracticeOWASP Top Ten in Practice
OWASP Top Ten in Practice
 
Using Maslow's hierarchy of needs to define elegance in system architecture
Using Maslow's hierarchy of needs to define elegance in system architectureUsing Maslow's hierarchy of needs to define elegance in system architecture
Using Maslow's hierarchy of needs to define elegance in system architecture
 
12 steps to_cloud_security
12 steps to_cloud_security12 steps to_cloud_security
12 steps to_cloud_security
 
Entrepreneurship for hackers
Entrepreneurship for hackersEntrepreneurship for hackers
Entrepreneurship for hackers
 
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
Modernizing, Migrating & Mitigating - Moving to Modern Cloud & API Web Apps W...
 
So Your Company Hired A Pentester
So Your Company Hired A PentesterSo Your Company Hired A Pentester
So Your Company Hired A Pentester
 
Security testing
Security testingSecurity testing
Security testing
 
Secure your jenkins
Secure your jenkinsSecure your jenkins
Secure your jenkins
 

Similar to SQL Injection Attacks - Is Your Data Secure? SQL Saturday Rochester

Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin DunnNetworking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
North Texas Chapter of the ISSA
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
Brian Huff
 

Similar to SQL Injection Attacks - Is Your Data Secure? SQL Saturday Rochester (20)

How to Destroy a Database
How to Destroy a DatabaseHow to Destroy a Database
How to Destroy a Database
 
Web security
Web securityWeb security
Web security
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
 
Luis Grangeia IBWAS
Luis Grangeia IBWASLuis Grangeia IBWAS
Luis Grangeia IBWAS
 
IBWAS 2010: Web Security From an Auditor's Standpoint
IBWAS 2010: Web Security From an Auditor's StandpointIBWAS 2010: Web Security From an Auditor's Standpoint
IBWAS 2010: Web Security From an Auditor's Standpoint
 
Java application security the hard way - a workshop for the serious developer
Java application security the hard way - a workshop for the serious developerJava application security the hard way - a workshop for the serious developer
Java application security the hard way - a workshop for the serious developer
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSec
 
Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin DunnNetworking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
Networking 2016-06-14 - The Dirty Secrets of Enterprise Security by Kevin Dunn
 
Survey Presentation About Application Security
Survey Presentation About Application SecuritySurvey Presentation About Application Security
Survey Presentation About Application Security
 
Owasp tds
Owasp tdsOwasp tds
Owasp tds
 
Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)
 
Sql injection
Sql injectionSql injection
Sql injection
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More Safe
 
Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
 
Securing the continuous integration
Securing the continuous integrationSecuring the continuous integration
Securing the continuous integration
 
Practical Approach towards SQLi ppt
Practical Approach towards SQLi pptPractical Approach towards SQLi ppt
Practical Approach towards SQLi ppt
 
How to Test for The OWASP Top Ten
 How to Test for The OWASP Top Ten How to Test for The OWASP Top Ten
How to Test for The OWASP Top Ten
 
Geek Sync | Field Medic’s Guide to Database Mirroring
Geek Sync | Field Medic’s Guide to Database MirroringGeek Sync | Field Medic’s Guide to Database Mirroring
Geek Sync | Field Medic’s Guide to Database Mirroring
 

More from Bert Wagner

More from Bert Wagner (7)

DBAs vs Developers - JSON in SQL Server
DBAs vs Developers - JSON in SQL ServerDBAs vs Developers - JSON in SQL Server
DBAs vs Developers - JSON in SQL Server
 
DBAs vs Developers: JSON in SQL Server - CBusPASS
DBAs vs Developers: JSON in SQL Server - CBusPASSDBAs vs Developers: JSON in SQL Server - CBusPASS
DBAs vs Developers: JSON in SQL Server - CBusPASS
 
High Performance SSRS
High Performance SSRSHigh Performance SSRS
High Performance SSRS
 
DBAs vs Developers: JSON in SQL Server
DBAs vs Developers: JSON in SQL ServerDBAs vs Developers: JSON in SQL Server
DBAs vs Developers: JSON in SQL Server
 
JSON in SQL Server 2016
JSON in SQL Server 2016JSON in SQL Server 2016
JSON in SQL Server 2016
 
Json usage and performance in sql server 2016
Json usage and performance in sql server 2016Json usage and performance in sql server 2016
Json usage and performance in sql server 2016
 
High Performance SSRS
High Performance SSRSHigh Performance SSRS
High Performance SSRS
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
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
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

SQL Injection Attacks - Is Your Data Secure? SQL Saturday Rochester

Editor's Notes

  1. Hard to pin point exactly who first discovered SQL injection. DO know that in 1998 already appearing in hacker zines. This examples is showing a SQL query that’s variabalized in some app code
  2. - Web 2.0, shiny buttons and every company trying to make money online. Problem was, no one knew how to do security. Unless you had a really security conscious developer, you were out of luck. Open Web Application Security Project was formed because a group of people realized needed to create education, information about the types of attacks out there. Put together top 10 list In the initial years, these ranked by guessing/first hand experience – no statistics available SQL and other injection attacks ranked as #6.