INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.

Slides:



Advertisements
Similar presentations
Chapter 23 Database Security and Authorization Copyright © 2004 Pearson Education, Inc.
Advertisements

Access Control Chapter 3 Part 3 Pages 209 to 227.
The twenty-four/seven database Oracle Database Security David Yahalom Senior database consultant
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Access Control Methodologies
Database Management System
Security Issues and Challenges in Cloud Computing
Chapter 8 Security Transparencies © Pearson Education Limited 1995, 2005.
Chapter 19 Security.
CSCI 530 Lab Authentication. Authentication is verifying the identity of a particular person Example: Logging into a system Example: PGP – Digital Signature.
Database Security Managing Users and Security Models.
DATABASE SECURITY By Oscar Suciadi CS 157B Prof. Sin-Min Lee.
Computer Security Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
ISOM MIS3150 Data and Info Mgmt Database Security Arijit Sengupta.
Jim McLeod MyDBA  SQL Server Performance Tuning Consultant with MyDBA  Microsoft Certified Trainer with SQLskills Australia 
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
SEC835 Practical aspects of security implementation Part 1.
Week 10-11c Attacks and Malware III. Remote Control Facility distinguishes a bot from a worm distinguishes a bot from a worm worm propagates itself and.
CSCI 3140 Module 6 – Database Security Theodore Chiasson Dalhousie University.
File System Security Robert “Bobby” Roy And Chris “Sparky” Arnold.
Database Role Activity. DB Role and Privileges Worksheet.
Database Security Tampere University of Technology, Introduction to Databases. Oleg Esin.
Database Security Lesson Introduction ●Understand the importance of securing data stored in databases ●Learn how the structured nature of data in databases.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
1 Data and Database Administration Data and Database Administration By Lec. Adeel Shahzad FromBook-B.
CSCI 530 Lab Passwords. Overview Authentication Passwords Hashing Breaking Passwords Dictionary Hybrid Brute-Force Rainbow Tables Detection.
Web Database Security Session 12 & 13 Matakuliah: Web Database Tahun: 2008.
Database Security. Introduction to Database Security Issues (1) Threats to databases Loss of integrity Loss of availability Loss of confidentiality To.
Slide Set #24: Database security SY306 Web and Databases for Cyber Operations.
Lecture 2 Page 1 CS 236 Online Security Policies Security policies describe how a secure system should behave Policy says what should happen, not how you.
PRESENTED BY Raju. What is information security?  Information security is the process of protecting information. It protects its availability, privacy.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
Cosc 5/4765 Database security. Database Databases have moved from internal use only to externally accessible. –Organizations store vast quantities of.
CCT395, Week 12 Storage, Grid Computing, Review This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0.
CCT395, Week 6 Implementing a Database with SQL and a Case Study Exercise This presentation is licensed under Creative Commons Attribution License, v.
CCT395, Week 2 Introduction to SQL Yuri Takhteyev September 15, 2010
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
Importance of IT security ->protects data ->ensures authentication and confidentiality ->preevents data theft.
INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
8 – Protecting Data and Security
Database System Implementation CSE 507
Review Databases and Objects
Hash Functions Which of these problems is easier to solve:
Tutorial on Creating Certificates SSH Kerberos
Database Security and Authorization
Special Topics in CCIT: Databases
CCT1343, Week 2 Single-Table SQL Yuri Takhteyev University of Toronto
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
Data Modeling and Database Design
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Database Design and Implementation
Tutorial on Creating Certificates SSH Kerberos
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Audit Findings: SQL Database
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
Chapter 8 Working with Databases and MySQL
Chapter 27: System Security
An Introduction to Web Application Security
Lesson 16-Windows NT Security Issues
Information Security Awareness
By Oscar Suciadi CS 157B Prof. Sin-Min Lee
Chapter 7 – and 8 pp 155 – 202 of Web security by Lincoln D. Stein
Presentation transcript:

INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution License, v To view a copy of this license, visit This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from

Week 10 Database Security

Final Project Implementation plan for unexpected problems the database is what matters most backup your stuff test! Documentation update the ER in the end include all SQL (even if it doesn't work) explain what is not obvious design explain non-obvious testing steps Questions?

Security Confidentiality / secrecy: Preventing unwanted disclosure Integrity Preventing unwanted modification Availability Preventing disruption or loss (Consider the interrelation between the 3.)

Threats Attacks Profit Revenge/terrorism Lulz Mistakes / accidents / oversights Outsiders vs insiders Insiders are armed with internal knowledge. Consider “social engineering”.

Access Control Define who can do/see what 1. Identifying users Passwords + other mechanisms Users can be assigned to groups/roles 2. Determining rights Grant/deny rights to specific data/operations Could be done at the level of group/role

SQL Privileges GRANT «privilege» ON «object» TO «user»; For instance: GRANT SELECT ON secretdb.* TO kenobio1; Variations: GRANT SELECT ON secretdb.* TO kenobio1 WITH GRANT OPTION;

SQL Privileges REVOKE «privilege» ON «object» FROM «user»; For instance: REVOKE SELECT ON secretdb.* FROM kenobio1; Also (not in MySQL): REVOKE SELECT ON secretdb.* FROM kenobio1 CASCADE;

SQL Privileges Variations: GRANT SELECT ON secretdb.alpha TO kenobio1; The user can see table “alpha” but not the other tables.

Roles More flexible: CREATE ROLE student; GRANT SELECT ON secretdb.* TO student; GRANT student TO kenobio1; (Not available in MySQL.)

Using Views CREATE TABLE true_omega (boring TEXT, scary TEXT); CREATE VIEW omega AS SELECT boring from true_omega; GRANT ALL ON secretdb.omega TO kenobio1; The user can now see and modify the values in “boring” but not in “scary”.

Using Views CREATE VIEW omega AS SELECT boring from true_omega WHERE scary IS NULL; GRANT ALL ON secretdb.omega TO kenobio1; The user can now see and modify the values in “boring” but only for those roles for where “scary” is not set.

Limitations Somewhat inflexible 1000 employees = 1000 views? Solution: “fine-grained access control” Discretionary Can be bypassed by users with access: Obvious: “with grant option” Less obvious: users with clearance can copy sensitive data into tables accessible to users without clearance Solution: “mandatory access control” i.e., a centrally enforced row-level policy

Creating Users CREATE USER alice; SET PASSWORD FOR alice = PASSWORD('bob'); You can now login as 'alice' with password 'bob': mysql -p -u alice

Storing User Data USE mysql; select User, Password from user where User="alice"; You don't have access to database “mysql,” but here is what I get to see: | User | Password | | alice | *61584B76F6ECE8FB9A328E7CF198094B2FAC55C7 | row in set (0.00 sec)

Hashing Passwords SET PASSWORD FOR alice = PASSWORD('bob'); Compare with: SELECT PASSWORD('bob'); SELECT SHA1('bob');

Hashing Passwords A “one-way” function bob → 61584B76F6ECE8FB9A328E7CF198094B2FAC55C7 Easily calculated B76F6ECE8FB9A328E7CF198094B2FAC55C7 → bob Very hard to calculate (in theory). How hard is “very hard”? MD5: a few seconds SHA1/2: 1 hour + $2 SHA3: hopefully centuries

Password Attacks A brute-force attack Just try all possible combinations 5 lower case letters: 12 million combinations 5 letters / numbers: ~ 1 billion 8 letters / numbers: > 200 trillion A dictionary attack Check passwords based on words Matching passwords to accounts Who uses “123456” as their password?

Password Trilemma Pick a simple one Might be guessed or brute-forced Write it down Might be found Forget it later Need a procedure for recovery

Password Theft Stored passwords Paper, accounts, files Insecure transmission “Sniffing”, “key-loggers” Get a user to reveal the password Phishing, social engineering

Password Alternatives Public key cryptography Authentication without revealing any secrets A pair of keys (long numbers): A public key for encoding A private key for decoding RSA SecurID: image source:

Network Linux 1 MySQL Linux 2 Apache Unknown Machine

Web App Accounts Create a table for user accounts: usernames hashed passwords never store actual passwords! Authenticate the user with a query select * from users where username="%s" AND password="%s"; Proceed if successful Give the user a “cookie” for the future cookies can be stolen (unless encrypted w/ SSL)

The Accounts MySQL accounts to access the database (from an authorized machine) Machine accounts to access a machine (from within the network) Application accounts your users, e.g. bank clients

Gawker Media Hacked by “Gnosis” in million accounts stolen. 300,000 weakly hashed passwords released. (Most common ones: “12345”, “password”) The scenario: hacked → access to chat logs chat → → sysadmin passwords → access to servers → → root access (unpatched OS) → → MySQL access → → MySQL data, including passwords → → Twitter logins, etc. → Twitter spam

SQL Injection Did you really name your son Robert'); DROP TABLE Students;--? Image source: XKCD,

Dynamic SQL (Wrong) TEMPLATE = """select * from persona where species='%s';""" import cgi form = cgi.FieldStorage() if form.has_key("species") : cursor=db.cursor() species = form["species"].value query = TEMPLATE % species print query cursor.execute(query); rows = cursor.fetchall() print " " for row in rows: print " " for x in [0,1,2]: print " ", row[x], " " print " " Don’t do this!

Here Is Why bio1/cgi- bin/personas2.cgi?species=Human'%3 Binsert+into+persona+(name,species) +values+('X','Human')%3Bselect+*+fr om+persona+where+'

Dynamic SQL - Right TEMPLATE = """select * from persona where species='%s';""" import cgi form = cgi.FieldStorage() if form.has_key("species") : cursor=db.cursor() species = form["species"].value query = TEMPLATE % db.escape_string(species) print query cursor.execute(query); rows = cursor.fetchall() print " " for row in rows: print " " for x in [0,1,2]: print " ", row[x], " " print " "

Anonymous vs HBGary (An SQL injection.)

Cablegate 260,000 “cables” “I would come in with music on a CD- RW labelled with something like ‘Lady Gaga’… erase the music … then write a compressed split file. No one suspected a thing … [I] listened and lip-synched to Lady Gaga’s Telephone while exfiltrating possibly the largest data spillage in American history.” Solutions?

Physical Attack (Also: accidents, natural disasters, hardware failure, file corruption.)

Backup mysqldump mysqldump -u kenobio1 -p starwars > starwars.sql mysql < starwars.sql (Add “create database starwars; use starwars;”) hot backup replication off-site copies

RAID combining disks for reliability and/or performance

No RAID A1A2B1B2

RAID-0 A1B1C1D1 A2B2C2D2 can be faster, no gain in reliability

RAID-1 A1A2B1B2 faster reading, slower writing can withstand losing one disk

RAID >2 A1B1C1D1 A2B2C2D2 ApBpCpDp

RAID >2 A1B1C1D1 A2B2C2D2 reasonable reliability, not too wasteful ApBpCpDp

Questions?