SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Presented by
Sandeep Kumbhar
M.Tech (CSE), RNSIT
 Introduction
 Types of SQL Injection
 Approaches to detect SQL Injection
 How to prevent SQL Injection
 Conclusion
Dept. of CSE, RNSIT 2012
➢What is SQL Injection?
1
Dept. of CSE, RNSIT 2012
2
Dept. of CSE, RNSIT 2012
➢ Tautology
Example –
Select * from <tablename>
where userId = <id> and password = <wrongPassword> or 1=1;
➢ Logically incorrect queries
Example –
Select * from <tablename>
where userId = ‘xyz”” and password = <wrongPassword> or 1=1;
3
Dept. of CSE, RNSIT 2012
➢ Union queries
➢ Piggy-backed queries
4
Dept. of CSE, RNSIT 2012
➢ Stored Procedures
Example –
Select * from <tablename>
where userId = <id> and password = <Password> or 1=1; SHUTDOWN;
➢ Blind Injection
Example-
SELECT name FROM <tablename> WHERE id=<username> and 1 =0 -- AND pass =
SELECT name FROM <tablename> WHERE id=<username> and 1 = 1 -- AND pass =
5
Dept. of CSE, RNSIT 2012
➢ Timing Attacks
Example-
Declare @s varchar(500)
select @s = db_nameO
if (ascii(substring(@s, I, I)) & ( power(3, 0))) > O waitfor delay '0:0:10‘
➢ Alternate Encoding
Example-
SELECT name FROM <tablename> WHERE id=’’and
password=O;exec(char(O x73687574646j776e))
6
Dept. of CSE, RNSIT 2012
 Mechanism to detect SQL injection attacks.
 Knowledge of SQL injection vulnerabilities in web
applications.
 IDS Approach
◦ Generic Signature
◦ Accurate & Taint Propagation
◦ Syntax-aware evaluation
◦ Minimal Deployment Requirements
7
Dept. of CSE, RNSIT 2012
Dept. of CSE, RNSIT 2012 8
Fig-1: Identification of trusted and untrusted data
Dept. of CSE, RNSIT 2012 9
Fig-2 shows the SQL Injection Detection Process
 For Database Administration
1. Install the database on a different machine than the Web server or
application server.
2. Disable all the default accounts and passwords disabled, including the
super-user account
3. Create user account that has the minimum privileges necessary for that
application to access the data.
4. Identify the list of SQL statements that will be used by the application
and only allow such SQL statements, e.g. Select, Insert, Update, etc.
5. Use read-only views for SQL statements that do not require any inserts
or updates, e.g. Search functionality or Login functionality
10
Dept. of CSE, RNSIT 2012
 For Developer
1. Sanitize the input by validating it in your code
2. Use parameterized queries instead of dynamic queries.
For example: in Java, use Prepared Statement instead of Statement Object
3.Employ proper error handling and logging within the application so that a
database error or any other type of technical information is not revealed to
the user
4. Choose names for tables and fields that are not easy to guess
5. Use stored procedures instead of raw SQL wherever possible
11
Dept. of CSE, RNSIT 2012
 Security is still one of the major issues all across the globe.
 It is not difficult to prevent SQL injection attacks.
 Developer training has been very helpful in increasing their
understanding of website vulnerabilities and the extent of
damage they can do.
Dept. of CSE, RNSIT 2012 12
“Precaution is better than cure.”
13
Dept. of CSE, RNSIT 2012
[1] A. Baranwal Approaches To Detect SQLinjection and XSS in Web Application
EECE 571B, Term Survey Paper, April 2012
[2] Protect your Websites from SQL Injection Attacks February 2010 Anurag Agarwal
Director of Education Services, WhiteHat Security www.whitehatsec.com
[3] A. SRAVANTHI* et al. ISSN: 2250–3676 [IJESAT] International Journal Of
Engineering Science & Advanced Technology Volume-2, Issue-3, 664 – 671
[4] http://www.owasp.org/index.php/Top_10_2010-A1-Injection, retrieved on
13/01/2010
14
Dept. of CSE, RNSIT 2012
Approaches to detect and prevent sql injection in web applications

Weitere ähnliche Inhalte

Ähnlich wie Approaches to detect and prevent sql injection in web applications

Ijeee 51-57-preventing sql injection attacks in web application
Ijeee 51-57-preventing sql injection attacks in web applicationIjeee 51-57-preventing sql injection attacks in web application
Ijeee 51-57-preventing sql injection attacks in web application
Kumar Goud
 
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
BenitoSumpter862
 
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
SantosConleyha
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReportSalemPhilip_ResearchReport
SalemPhilip_ResearchReport
Philip Salem
 
SQL Server 2012 Security Task
SQL Server 2012 Security TaskSQL Server 2012 Security Task
SQL Server 2012 Security Task
Yaakub Idris
 

Ähnlich wie Approaches to detect and prevent sql injection in web applications (20)

Don't get stung - an introduction to the OWASP Top 10
Don't get stung - an introduction to the OWASP Top 10Don't get stung - an introduction to the OWASP Top 10
Don't get stung - an introduction to the OWASP Top 10
 
Oracle Security Presentation
Oracle Security PresentationOracle Security Presentation
Oracle Security Presentation
 
Ijeee 51-57-preventing sql injection attacks in web application
Ijeee 51-57-preventing sql injection attacks in web applicationIjeee 51-57-preventing sql injection attacks in web application
Ijeee 51-57-preventing sql injection attacks in web application
 
Top 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security ProblemsTop 10 Bad Coding Practices Lead to Security Problems
Top 10 Bad Coding Practices Lead to Security Problems
 
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
 
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili10h 35m remaining CHAPTER 12 Common Software Vulnerabili
10h 35m remaining CHAPTER 12 Common Software Vulnerabili
 
Literature Survey on Web based Recognition of SQL Injection Attacks
Literature Survey on Web based Recognition of SQL Injection AttacksLiterature Survey on Web based Recognition of SQL Injection Attacks
Literature Survey on Web based Recognition of SQL Injection Attacks
 
A Study on Detection and Prevention of SQL Injection Attack
A Study on Detection and Prevention of SQL Injection AttackA Study on Detection and Prevention of SQL Injection Attack
A Study on Detection and Prevention of SQL Injection Attack
 
Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)
 
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
 
Sql Injection
Sql InjectionSql Injection
Sql Injection
 
Web Security: SQL Injection
Web Security: SQL InjectionWeb Security: SQL Injection
Web Security: SQL Injection
 
SalemPhilip_ResearchReport
SalemPhilip_ResearchReportSalemPhilip_ResearchReport
SalemPhilip_ResearchReport
 
Prevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML DatabasePrevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML Database
 
Ijcatr04041018
Ijcatr04041018Ijcatr04041018
Ijcatr04041018
 
ASP.NET Web Security
ASP.NET Web SecurityASP.NET Web Security
ASP.NET Web Security
 
Arved sandstrom - the rotwithin - atlseccon2011
Arved sandstrom - the rotwithin - atlseccon2011Arved sandstrom - the rotwithin - atlseccon2011
Arved sandstrom - the rotwithin - atlseccon2011
 
SQL Server 2012 Security Task
SQL Server 2012 Security TaskSQL Server 2012 Security Task
SQL Server 2012 Security Task
 
SQL Injection - Newsletter
SQL Injection - NewsletterSQL Injection - Newsletter
SQL Injection - Newsletter
 
SQL INJECTION ATTACKS.pptx
SQL INJECTION ATTACKS.pptxSQL INJECTION ATTACKS.pptx
SQL INJECTION ATTACKS.pptx
 

Kürzlich hochgeladen

在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
F
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 

Kürzlich hochgeladen (20)

Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 

Approaches to detect and prevent sql injection in web applications

  • 2.  Introduction  Types of SQL Injection  Approaches to detect SQL Injection  How to prevent SQL Injection  Conclusion Dept. of CSE, RNSIT 2012
  • 3. ➢What is SQL Injection? 1 Dept. of CSE, RNSIT 2012
  • 4. 2 Dept. of CSE, RNSIT 2012
  • 5. ➢ Tautology Example – Select * from <tablename> where userId = <id> and password = <wrongPassword> or 1=1; ➢ Logically incorrect queries Example – Select * from <tablename> where userId = ‘xyz”” and password = <wrongPassword> or 1=1; 3 Dept. of CSE, RNSIT 2012
  • 6. ➢ Union queries ➢ Piggy-backed queries 4 Dept. of CSE, RNSIT 2012
  • 7. ➢ Stored Procedures Example – Select * from <tablename> where userId = <id> and password = <Password> or 1=1; SHUTDOWN; ➢ Blind Injection Example- SELECT name FROM <tablename> WHERE id=<username> and 1 =0 -- AND pass = SELECT name FROM <tablename> WHERE id=<username> and 1 = 1 -- AND pass = 5 Dept. of CSE, RNSIT 2012
  • 8. ➢ Timing Attacks Example- Declare @s varchar(500) select @s = db_nameO if (ascii(substring(@s, I, I)) & ( power(3, 0))) > O waitfor delay '0:0:10‘ ➢ Alternate Encoding Example- SELECT name FROM <tablename> WHERE id=’’and password=O;exec(char(O x73687574646j776e)) 6 Dept. of CSE, RNSIT 2012
  • 9.  Mechanism to detect SQL injection attacks.  Knowledge of SQL injection vulnerabilities in web applications.  IDS Approach ◦ Generic Signature ◦ Accurate & Taint Propagation ◦ Syntax-aware evaluation ◦ Minimal Deployment Requirements 7 Dept. of CSE, RNSIT 2012
  • 10. Dept. of CSE, RNSIT 2012 8 Fig-1: Identification of trusted and untrusted data
  • 11. Dept. of CSE, RNSIT 2012 9 Fig-2 shows the SQL Injection Detection Process
  • 12.  For Database Administration 1. Install the database on a different machine than the Web server or application server. 2. Disable all the default accounts and passwords disabled, including the super-user account 3. Create user account that has the minimum privileges necessary for that application to access the data. 4. Identify the list of SQL statements that will be used by the application and only allow such SQL statements, e.g. Select, Insert, Update, etc. 5. Use read-only views for SQL statements that do not require any inserts or updates, e.g. Search functionality or Login functionality 10 Dept. of CSE, RNSIT 2012
  • 13.  For Developer 1. Sanitize the input by validating it in your code 2. Use parameterized queries instead of dynamic queries. For example: in Java, use Prepared Statement instead of Statement Object 3.Employ proper error handling and logging within the application so that a database error or any other type of technical information is not revealed to the user 4. Choose names for tables and fields that are not easy to guess 5. Use stored procedures instead of raw SQL wherever possible 11 Dept. of CSE, RNSIT 2012
  • 14.  Security is still one of the major issues all across the globe.  It is not difficult to prevent SQL injection attacks.  Developer training has been very helpful in increasing their understanding of website vulnerabilities and the extent of damage they can do. Dept. of CSE, RNSIT 2012 12
  • 15. “Precaution is better than cure.” 13 Dept. of CSE, RNSIT 2012
  • 16. [1] A. Baranwal Approaches To Detect SQLinjection and XSS in Web Application EECE 571B, Term Survey Paper, April 2012 [2] Protect your Websites from SQL Injection Attacks February 2010 Anurag Agarwal Director of Education Services, WhiteHat Security www.whitehatsec.com [3] A. SRAVANTHI* et al. ISSN: 2250–3676 [IJESAT] International Journal Of Engineering Science & Advanced Technology Volume-2, Issue-3, 664 – 671 [4] http://www.owasp.org/index.php/Top_10_2010-A1-Injection, retrieved on 13/01/2010 14 Dept. of CSE, RNSIT 2012