Introduction SQL Injection is a very old security attack. It first came into existence in the early 1990's ex: ”Hackers” movie hero does SQL Injection.

Slides:



Advertisements
Similar presentations
Module XIV SQL Injection
Advertisements

Web Security Never, ever, trust user inputs Supankar.
What is code injection? Code injection is the exploitation of a computer bug that is caused by processing invalid data. Code injection can be used by.
Creating Stronger, Safer, Web Facing Code JPL IT Security Mary Rivera June 17, 2011.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
Common Exploits Aaron Cure Cypress Data Defense. SQL Injection.
WebGoat & WebScarab “What is computer security for $1000 Alex?”
-Ajay Babu.D y5cs022.. Contents Who is hacker? History of hacking Types of hacking Do You Know? What do hackers do? - Some Examples on Web application.
ITEC403 Graduation Project Applications’ Security – Cem Yağlı.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
Web server security Dr Jim Briggs WEBP security1.
SQL Injection and Buffer overflow
Sara SartoliAkbar Siami Namin NSF-SFS workshop July 14-18, 2014.
Lecture 16 Page 1 CS 236 Online Cross-Site Scripting XSS Many sites allow users to upload information –Blogs, photo sharing, Facebook, etc. –Which gets.
Presenter Deddie Tjahjono.  Introduction  Website Application Layer  Why Web Application Security  Web Apps Security Scanner  About  Feature  How.
W3af LUCA ALEXANDRA ADELA – MISS 1. w3af  Web Application Attack and Audit Framework  Secures web applications by finding and exploiting web application.
SQL Injection Timmothy Boyd CSE 7330.
Lets Make our Web Applications Secure. Dipankar Sinha Project Manager Infrastructure and Hosting.
An anti-hacking guide.  Hackers are kindred of expert programmers who believe in freedom and spirit of mutual help. They are not malicious. They may.
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
SQL INJECTION COUNTERMEASURES &
Hamdi Yesilyurt, MA Student in MSDF & PhD-Public Affaris SQL Riji Jacob MS Student in Computer Science.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
Preventing SQL Injection Attacks in Stored Procedures Alex Hertz Chris Daiello CAP6135Dr. Cliff Zou University of Central Florida March 19, 2009.
AMNESIA: Analysis and Monitoring for NEutralizing SQL- Injection Attacks Published by Wiliam Halfond and Alessandro Orso Presented by El Shibani Omar CS691.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 5 “Database and Cloud Security”.
Lecture 16 Page 1 CS 236 Online SQL Injection Attacks Many web servers have backing databases –Much of their information stored in a database Web pages.
Attacking Applications: SQL Injection & Buffer Overflows.
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Attacking Data Stores Brad Stancel CSCE 813 Presentation 11/12/2012.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
SQL INJECTIONS Presented By: Eloy Viteri. What is SQL Injection An SQL injection attack is executed when a web page allows users to enter text into a.
Sumanth M Ganesh B CPSC 620.  SQL Injection attacks allow a malicious individual to execute arbitrary SQL code on your server  The attack could involve.
Aniket Joshi Justin Thomas. Agenda Introduction to SQL Injection SQL Injection Attack SQL Injection Prevention Summary.
Web Applications Testing By Jamie Rougvie Supported by.
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
WEB SECURITY WEEK 2 Computer Security Group University of Texas at Dallas.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Michael Dalton, Christos Kozyrakis, and Nickolai Zeldovich MIT, Stanford University USENIX 09’ Nemesis: Preventing Authentication & Access Control Vulnerabilities.
Module: Software Engineering of Web Applications Chapter 3 (Cont.): user-input-validation testing of web applications 1.
SQL Injection Anthony Brown March 4, 2008 IntroductionQuestionsBackgroundTechniquesPreventionDemoConclusions.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Writing secure Flex applications  MXML tags with security restrictions  Disabling viewSourceURL  Remove sensitive information from SWF files  Input.
SQL Injection Josh Mann. What is SQL Injection  SQL injection is a technique for exploiting web applications that use client-supplied data in SQL queries.
SQL INJECTION Lecturer: A.Prof.Dr. DANG TRAN KHANH Student :Le Nguyen Truong Giang.
SQL Injection Attacks S Vinay Kumar, 07012D0506. Outline SQL Injection ? Classification of Attacks Attack Techniques Prevention Techniques Conclusion.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
SQL INJECTION Diwakar Kumar Dinkar M.Tech, CS&E Roll Diwakar Kumar Dinkar M.Tech, CS&E Roll
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
Database and Cloud Security
Application Vulnerabilities
SQL Injection.
Database System Implementation CSE 507
Module: Software Engineering of Web Applications
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
Chapter 7: Identifying Advanced Attacks
WEB APPLICATION TESTING
Secure Software Confidentiality Integrity Data Security Authentication
Web Application Firewall Bypassing – an approach for pentesters
SQL INJECTION ATTACKS.
SQL Injection Attacks Many web servers have backing databases
PHP: Security issues FdSc Module 109 Server side scripting and
Chapter 13 Security Methods Part 3.
Lecture 2 - SQL Injection
Web Hacking: Beginners
Web Security CS 136 Computer Security Peter Reiher March 11, 2010
Protecting Against Common Web Application Vulnerabilities
Presentation transcript:

Introduction SQL Injection is a very old security attack. It first came into existence in the early 1990's ex: ”Hackers” movie hero does SQL Injection to hack into the database SQL injection is still pervasive. One of the security magzine claimed that more than a million sites are still vulnerable to SQL Injections

What is SQL Injection Attack? Definition: Injecting SQL statements in to the vulnerable spots with a malicious intention It refers to one of the code injection attacks where in data provided by the user is included in a SQL query such that part of the user’s input is treated as SQL code. Most of the cyber crimes are pertaining stealing credit card numbers and stealing money using SQL Injection in the wake of this decade.

Attack intents Extracting data Adding or modifying data Performing Denial-Of-Service attack Bypassing authentication Privilege escalation, etc

Injection Mechanisms Injection through user inputs Injection through cookies Injection through server variables Second order injection

Vulnerability The query behind such a login screen will be SELECT * FROM USERS WHERE username=‘”+usrname+”’ and password=‘”+pass+”’;

If the user enters username as x’ or 1=1- - and anything as password. The statement that will be evaluated is, SELECT * FROM USERS WHERE username=‘x’ or 1=1 - -’ and password=‘anything’; This query will be true for each and every tuple of the table and the attacker will be successful in logging into the application as administrator (first user in the table).

Any tautology works 1 OR 1=1 1' OR '1'='1 x' OR greg LIKE '%re%' admin' OR 1<4 admin' OR 4>2 x' OR 'select' > 's' x' OR 'select' < x'

Blind SQL Injection Attack In this attack cracker/hacker tries to enter wrong data deliberately to figure out the database structure and its properties or or 1=1 UNION select null, null, null, null

Denial of Service If the attacker gives input as “ ’ ; SHUTDOWN; - -” The query will be SELECT * FROM USERS WHERE username=’ ‘; SHUTDOWN; - -’ and password=‘anything’; The database gets shutdown and which will lead to a DoS attack on the web application.

Evasion Techniques White space manipulation the white spaces can be replaced by tab, carriage return or line feed, which goes undetected by any firewall, IDS,etc Comment exploitation The sql style comment - - is detected by a no of applications these days, but it can be replaced by C style comment /**/. Eg UN/*comment*/ION, the sql parsing engines nowadays strip off all comments before submitting query for execution, thus evasion can be done.

Encoding techniques The easiest method of defeating detection Most common encodings are URL encoding Unicode/UTF-8 Hex encoding char() function

Mitigation Techniques The root cause of SQL injection vulnerabilities is insufficient input validation. The mitigation can be Defensive coding practices like Input type checking Encoding of inputs Positive pattern matching Identification of all input sources This the best way of preventing SQLIAs but its application is problematic in practice.

Use static analysis and also runtime analysis Have java script to validate input at the client side Thoroughly parse all the statements that are generated at the runtime using tools like AMNESIA

Praveenkumar G Hoolimath 10IT16F

Introduction It is a specification based approach, specifications here are the different types of queries that the web application is expected to execute. These specifications help to build rules. The SQL queries will be intercepted and checked with these rules. The queries violating these rules will be discarded.

Different phases Phase 1: Definition of specifications (using EBNF) Phase 2: Interception of SQL statements Phase 3: Lexical analysis Phase 4: Syntactical verification of SQL statements Phase 5: Forwarding valid SQL statements to the database Phase 6: Logging

System Architecture

Specification using EBNF SELECT * FROM User WHERE userid=‘”+username+”’ and password=‘”+pass+”’; := SELECT := ( )* := FROM := WHERE AND := "="

Salient Features It prevents all forms of SQL injection attacks Its effectiveness is independent of any particular target system, application environment, or DBMS There is no need to modify the source code of existing web applications to apply the new protection scheme to them.

Vasanth Raja 10IT05F

SQL PARSE TREE VALIDATION The solution is based on validation at run time. Checks the statement structure before the inclusion of the user input and after the inclusion of user input.

SQL PARSE TREE VALIDATION(2) This method aims at 1) Minimizing the effort required by the programmer 2) Eliminate the possibility of the attack 3) Minimize the runtime overhead

SELECT * FROM users WHERE username=? AND password=?

After including user input

This method is not disallowing the program from using tautologies. Eliminating tautologies is not the goal Let the tautology be there in the user input but find the structure at run time and stop the query to be fed to database engine This method allows the programmer to include the comments in the SQL statements

Query structure including comments as tokens

Class structure of the System

Thank you