SlideShare a Scribd company logo
1 of 24
Sania: Syntactic and SemanticAnalysis for Automated Testingagainst SQL Injection Yuji Kosuga, Keio University  In cooperation with Miho Hishiyama, Yu Takahama IX Knowledge Inc. Kenji Kono, Miyuki Hanaoka Keio University
What is an SQL Injection Attack? A security exploit for web applications that uses webpages with dynamic content An attacker can add arbitrary SQL commands  	that will be executed against the database query = “SELECT * FROM account WHERE name = '”           + request.getParameter(“name”)     + “' AND password = '” + request.getParameter(“pass”) + “'”; ' OR 'a'= 'a TRUE    SELECT * FROM account WHERE    name = 'badguy'AND password = '' OR 'a'= 'a' left expr. right expr. database ,[object Object],[object Object]
Issues with Sanitizing Sanitizing is a sufficient measure to prevent SQL injection attacks, but… There are recent reports of SQL injection attacks 28% of all the reported vulnerabilities [Armorize Technologies 2006]  14% of all the reported vulnerabilities [Mitre 2006] What is actually causing these results? Sanitizing program is manually written without any supporting tools  Checking for maliciously crafted inputs is not done well enough to detect vulnerabilities
Related Approaches SQLCheck [Su and Wassermann ’06] Validate SQL queries by comparing them to a legal model Require the developer to manually insert special markers to  discover user inputs in SQL queries SQLrand [Boyd and Keromytis ’04] Assure an SQL keyword injected by an attacker will not be embedded into SQL queries Assume the attackers will not discover the secret key Learning-Based Detection [Valeur et al. ’05] Employ an intrusion detection system (IDS), which is trained using a set of legal SQL queries The IDS quality depends on the quality of the training set
Our Approach: Sania Check for SQL injection vulnerabilities in the development and debugging phases Intercept SQL queries as well as HTTP requests By using the SQL queries Automatically generate powerful attacks Assess the security by comparing the syntax of the parse tree  	of the intended SQL query to those resulting after an attack Sania vs. Paros Sania can find more  	vulnerabilities and caused  	fewer false positives
Design of Sania Web application Innocent  HTTP Request Correct SQL Packets database Attacks client 1. Finding target spots 2. Crafting attacks 3. Tree validation Sania Innocent packets 1. Finding target spots Malicious packets 2. Crafting attacks 3. Tree validation
Design of Sania Web application Innocent  HTTP Request Correct SQL Packets database client 1. Finding target spots Sania Innocent packets 1. Finding target spots
Finding Target Spots Web application query-string 999 999 xxx xxx id=  &name=   &action=login target target safe  SELECT * FROM users WHERE id=            AND name= SQL query 999 ‘xxx’ Target spots are vulnerable values that appear on the leaf nodes of the parse tree
Design of Sania Web application Innocent  HTTP Request Correct SQL Packets database client 1. Finding target spots 2. Crafting attacks Sania Innocent packets 1. Finding target spots 2. Crafting attacks
Crafting Attack Requests Web application query-string id=999&name=xxx&action=login target target safe int string int string  SELECT * FROM users WHERE id=            AND name= SQL query 999 ‘xxx’ Sania recognizes the context of the target spots by analyzing the syntax of the SQL query Non-terminal nodes of SQL parse tree can be classified 95 contexts Sania generates two types of attacks Linear attacks	     : one target spot at a time Combination attacks : two or more target spots at the same time
Linear Attacks Web application target spots attack code id=999 id=999 or 1=1-- int true  SELECT * FROM users WHERE id=999or 1=1-- AND name=xxx SQL query comment out Web application target spots attack code name=xxx name=’ or ‘1’=‘1 string  SELECT * FROM users WHERE id= 999 AND name=‘’ or ‘1’=‘1’ true SQL query left expr. right expr. Sania generates attack codes according to the context of the target spot
Generating an Attack Code stringRule ,[object Object],	blank 	… ,[object Object]
 parentheses: yes
 inseredSQL: 	or ‘1’=‘1 	or “1”=“1 	or 1=1-- 	… <rule name="stringRule">      <element name="formerStr" userInput="on">           <code value="" />
      </element>
      <element name="quote" value="on"/>      <element name="parenthesis" value="on"/>      <element name="latterStr" userInput="off">           <code value="or '1'='1" />           <code value="or "1"="1"/>
           <code value="or 1=1--" />           <code value="or 1=1;--" />      </element> </rule> Attack rules rule context int defaultRule mathRule numberRule defaultRule stringRule string An attack code is dynamically generated using attack rules An attack rule defines Structure of an attack code that will be inserted into a target spot Whether or not quotes and parentheses will be used A list of attack rules are written in XML Easy to add new attack rules
Combination Attacks Web application query-string syntax ofANDstatement name=xxx&pass=zzz target target WHEREname=‘xxx’AND password=‘zzz’ left expr. right  expr. innocent session query-string syntax ofORstatement name=amp;pass=OR 1=1-- WHEREname=‘ AND password=’OR 1=1--’ left expr. right  expr. attack session ,[object Object],[object Object]
Tree Validation SQL query SQL query user input Web application Web application SELECT * FROM… SELECT * FROM… SELECT * FROM… Parse tree generated  from an innocent request Properly sanitized  parse tree Improperly sanitized  parse tree A properly sanitized parse tree has the same syntax An improperly sanitized parse tree has different syntax
Implementation 13,000 LOC in Java 21 attack rules (1,800 LOC in XML) for 95 contexts Test results are output in an HTML/XML document RSS feed is also available
Demo Testing the Login Page of a Web Application
Experiments We evaluated the effectiveness of our technique Subjects E-learning Provided by IX Knowledge Inc. It has been used in an intranet before Bookstore, Portal, Event, Classifieds, Employee Directory Free open-source applications from GotoCode We found they have been used in the real world Comparison with Paros Paros is a web application scanner, which took the 2nd place 	in web vulnerability scanner ranking in Insecure.Org
Comparison of Sania and Paros Targeting User Inputs Sania identifies inputs that appear in SQL queries Paros regards all user inputs as vulnerable Generating Attacks Sania generates its attacks based on syntax of SQL queries Paros applies attack codes to all user inputs Combination attack Sania can attack several spots at the same time Paros can not generate combination attacks  Determining Vulnerability Sania compares the syntax of SQL queries Paros compares the content of HTTP responses
Evaluation Sania detected more vulnerabilities and gave significantly fewer false positives with fewer trials than Paros
False Positives Sania caused 13 false positives Invalid Data The attack code did not meet the length requirements Sania is unaware of the database structure Need to design a way to learn the structure of the database Authentication Failed The password and confirmation fields did not match Sania does not know which user inputs must share the same data Need to include a function that tells Sania which user inputs require the same data input
Testing a real product We had a chance to test a production-quality web application just before being shipped Subject: RSS-Dripper Provides RSS information to users based on their previous choices Written in JSP and Java Servlet Work on Struts Results One vulnerability was detected after 33 attacks Vulnerable to a combination attack We confirmed it was truly vulnerable
Conclusion Sania’s Technique Used during the development or debugging phases Create powerful attacks based on the context of SQL query Detect vulnerabilities by syntax-comparison of parse trees Sania’s Effectiveness Out-performed the presently highest rated tool that tests for SQL injection attacks Next Steps Implement techniques to reduce false positives  Adapt our technique to detect other injection vulnerabilities, such as XSS, XPath Injection, OS Injection attacks

More Related Content

What's hot

Prevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguagePrevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguageIRJET Journal
 
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...IJECEIAES
 
Seminar2015Bilic_Nicole
Seminar2015Bilic_NicoleSeminar2015Bilic_Nicole
Seminar2015Bilic_NicoleNicole Bili?
 
Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730chadtindel
 
vulnerability scanning and reporting tool
vulnerability scanning and reporting toolvulnerability scanning and reporting tool
vulnerability scanning and reporting toolBhagyashri Chalakh
 
Lessons Learned From the Yahoo! Hack
Lessons Learned From the Yahoo! HackLessons Learned From the Yahoo! Hack
Lessons Learned From the Yahoo! HackImperva
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applicationsphanleson
 
How "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersHow "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersChema Alonso
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)theijes
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Moataz Kamel
 
Attackers Vs Programmers
Attackers Vs ProgrammersAttackers Vs Programmers
Attackers Vs Programmersrobin_bene
 
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...IRJET Journal
 
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 applicationKumar Goud
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practicesNeoito
 
Prevention of SQL injection in E- Commerce
Prevention of SQL injection in E- CommercePrevention of SQL injection in E- Commerce
Prevention of SQL injection in E- Commerceijceronline
 

What's hot (20)

Prevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host LanguagePrevention of SQL Injection Attack in Web Application with Host Language
Prevention of SQL Injection Attack in Web Application with Host Language
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software Engineering
 
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
ImageSubXSS: an image substitute technique to prevent Cross-Site Scripting at...
 
Seminar2015Bilic_Nicole
Seminar2015Bilic_NicoleSeminar2015Bilic_Nicole
Seminar2015Bilic_Nicole
 
Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730
 
vulnerability scanning and reporting tool
vulnerability scanning and reporting toolvulnerability scanning and reporting tool
vulnerability scanning and reporting tool
 
Lessons Learned From the Yahoo! Hack
Lessons Learned From the Yahoo! HackLessons Learned From the Yahoo! Hack
Lessons Learned From the Yahoo! Hack
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
Sql
SqlSql
Sql
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
How "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scannersHow "·$% developers defeat the web vulnerability scanners
How "·$% developers defeat the web vulnerability scanners
 
The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)
 
Web application security
Web application securityWeb application security
Web application security
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
1738 1742
1738 17421738 1742
1738 1742
 
Attackers Vs Programmers
Attackers Vs ProgrammersAttackers Vs Programmers
Attackers Vs Programmers
 
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...
IRJET- An Efficient Technique for Finding SQL Injection using Reverse Proxy S...
 
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
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
Prevention of SQL injection in E- Commerce
Prevention of SQL injection in E- CommercePrevention of SQL injection in E- Commerce
Prevention of SQL injection in E- Commerce
 

Viewers also liked

Unmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
Unmasking Anonymous: An Eyewitness Account of a Hacktivist AttackUnmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
Unmasking Anonymous: An Eyewitness Account of a Hacktivist AttackImperva
 
Autonomous Hacking: The New Frontiers of Attack and Defense
Autonomous Hacking: The New Frontiers of Attack and DefenseAutonomous Hacking: The New Frontiers of Attack and Defense
Autonomous Hacking: The New Frontiers of Attack and DefensePriyanka Aash
 
Fuzzing 101 Webinar on Zero Day Management
Fuzzing 101 Webinar on Zero Day ManagementFuzzing 101 Webinar on Zero Day Management
Fuzzing 101 Webinar on Zero Day ManagementCodenomicon
 
Blending Automated and Manual Testing
Blending Automated and Manual TestingBlending Automated and Manual Testing
Blending Automated and Manual TestingDenim Group
 
Software Security Education at Scale
Software Security Education at ScaleSoftware Security Education at Scale
Software Security Education at ScaleChris Theisen
 
Automated Attack Surface Approximation [FSE - SRC 2015]
Automated Attack Surface Approximation [FSE - SRC 2015]Automated Attack Surface Approximation [FSE - SRC 2015]
Automated Attack Surface Approximation [FSE - SRC 2015]Chris Theisen
 
A DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityA DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityImperva Incapsula
 
Attacks Against Captcha Systems - DefCamp 2012
Attacks Against Captcha Systems - DefCamp 2012Attacks Against Captcha Systems - DefCamp 2012
Attacks Against Captcha Systems - DefCamp 2012DefCamp
 
DefCamp 2013 - In vehicle CAN network security
DefCamp 2013 - In vehicle CAN network securityDefCamp 2013 - In vehicle CAN network security
DefCamp 2013 - In vehicle CAN network securityDefCamp
 
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)Security Strategy and Tactic with Cyber Threat Intelligence (CTI)
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)Priyanka Aash
 
Keynote Session : Kill The Password
Keynote Session : Kill The PasswordKeynote Session : Kill The Password
Keynote Session : Kill The PasswordPriyanka Aash
 
Automated and Effective Testing of Web Services for XML Injection Attacks
Automated and Effective Testing of Web Services for XML Injection AttacksAutomated and Effective Testing of Web Services for XML Injection Attacks
Automated and Effective Testing of Web Services for XML Injection AttacksLionel Briand
 
Crowd-Sourced Threat Intelligence
Crowd-Sourced Threat IntelligenceCrowd-Sourced Threat Intelligence
Crowd-Sourced Threat IntelligenceAlienVault
 
Implementing An Automated Incident Response Architecture
Implementing An Automated Incident Response ArchitectureImplementing An Automated Incident Response Architecture
Implementing An Automated Incident Response ArchitecturePriyanka Aash
 

Viewers also liked (14)

Unmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
Unmasking Anonymous: An Eyewitness Account of a Hacktivist AttackUnmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
Unmasking Anonymous: An Eyewitness Account of a Hacktivist Attack
 
Autonomous Hacking: The New Frontiers of Attack and Defense
Autonomous Hacking: The New Frontiers of Attack and DefenseAutonomous Hacking: The New Frontiers of Attack and Defense
Autonomous Hacking: The New Frontiers of Attack and Defense
 
Fuzzing 101 Webinar on Zero Day Management
Fuzzing 101 Webinar on Zero Day ManagementFuzzing 101 Webinar on Zero Day Management
Fuzzing 101 Webinar on Zero Day Management
 
Blending Automated and Manual Testing
Blending Automated and Manual TestingBlending Automated and Manual Testing
Blending Automated and Manual Testing
 
Software Security Education at Scale
Software Security Education at ScaleSoftware Security Education at Scale
Software Security Education at Scale
 
Automated Attack Surface Approximation [FSE - SRC 2015]
Automated Attack Surface Approximation [FSE - SRC 2015]Automated Attack Surface Approximation [FSE - SRC 2015]
Automated Attack Surface Approximation [FSE - SRC 2015]
 
A DevOps Guide to Web Application Security
A DevOps Guide to Web Application SecurityA DevOps Guide to Web Application Security
A DevOps Guide to Web Application Security
 
Attacks Against Captcha Systems - DefCamp 2012
Attacks Against Captcha Systems - DefCamp 2012Attacks Against Captcha Systems - DefCamp 2012
Attacks Against Captcha Systems - DefCamp 2012
 
DefCamp 2013 - In vehicle CAN network security
DefCamp 2013 - In vehicle CAN network securityDefCamp 2013 - In vehicle CAN network security
DefCamp 2013 - In vehicle CAN network security
 
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)Security Strategy and Tactic with Cyber Threat Intelligence (CTI)
Security Strategy and Tactic with Cyber Threat Intelligence (CTI)
 
Keynote Session : Kill The Password
Keynote Session : Kill The PasswordKeynote Session : Kill The Password
Keynote Session : Kill The Password
 
Automated and Effective Testing of Web Services for XML Injection Attacks
Automated and Effective Testing of Web Services for XML Injection AttacksAutomated and Effective Testing of Web Services for XML Injection Attacks
Automated and Effective Testing of Web Services for XML Injection Attacks
 
Crowd-Sourced Threat Intelligence
Crowd-Sourced Threat IntelligenceCrowd-Sourced Threat Intelligence
Crowd-Sourced Threat Intelligence
 
Implementing An Automated Incident Response Architecture
Implementing An Automated Incident Response ArchitectureImplementing An Automated Incident Response Architecture
Implementing An Automated Incident Response Architecture
 

Similar to Sania: Syntactic and Semantic Analysis for Automated Testing against SQL Injection - ACSAC 2007

Top web apps security vulnerabilities
Top web apps security vulnerabilitiesTop web apps security vulnerabilities
Top web apps security vulnerabilitiesAleksandar Bozinovski
 
Web security 2010
Web security 2010Web security 2010
Web security 2010Alok Babu
 
Ruby Security
Ruby SecurityRuby Security
Ruby SecuritySHC
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingAnurag Srivastava
 
Hackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingHackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingAkash Mahajan
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesMarco Morana
 
DEFCON 23 - Lance buttars Nemus - sql injection on lamp
DEFCON 23 - Lance buttars Nemus - sql injection on lampDEFCON 23 - Lance buttars Nemus - sql injection on lamp
DEFCON 23 - Lance buttars Nemus - sql injection on lampFelipe Prado
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSSMike Crabb
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptSilverGold16
 
香港六合彩
香港六合彩香港六合彩
香港六合彩baoyin
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks Ahmed Sherif
 
OWASP Top 10 (2010 release candidate 1)
OWASP Top 10 (2010 release candidate 1)OWASP Top 10 (2010 release candidate 1)
OWASP Top 10 (2010 release candidate 1)Jeremiah Grossman
 
Application Security Part 1 Threat Defense In Client Server Applications ...
Application Security   Part 1   Threat Defense In Client Server Applications ...Application Security   Part 1   Threat Defense In Client Server Applications ...
Application Security Part 1 Threat Defense In Client Server Applications ...Greg Sohl
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security RisksSperasoft
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure codeMiva
 
Sql injection
Sql injection Sql injection
Sql injection Aaron Hill
 

Similar to Sania: Syntactic and Semantic Analysis for Automated Testing against SQL Injection - ACSAC 2007 (20)

ASP.NET security vulnerabilities
ASP.NET security vulnerabilitiesASP.NET security vulnerabilities
ASP.NET security vulnerabilities
 
Top web apps security vulnerabilities
Top web apps security vulnerabilitiesTop web apps security vulnerabilities
Top web apps security vulnerabilities
 
Web security 2010
Web security 2010Web security 2010
Web security 2010
 
Ruby Security
Ruby SecurityRuby Security
Ruby Security
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration Testing
 
Hackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingHackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web Programming
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root Causes
 
ASP.NET Web Security
ASP.NET Web SecurityASP.NET Web Security
ASP.NET Web Security
 
DEFCON 23 - Lance buttars Nemus - sql injection on lamp
DEFCON 23 - Lance buttars Nemus - sql injection on lampDEFCON 23 - Lance buttars Nemus - sql injection on lamp
DEFCON 23 - Lance buttars Nemus - sql injection on lamp
 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 
Security Tech Talk
Security Tech TalkSecurity Tech Talk
Security Tech Talk
 
香港六合彩
香港六合彩香港六合彩
香港六合彩
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks
 
FORENSIC PRESTTN
FORENSIC PRESTTNFORENSIC PRESTTN
FORENSIC PRESTTN
 
OWASP Top 10 (2010 release candidate 1)
OWASP Top 10 (2010 release candidate 1)OWASP Top 10 (2010 release candidate 1)
OWASP Top 10 (2010 release candidate 1)
 
Application Security Part 1 Threat Defense In Client Server Applications ...
Application Security   Part 1   Threat Defense In Client Server Applications ...Application Security   Part 1   Threat Defense In Client Server Applications ...
Application Security Part 1 Threat Defense In Client Server Applications ...
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security Risks
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure code
 
Sql injection
Sql injection Sql injection
Sql injection
 

Recently uploaded

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
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
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
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...
 

Sania: Syntactic and Semantic Analysis for Automated Testing against SQL Injection - ACSAC 2007

  • 1. Sania: Syntactic and SemanticAnalysis for Automated Testingagainst SQL Injection Yuji Kosuga, Keio University In cooperation with Miho Hishiyama, Yu Takahama IX Knowledge Inc. Kenji Kono, Miyuki Hanaoka Keio University
  • 2.
  • 3. Issues with Sanitizing Sanitizing is a sufficient measure to prevent SQL injection attacks, but… There are recent reports of SQL injection attacks 28% of all the reported vulnerabilities [Armorize Technologies 2006] 14% of all the reported vulnerabilities [Mitre 2006] What is actually causing these results? Sanitizing program is manually written without any supporting tools Checking for maliciously crafted inputs is not done well enough to detect vulnerabilities
  • 4. Related Approaches SQLCheck [Su and Wassermann ’06] Validate SQL queries by comparing them to a legal model Require the developer to manually insert special markers to discover user inputs in SQL queries SQLrand [Boyd and Keromytis ’04] Assure an SQL keyword injected by an attacker will not be embedded into SQL queries Assume the attackers will not discover the secret key Learning-Based Detection [Valeur et al. ’05] Employ an intrusion detection system (IDS), which is trained using a set of legal SQL queries The IDS quality depends on the quality of the training set
  • 5. Our Approach: Sania Check for SQL injection vulnerabilities in the development and debugging phases Intercept SQL queries as well as HTTP requests By using the SQL queries Automatically generate powerful attacks Assess the security by comparing the syntax of the parse tree of the intended SQL query to those resulting after an attack Sania vs. Paros Sania can find more vulnerabilities and caused fewer false positives
  • 6. Design of Sania Web application Innocent HTTP Request Correct SQL Packets database Attacks client 1. Finding target spots 2. Crafting attacks 3. Tree validation Sania Innocent packets 1. Finding target spots Malicious packets 2. Crafting attacks 3. Tree validation
  • 7. Design of Sania Web application Innocent HTTP Request Correct SQL Packets database client 1. Finding target spots Sania Innocent packets 1. Finding target spots
  • 8. Finding Target Spots Web application query-string 999 999 xxx xxx id= &name= &action=login target target safe SELECT * FROM users WHERE id= AND name= SQL query 999 ‘xxx’ Target spots are vulnerable values that appear on the leaf nodes of the parse tree
  • 9. Design of Sania Web application Innocent HTTP Request Correct SQL Packets database client 1. Finding target spots 2. Crafting attacks Sania Innocent packets 1. Finding target spots 2. Crafting attacks
  • 10. Crafting Attack Requests Web application query-string id=999&name=xxx&action=login target target safe int string int string SELECT * FROM users WHERE id= AND name= SQL query 999 ‘xxx’ Sania recognizes the context of the target spots by analyzing the syntax of the SQL query Non-terminal nodes of SQL parse tree can be classified 95 contexts Sania generates two types of attacks Linear attacks : one target spot at a time Combination attacks : two or more target spots at the same time
  • 11. Linear Attacks Web application target spots attack code id=999 id=999 or 1=1-- int true SELECT * FROM users WHERE id=999or 1=1-- AND name=xxx SQL query comment out Web application target spots attack code name=xxx name=’ or ‘1’=‘1 string SELECT * FROM users WHERE id= 999 AND name=‘’ or ‘1’=‘1’ true SQL query left expr. right expr. Sania generates attack codes according to the context of the target spot
  • 12.
  • 14. inseredSQL: or ‘1’=‘1 or “1”=“1 or 1=1-- … <rule name="stringRule"> <element name="formerStr" userInput="on"> <code value="" /> </element> <element name="quote" value="on"/> <element name="parenthesis" value="on"/> <element name="latterStr" userInput="off"> <code value="or '1'='1" /> <code value="or "1"="1"/> <code value="or 1=1--" /> <code value="or 1=1;--" /> </element> </rule> Attack rules rule context int defaultRule mathRule numberRule defaultRule stringRule string An attack code is dynamically generated using attack rules An attack rule defines Structure of an attack code that will be inserted into a target spot Whether or not quotes and parentheses will be used A list of attack rules are written in XML Easy to add new attack rules
  • 15.
  • 16. Tree Validation SQL query SQL query user input Web application Web application SELECT * FROM… SELECT * FROM… SELECT * FROM… Parse tree generated from an innocent request Properly sanitized parse tree Improperly sanitized parse tree A properly sanitized parse tree has the same syntax An improperly sanitized parse tree has different syntax
  • 17. Implementation 13,000 LOC in Java 21 attack rules (1,800 LOC in XML) for 95 contexts Test results are output in an HTML/XML document RSS feed is also available
  • 18. Demo Testing the Login Page of a Web Application
  • 19. Experiments We evaluated the effectiveness of our technique Subjects E-learning Provided by IX Knowledge Inc. It has been used in an intranet before Bookstore, Portal, Event, Classifieds, Employee Directory Free open-source applications from GotoCode We found they have been used in the real world Comparison with Paros Paros is a web application scanner, which took the 2nd place in web vulnerability scanner ranking in Insecure.Org
  • 20. Comparison of Sania and Paros Targeting User Inputs Sania identifies inputs that appear in SQL queries Paros regards all user inputs as vulnerable Generating Attacks Sania generates its attacks based on syntax of SQL queries Paros applies attack codes to all user inputs Combination attack Sania can attack several spots at the same time Paros can not generate combination attacks Determining Vulnerability Sania compares the syntax of SQL queries Paros compares the content of HTTP responses
  • 21. Evaluation Sania detected more vulnerabilities and gave significantly fewer false positives with fewer trials than Paros
  • 22. False Positives Sania caused 13 false positives Invalid Data The attack code did not meet the length requirements Sania is unaware of the database structure Need to design a way to learn the structure of the database Authentication Failed The password and confirmation fields did not match Sania does not know which user inputs must share the same data Need to include a function that tells Sania which user inputs require the same data input
  • 23. Testing a real product We had a chance to test a production-quality web application just before being shipped Subject: RSS-Dripper Provides RSS information to users based on their previous choices Written in JSP and Java Servlet Work on Struts Results One vulnerability was detected after 33 attacks Vulnerable to a combination attack We confirmed it was truly vulnerable
  • 24. Conclusion Sania’s Technique Used during the development or debugging phases Create powerful attacks based on the context of SQL query Detect vulnerabilities by syntax-comparison of parse trees Sania’s Effectiveness Out-performed the presently highest rated tool that tests for SQL injection attacks Next Steps Implement techniques to reduce false positives Adapt our technique to detect other injection vulnerabilities, such as XSS, XPath Injection, OS Injection attacks