Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

SQL Injection: Nisa Ali Roll#-22011556089

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

SQL Injection

Nisa Ali

Roll#-22011556089
Introduction
 What is SQL Injection?

 Relation with sql and database

 Types of sqli

 Methodology of sqli

 what are the tools?

 How to perform?
Relationship with sql &
DB
 Importance of database for sql

 Security of a website depends on

 Overview of sql
Example Website
Example Website

Ali
1234

SELECT * FROM `login` WHERE `user`=‘ali’ AND `pass`=‘1234’


Login Database Table
user pass
Ali 1234

Let the name of the table is user_table


What is SQL Injection?
 Code Injection Technique

 Most common website attack

 Exploits Security Vulnerability

 Uses malicious sql code for backend


database manulplation
Syntax of query
Important Syntax
Select * from table where u=' ' & p=' '
LOGIC: ‘a’=‘a’
Example: SELECT * FROM `table` WHERE ‘a’=‘a’

MULTI STATEMENTS: S1; S2


Example: SELECT * FROM `table`; DROP TABLE `table`;
Example Hack

’ OR ‘a’=‘a
’ OR ‘a’=‘a

SELECT * FROM `login` WHERE `user`=‘’ OR ‘a’=‘a’ AND


`pass`=‘’ OR ‘a’=‘a’
All Queries are Possible
SELECT * FROM `login` WHERE `user`=‘’; INSERT INTO
`login` ('user','pass') VALUES ('haxor','whatever');--’ AND
`pass`=‘’

SELECT * FROM `login` WHERE `user`=‘’; UPDATE `login`


SET `pass`=‘pass123’ WHERE `user`=‘timbo317’;--’ AND
`pass`=‘’
Types of sqli
Types of sqli
Sqli

In-band sqli Inferential


sqli

1. Error based sqli 1.Bolean base sqli

2. Union based sqli 2.time based sqli


Error based sqli
 Relies on error messages
 Thrown by the database server
 To obtain information

 About the structure of the database


Union based
sqli

1. Leverages the Union sql


operator
2. To combine result of
two/more statement or
select statement.
3. Which is returned as
part of http response
Inferential Sqli / blind
sqli
 Also known as blind sqli

 It is more time taking

 Bolean-based blind sqli

 Time-base blind sqli


Bolean base
blind sqli
1.Relies on sending sql query
to the database

2.Which force the


application to return
different results

3.depend on query type


( true or false)
Time base
blind sqli
1. Forces the database to wait
for specific time

2. Response time will indicate


the result of true or false
query

3. This attract is typically slow


Sqli methodology

Understand
website Try to
working generate
Search for errors and
Prevention
 input valid and parametrized queries

 Conduct continuous scanning and penetrating testing

 Enforce least privilege access

You might also like