How to Hack a Database.  What is SQL?  Database Basics  SQL Insert Basics  SQL Select Basics  SQL Where Basics  SQL AND & OR Basics  SQL Update.

Slides:



Advertisements
Similar presentations
Day 9. SELECT INSERT UPDATE DELETE » The standard UPDATE statement. UPDATE table SET field1=val1, field2=val2 WHERE condition » Multiple table UPDATE.
Advertisements

Aqua Data Studio. Find the application We are using Aqua Data Studio v11.
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Introduction The concept of “SQL Injection”
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
CSC 2720 Building Web Applications Database and SQL.
Chapter 5 Data Manipulation and Transaction Control Oracle 10g: SQL
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
MIS Week 11 Site:
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
ASP.NET Programming with C# and SQL Server First Edition
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
Chapter 10 Queries and Updating Part C. SQL Copyright 2005 Radian Publishing Co.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
SQL Training SQL Statements – Part 1. Confidential & Proprietary Copyright © 2009 Cardinal Directions, Inc. Lesson Objectives Explain the role of SQL.
MS Access Database Connection. Database? A database is a program that stores data and records in a structured and queryable format. The tools that are.
Introduction to databases and SQL. What is a database?  A database is an organized way of holding together pieces of information  A database refers.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
SQL – Injections Intro. Prajen Bhadel College of Information Technology & Engeneering Kathmandu tinkune Sixth semister.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Database UpdatestMyn1 Database Updates SQL is a complete data manipulation language that can be used for modifying the data in the database as well as.
WEB SECURITY WEEK 2 Computer Security Group University of Texas at Dallas.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Secure Authentication. SQL Injection Many web developers are unaware of how SQL queries can be tampered with SQL queries are able to circumvent access.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
 CONACT UC:  Magnific training   
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.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
13 Copyright © 2004, Oracle. All rights reserved. Migrating SQL Statements.
3 A Guide to MySQL.
Database Access with SQL
CS 3630 Database Design and Implementation
Chapter 5 Introduction to SQL.
Introduction to Dynamic Web Programming
SQL and SQL*Plus Interaction
Insert, Update and the rest…
© 2016, Mike Murach & Associates, Inc.
Computer Security Fundamentals
Intro to Ethical Hacking
MS Access Database Connection
ISC440: Web Programming 2 Server-side Scripting PHP 3
Chapter 8 Working with Databases and MySQL
Using SQL*Plus.
Information Management
Intro to Ethical Hacking
CS3220 Web and Internet Programming SQL and MySQL
Database SQL.
Presentation transcript:

How to Hack a Database

 What is SQL?  Database Basics  SQL Insert Basics  SQL Select Basics  SQL Where Basics  SQL AND & OR Basics  SQL Update Basics  SQL Delete Basics  SQL Injection Basics

 Basic Database Functions  Structured Query Language  Common Language For Varity of Databases  ANSI Standard  Database Specific Extensions  Uses Common Baseline Syntax  Scripting Language  Allows Comments (--)  Semicolon Terminates Command (;)

 Pros:  Very Flexible  Universal (Oracle, SQL Server, MySQL)  Relatively Few Commands to Learn  Cons:  Requires Detailed Knowledge of the Structure of the Database  Can Provide Misleading Results

FFour Basic Operations CCRUD CC – Create (Insert) RR – Read (Select) UU – Update DD – Delete

IINSERT – Allows Data to be Inserted into Database TThree Basic Components TTable CColumn(s) VValues

SSyntax IINSERT INTO t able ( column(s) ) VALUES ( value(s) ) TTable – Name of Table Data is Being Stored In CColumn(s) – Name of Column, or Columns, to Insert Data Into VValue(s) – Values to Insert NNote : Columns and Values Must be in Same Order

 Select – Select Data from Database  Syntax  SELECT column(s) FROM table WHERE condition  Column(s) – Column, or Columns, Names to Retrieve  “*” – Means All Columns from table  Table – Table Name to Get Data From  Can be more than one table

 Example  Select state_name, state_abbr FROM states  Select * FROM agencies

 Where Clause  Added to Refine Result Set  Uses Conditional Operators  =,>,>=, )  Between x AND y  IN ( list )  LIKE ‘ %string ’ (“%” us a wild-card)  IS NULL  NOT {BETWEEN / IN / LIKE / NULL}

 Examples  SELECT * FROM annual_summaries WHERE sd_duration_code = ‘1’  SELECT state_name FROM states WHERE state_population >  SELECT * FROM annual_summaries WHERE sd_duration_code IN (‘1’,’W’,’X’) AND annual_summary_year = 2000

 Multiple WHERE conditions are Linked by AND / OR Statements  “AND” – All Conditions True  “OR” – At Least One Condition is TRUE  Group with ()

 Allows Changes to Row(s) of Data in a Table  Three Basic Parts  Name of Table to Update  Column Name to Update  Value to Update  Can Update More Than One Column at a Time  Can Include Where Clause to More Refined Update

SSyntax UUPDATE t able SET c olumn = v alue WHERE c olumn = value EExample UUPDATE clubs SET ClubName = ‘Club 1’ WHERE ClubID = 1

 Allows for Data to be Removed from the Database  One Required Part  Table Name  Can Delete All Data in Table, or Just Selected Data  One Optional Part  WHERE Clause – Allows for Selective Delete

 Syntax  DELETE FROM table WHERE column = value  Table – Name of Table to Remove Data from  Column – Name of Column in Table  Value – Value that is in the Column  Example  DELETE FROM clubs (Deletes all Data in Table)  DELETE FROM clubs WHERE ClubID = 1

 SQL Takes Advantage of Poor Programming  Inserting SQL Commands into Input Field for Exploitation  Example User Name / Password Input (admin, admin) Into SQL:  SELECT * FROM users WHERE username = ‘admin’ AND password = ‘admin’  Returns Data for User admin Where Password is admin

 SQL Injection Input (admin, ‘ or 1 = 1 --)  SELECT * FROM users WHERE username = ‘admin’ AND password = ‘’ or 1 = 1 --  Returns Data for User admin Where Password is Empty OR 1 = 1 (Always True)  Note : This will Return All Data in Table

 Can Create New User  Using Same User Name / Password Example  Input (admin, ’;INSERT INTO Users VALUES ('Hijack','This') --  SQL  SELECT * FROM users WHERE username = ‘admin’ AND password = ’’;INSERT INTO Users VALUES ('Hijack','This') --  Note : Creates a New User (Hijack) with a Password (This)

 Can Create Table Values  Using Same User Name / Password Example  Input (admin, ’;UPDATE Orders Set Amount=  SQL  SELECT * FROM users WHERE username = ‘admin’ AND password = ’’;UPDATE Orders Set Amount=  Note : Sets all Order Amounts to one cent

 SQL   ict.com/as_as_computing/ocr/H447/F453/3_3_9/s qlintro/miniweb/index.htm ict.com/as_as_computing/ocr/H447/F453/3_3_9/s qlintro/miniweb/index.htm  SQL Injection  basic-sql-injection-with-login.html basic-sql-injection-with-login.html  Practice Site 