Building Defense in Depth using the Full Spectrum of SQL Server Encryption.

Slides:



Advertisements
Similar presentations
Chapter 14 – Authentication Applications
Advertisements

Internet and Intranet Protocols and Applications Lecture 9a: Secure Sockets Layer (SSL) March, 2004 Arthur Goldberg Computer Science Department New York.
Cryptography Chapter 7 Part 4 Pages 833 to 874. PKI Public Key Infrastructure Framework for Public Key Cryptography and for Secret key exchange.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
SSL & SharePoint IT:Network:Applications. Agenda Secure Socket Layer Encryption 101 SharePoint Customization SharePoint Integration.
Chapter 14 From Cryptography and Network Security Fourth Edition written by William Stallings, and Lecture slides by Lawrie Brown, the Australian Defence.
Mar 19, 2002Mårten Trolin1 This lecture On the assignment Certificates and key management SSL/TLS –Introduction –Phases –Commands.
DESIGNING A PUBLIC KEY INFRASTRUCTURE
Mar 12, 2002Mårten Trolin1 This lecture Diffie-Hellman key agreement Authentication Certificates Certificate Authorities SSL/TLS.
16.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft® Windows® Server 2003 Active Directory Infrastructure.
Chapter 9: Using and Managing Keys Security+ Guide to Network Security Fundamentals Second Edition.
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 9: Planning and Managing Certificate Services.
LAB#2 JAVA SECURITY OVERVIEW Prepared by: I.Raniah Alghamdi.
Introduction to PKI Seminar What is PKI? Robert Brentrup July 13, 2004.
BY MUKTADIUR RAHMAN MAY 06, 2010 INTERODUCTION TO CRYPTOGRAPHY.
Apr 22, 2003Mårten Trolin1 Agenda Course high-lights – Symmetric and asymmetric cryptography – Digital signatures and MACs – Certificates – Protocols Interactive.
Securing Data Storage Protecting Data at Rest Advanced Systems Group Dell Computer Asia Ltd.
Hands-On Microsoft Windows Server 2003 Administration Chapter 5 Administering File Resources.
70-270, MCSE/MCSA Guide to Installing and Managing Microsoft Windows XP Professional and Windows Server 2003 Chapter Nine Managing File System Access.
File System and Full Volume Encryption Sachin Patel CSE 590TU 3/9/2006.
CSCI 6962: Server-side Design and Programming
Cisco Confidential © 2010 Cisco and/or its affiliates. All rights reserved. 1 SAN Certificate in Unity Connection Presenter Name: Bhawna Goel.
Part Two Network Security Applications Chapter 4 Key Distribution and User Authentication.
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.
Introduction to SQL Server 2000 Security Dave Watts CTO, Fig Leaf Software
Cryptography and Network Security Chapter 14 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Week #7 Objectives: Secure Windows 7 Desktop
Cao Tiến Đức. Outline What is TDE How TDE works Basic TDE operations Tablespace encryption HSM Reference.
每时每刻 可信安全 1The DES algorithm is an example of what type of cryptography? A Secret Key B Two-key C Asymmetric Key D Public Key A.
Chapter 9: Using and Managing Keys Security+ Guide to Network Security Fundamentals Second Edition.
Security David Frommer Principal Architect Business Intelligence Microsoft Partner of the Year 2005 & 2007.
MICROSOFT SQL SERVER 2005 SECURITY  Special Purpose Logins and Users  SQL Server 2005 Authentication Modes  Permissions  Roles  Managing Server Logins.
Introduction to Secure Sockets Layer (SSL) Protocol Based on:
Unit 1: Protection and Security for Grid Computing Part 2
Additional Security Tools Lesson 15. Skills Matrix.
Certificate-Based Operations. Module Objectives By the end of this module participants will be able to: Define how cryptography is used to secure information.
Module 14 Configuring Security for SQL Server Agent.
Module 9: Fundamentals of Securing Network Communication.
1 Securing Data and Communication. 2 Module - Securing Data and Communication ♦ Overview Data and communication over public networks like Internet can.
All Input is Evil (Part 1) Introduction Will not cover everything Healthy level of paranoia Use my DVD Swap Shop application (week 2)
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Module 3 Configuring File Access and Printers on Windows ® 7 Clients.
1. 2 Overview In Exchange security is managed by assigning permissions in Active Directory Exchange objects are secured with DACL and ACEs Permissions.
Module 3: Configuring File Access and Printers on Windows 7 Clients
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 11: Managing Access to File System Resources.
Security fundamentals Topic 5 Using a Public Key Infrastructure.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
Creating and Managing Digital Certificates Chapter Eleven.
INFORMATION SECURITY MANAGEMENT P ROTECTION M ECHANISMS - C RYPTOGRAPHY.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
© Copyright 2009 SSLPost 01. © Copyright 2009 SSLPost 02 a recipient is sent an encrypted that contains data specific to that recipient the data.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Module 11: Managing Data Storage. Overview Managing File Compression Configuring File Encryption Configuring EFS Recovery Agents Implementing Disk Quotas.
Mar 28, 2003Mårten Trolin1 This lecture Certificates and key management Non-interactive protocols –PGP SSL/TLS –Introduction –Phases –Commands.
C Copyright © 2007, Oracle. All rights reserved. Security New Features.
SQL Server Security The Low Hanging Fruit. Lindsay Clark Database Administrator at American Credit Acceptance
Secure SQL Database with TDE Thomas Chan SQL Saturday Raleigh.
SQL Server Encryption Ben Miller Blog:
SQL Database Management
Chapter 5 : Designing Windows Server-Level Security Processes
Cryptography and Network Security
Introduction to SQL Server 2000 Security
Common Security Mistakes
Designing Database Solutions for SQL Server
Building Defense in Depth using the Full Spectrum of SQL Server Encryption Michael Keleher Database Administrator Hays Consultant at PwC.
We Need To Talk Security
Presentation transcript:

Building Defense in Depth using the Full Spectrum of SQL Server Encryption

Presented by Mike Keleher 20 years of software development experience 3 years DBA experience 2 time Bisk Presidents Club Award winner MIS Degree from University of South Florida

"Cybersecurity must mean more than protecting the system -- it must also include protecting data," said John Cohen, former acting undersecretary for intelligence and analysis at DHS. "If information contained within government and private-sector systems is encrypted, then the harm caused by cyberattacks such as this one would be minimal." Security experts: OPM breach shows Einstein isn't enough FCW.com Article dated 6/15/2015

Topics Encryption terminology Column level encryption Code encryption SQL Server connection encryption Transparent Data encryption Reporting Services encryption TLS and SSL Problems and solutions SQL Server 2016 Always Encrypted

Keys A value supplied to an algorithm to encrypt or decrypt data Symmetric keys Uses only one key to both encrypt and decrypt data Asymmetric keys Uses a pair of mathematically related keys Private key can decrypt Public key can encrypt

Algorithms A mathematical function used with a key to encrypt or decrypt a message AES (widely endorsed as the most secure selection) Triple DES RSA BLOWFISH

Hash function A hash function takes in data and returns back a fixed length block of bits such that any change to the data should result in a different block.

Certificates A package that contains a user's Public Key, which has been signed and encrypted using the private key of a well-known Certificate Authority and based on the x.509 standard. Enables SSL

Certificate Authority Certificate Authority is the issuer of the certificate. It is denoted in the “Issued by” section of the certificate and can be based on one of the following Self signed Domain certificate Public CA certificate

Certificate Trust and trust chains There are two types of certificate authorities (CAs), root CAs and intermediate CAs To facilitate this process of verifying a chain of trust, every certificate includes the fields «Issued To» and «Issued By» Certificate validation commonly called “Walking the certificate chain”

Key protection hierarchy

Key scheme in SQL Server 1. Service Master Key Symmetric key in the master database encrypted by the Windows Data Protection API. Used to encrypt linked server connection information, credentials and proxy accounts. 2. Database Master Key Symmetric key created within a database and encrypted by password supplied during creation using AES_256 algorithm for 2012 and above, triple DES for earlier versions 3. Asymmetric keys and Certificates Use public\private key pairs. Certificates generated within SQL are all self signed. Private key encrypted by password or Database Master Key. 4. Symmetric keys Can be encrypted by password, certificate, asymmetric key, another symmetric key, or Extensible Key Management provider. Can’t be protected directly by the DMK.

Service master Key Created automatically by SQL Server the first time there is a need for it Can only be opened by the service account Regenerating or restoring is resource intensive Protects linked server logins and credentials Not accessible by the server if you restore master database to a different system and change service accounts

Database master key Encrypted by Service Master Key using AES 256 Two copies exist. One in the user database and one in the master

Asymmetric key Can be encrypted by password, certificate or symmetric key Can be created from a file Cannot be backed up separately from the database It is possible to use ALTER to remove the private key so the Asymmetric key can only be used to encrypt and not decrypt

Certificates By default, certificate private key is encrypted by Database Master Key Can be altered to remove private key Certificate and private key backed up to separate files Every Certificate in SQL Server is a self signed certificate that adheres to the x.509 standard Can be used to encrypt data

Symmetric key No backup No private key removal Can be reproduced on different servers from script SQL Server will allow changes to methods for encrypting the key, but will never allow the key to be unencrypted on the server

Certificate Encryption Example

Extensible Key Management Provides an interface for Hardware Security Modules to perform cryptography Introduced in 2008 Only available in … Enterprise Edition

Encryption System tables

Example Encryption function Each key has a key guid that must be used Encryption and decryption functions can have authenticators

Authenticators Helps deter whole value substitution Integrated into the encrypted column and required to decrypt

Column Encryption Encrypted data must be stored in Varbinary column Remains encrypted in memory and in storage

Anatomy of an encrypted column Symmetric key cipher text message format

Indexing encrypted columns Encryption functions on server are non-deterministic, therefore the output is not repeatable

Indexing that won’t work EncryptByKey returns different values for the same message

Resolving the indexing problem Be careful. If a workaround is implemented incorrectly it could compromise the encrypted data Hashing the message makes it output predictable and can lead to a dictionary attack

Replicating Encrypted Columns Transfer data without decrypting Data is encrypted on publisher, in transit and at subscriber and only decrypted when used. Same symmetric or asymmetric key must be created on both databases

Permissions needed to decrypt Grant REFERENCES on symmetric keys Grant CONTROL to those who will manage these objects Anyone with CONTROL can run BACKUP CERTIFICATE CONTROL permission on a certificate is required to use it for decryption either directly or indirectly Warning: The db_owner role, db_securityadmin and the db_ddladmin role have CONTROL permissions on certificates and the db_backupoperator role can back up the database.

Procedure Code signing with Certificates Can generally be used to solve some granular permission issues There are five steps of module signing: Create a signing certificate Sign the module using the signing certificate Create a certificate user and map to the certificate Grant the permissions to the certificate user Grant permission to the module for the users/groups

Code signing example Create a signing certificate Sign the module using the signing certificate Create a certificate user and map to the certificate Grant the permissions to the certificate user Grant permission to the module for the users/groups

Results

Code signing concept It’s like telling the user “You don’t have permissions to operate the motor, but you do have permission to knock over the first domino”

Where is my encryption? using System views to find encryption artifacts

Stored procedure encryption Only available in SQL Server 2008 and above Converts text of procedures to obfuscated form, even in system tables Encrypted procedures can’t be replicated Text still available to administrators using the Dedicated Administrative Connection Can be used with functions, views and triggers as well

Connection encryption Install Certificate on Server Configure server to use Certificate and force connection encryption using SQL Server Configuration Manager

Man in the middle Attack Possible when using self-signed certificates or certificate obtained using identity theft

Potential issues with Connection Encryption Java VMs handle their own connection encryption Replication agents can be affected Set trust server certificate to yes and use the encryptionlevel option for the distributor

Transparent Data Encryption Encrypts Data files and log files Encrypts and protects backup files Only available in... Enterprise Edition, however, backup encryption is available on all versions of SQL Server starting in 2014 To implement, create a Database Master Key and Certificate in the master database, then create a Database Encryption Key in the user database and set the user database encryption property to ON. If you want to encrypt your data and log files and don’t have Enterprise Edition there is good news…

Encrypting database files without TDE EFS Encrypting File System Requires a Certificate on the system encrypting the files

Reporting Services Encryption If you have any instances of Reporting Services, then the encryption keys and password needs to be backed up

TLS and SSL How channel encryption is negotiated between systems Determine the highest level protocol mutually supported by the client and the server. The currently recognized protocols are, from highest to lowest: TLS1.2,TLS1.1, TLS1.0, SSL3.0, SSL2.0

How to cause Trouble... and recover from it

Changing systems and service accounts in one move Changing systems and service accounts during a restore of master, msdb and user databases will cause the Service Master Key to be inaccessible What you will lose if you can't recover: a. Encrypted backups b. TDE Encrypted files c. Encrypted Column data d. Linked Server Logins e. Credentials

Service Master Key recovery There is a way to recover… If your system reports a problem… Warning: Do not regenerate the Service Master Key Until you have recovered it first 2012 and earlier 2014 and later use SSCM

Only taking backups of databases without backups of keys and certificates Inhibits recovering user database to other servers Solutions restore problematic user databases from a good backup to same server under a different name Build a new server, restore master, msdb and user databases and it's imperative to use the same service account and password Warning: If you don’t backup either the master database or the Service Master Key you could lose it all

Changing the service account outside of the SQL Server Configuration Manager SQL Server will re-encrypt the Service Master Key when the account information is changed using SQL Server Configuration Manger. Do not use Computer Manager or other command line options as they are not aware of the encryption requirements Back up the Service Master Key Warning: If you change the password for the service account outside of SQL Server Configuration Manager and the server crashes before it can be restarted, you could lose access to the Service Master Key

Using encrypting file system without backing up the certificate Only one important point to make about this slide The Title says it all Work with your system administrator

A Practical Example of Solving Encryption Problems The Scenario A SQL Server instance implemented by a group outside of IT had their instance crash Unrecoverable system board error occurred You are a Database Administrator assigned to rebuilding the instance and provided with the following facts One of their team members decided to encrypt a substantial number of columns in a mission critical database The person who set up the instance had a backup job that ran every day. It deleted the previous days backups and created a current backup set. They have the domain user and password used as the service account However, they only backed up the user databases and not the master database.

More Details about the situation When you inquire about how the encryption was implemented, you are sent a hyperlink to an StackOverflow blog page and were told that they copied the script from this page and ran it.... no one saved the script He did mention that he changed all of the parameters, but forgot to change the Key_Source

The Solution We can solve this by applying knowledge of the key Hierarchy, system tables and format of the encrypted data Facts we know We have a backup of the user database We know the script that was used to create the keys We also know that they Key_Source is used to create the symmetric key and the identity_value is used to generate the key_guid We know that the symmetric key was encrypted by the certificate We know the format of the encrypted column

Decryption attempt

If you only had the password for the database master key … but you don’t in this situation

Documentation for symmetric key

The script

One last item before we can decrypt

SQL Server 2016 Always Encrypted

Back up Keys and certificates Back up all Database Master Keys, Service Master Keys and Certificates Symmetric and Asymmetric keys are backed up with the database, however, if you want to share a symmetric key among several systems it can be created from a file or using the algorithm, key_source and identity_value parameters If you have any column encryption, it is important to back up the Database Master Key and keep the password used to encrypt it safe and accessible

Reference material Raul Garcia’s Blog Indexing Encrypted Columns Encrypted Message Description Channel 9 Always Encrypted Video Technet SQL Server Encryption MSDN SQL Server Encryption X.509 Certificate Format and Validation How to Crack the Symmetric Keys in the Database Wide OpenHow to Crack the Symmetric Keys in the Database Wide Open

Contact Information LinkedIn: Michael Keleher

Thank you for attending