Implementing Security inside SQL Server

Slides:



Advertisements
Similar presentations
Implementing Tableau Server in an Enterprise Environment
Advertisements

Managing User, Computer and Group Accounts
Logins, Roles and Credentials Lesson 14. Skills Matrix.
Chapter 9 Chapter 9: Managing Groups, Folders, Files, and Object Security.
6.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
11 SUPPORTING LOCAL USERS AND GROUPS Chapter 3. Chapter 3: Supporting Local Users and Groups2 SUPPORTING LOCAL USERS AND GROUPS  Explain the difference.
Hands-On Microsoft Windows Server 2003 Administration Chapter 5 Administering File Resources.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 4 Profiles, Password Policies, Privileges, and Roles.
7.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 7: Introducing Group Accounts.
Chapter 10 Overview  Implement Microsoft Windows Authentication Mode and Mixed Mode  Assign login accounts to database user accounts and roles  Assign.
7-Access Control Fundamentals Dr. John P. Abraham Professor UTPA.
Database Security Managing Users and Security Models.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
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
1 Group Account Administration Introduction to Groups Planning a Group Strategy Creating Groups Understanding Default Groups Groups for Administrators.
5.1 © 2004 Pearson Education, Inc. Lesson 5: Administering User Accounts Exam Microsoft® Windows® 2000 Directory Services Infrastructure Goals 
Security Planning and Administrative Delegation Lesson 6.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 4 Profiles, Password Policies, Privileges, and Roles.
Chapter 6 : Designing SQL Server Service-Level Security MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide.
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.
© Wiley Inc All Rights Reserved. MCSE: Windows Server 2003 Active Directory Planning, Implementation, and Maintenance Study Guide, Second Edition.
Planning a Microsoft Windows 2000 Administrative Structure Designing default administrative group membership Designing custom administrative groups local.
Module 3 Configuring File Access and Printers on Windows ® 7 Clients.
Database Role Activity. DB Role and Privileges Worksheet.
Module 4 Planning for Group Policy. Module Overview Planning Group Policy Application Planning Group Policy Processing Planning the Management of Group.
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
1 Chapter Overview Managing Object and Container Permissions Locating and Moving Active Directory Objects Delegating Control Troubleshooting Active Directory.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Unit 7 ITT TECHNICAL INSTITUTE NT1330 Client-Server Networking II Date: 2/3/2016 Instructor: Williams Obinkyereh.
Secure Data Access with SQL Server 2005 Doug Rees Associate Technologist, CM Group
C Copyright © 2007, Oracle. All rights reserved. Security New Features.
Data Security Superior Consulting Services Rick Bielawski 350 West Burnsville Parkway Suite 550 Burnsville, MN
SQL Server Security The Low Hanging Fruit. Lindsay Clark Database Administrator at American Credit Acceptance
Data Security Lighthouse Software Solutions Rick Bielawski 2042 Wooddale Dr. Suite 125 St. Paul, MN On the web at lssinc.com.
Administrating a Database
Secure Connected Infrastructure
Lighthouse Software Solutions
Automated Enterprise-wide SQL Server Auditing
Chapter 14: System Protection
Securing Data with SQL Server 2016
Chapter 5 : Designing Windows Server-Level Security Processes
Introduction to Operating Systems
Outline What does the OS protect? Authentication for operating systems
Access, Users, Permissions
Active Directory Administration
Introduction to SQL Server 2000 Security
Outline What does the OS protect? Authentication for operating systems
Common Security Mistakes
Designing Database Solutions for SQL Server
Auditing in SQL Server 2008 DBA-364-M
The Dirty Business of Auditing
or: How I Learned to Stop Using EXECUTE AS and Love Certificates
Intermediate Security Topics in SQL SERver
Designing SSIS Packages for Performance
BACHELOR’S THESIS DEFENSE
BACHELOR’S THESIS DEFENSE
BACHELOR’S THESIS DEFENSE
SSIS Project Deployment: The T-SQL Way
February 11-13, 2019 Raleigh, NC.
Governing Your Enterprise with Policy-Based Management
Designing IIS Security (IIS – Internet Information Service)
Administrating a Database
Security Planning and Administrative Delegation
Environment Automation
Creating a Marketing Dashboard with Power BI & Dax
DAX: Functions and Context That’s What It’s All About!
An Introduction to Partitioning
Presentation transcript:

Implementing Security inside SQL Server Questar Assessments Inc. Rick Bielawsk

Thank you Sponsors! Platinum Sponsor: Gold Sponsors: Visit the Sponsor Booths Lots of Raffle Prizes! Get your parking paid via Sponsor Bingo Thank you Sponsors! Platinum Sponsor: Gold Sponsors:

PASSMN – News/Info Sponsors: Thanks to all our sponsors of 2018! We need Sponsors for Nov/Dec 2018 and 2019! Special thanks to our annual sponsor: Board Member Elections in November/December: Your chance to help out the MN SQL community!

November 5th Through November 9th Join the brightest data professionals focused on the Microsoft Data Platform! November 5th Through November 9th Pre-Conference Sessions – Monday/Tuesday Conference – Wednesday through Friday

SQLSaturday #796 – After Party Location: 4th Floor of Mall of America Time: 6:30PM – 10PM There will be drinks and appetizers as well as free game cards and bowling! Hang out with some new friends you’ve made.

Infrastructure Security Agenda Infrastructure Security Data security requires a comprehensive environment-pervasive plan. Database security requires more than access controls. Best Practices & Design Patterns SQL Server Security The Database instance service account Logins vs Users Ownership Chaining Impersonation Certificate Signing TRUSTWORTHY & DB_CHAINING

Limits to what I can cover Data security is an enormous topic To cover the basics of every feature would take 2 days. There are thousands of points of vulnerability http://www.teamscs.com/category/data-security/ Hundreds of tools readily available An infinite combination of implementation strategies What are ‘Best Practices’ & who decides?

Design Best Practices Design practices that, over time, have proven to be: Easier to troubleshoot Easier to enhance Easier to secure IOW: Over time – cost less to maintain than other design choices.

The single most important Design best-practice Build to interfaces not implementations In the database world (almost) NOBODY seems to follow this rule TABLES are IMPLEMENTATIONS!

Data Access Design Pattern Create at least two types of schemas: Public and Private. Use a naming convention to denote the schema type. Tables are ALWAYS in a private schema. NOBODY is granted access to these. Access is only granted to interface schemas. These schemas NEVER contain tables! Views in an interface schema always specify “WITH VIEW_METADATA” Optionally a ‘Protected’ or ‘Internal’ schema type used to join data from multiple private schemas for use by multiple public schemas.

Top 5 Security Best Practices Least Privileges Monitor access failures INVESTIGATE access failures! If you don’t stop an attacker BEFORE they succeed they WILL eventually succeed!

What are you securing? 0010101111001110101011 Is it really just the database? What about printed copies Only policies and procedures can protect these. What about backups Can they be stolen? If the building is destroyed can you still recover? What about transient locations Memory scraping, network sniffing, paging file access, EMF monitoring…

Barriers to access The vast majority of important data is not deliberately accessible from the internet Physical access ID/Password Encryption The more barriers you have the harder you make it to reach your data.

Terms Unsecure Secured Obfuscated Encrypted Hashed Accessible and readable without much or any manipulation. Secured Access mechanisms refuse to present the data. Obfuscated Information to return to clear text is available. Encrypted Additional information is required to get clear text. Hashed Can’t be reversed. Many data blocks produce the same hash.

ID/Password Obfuscating words is not effective against programs Replacing O with 0 or S with $.... Use MORE than 14 characters So the easily broken legacy LM Hash is not computed. http://en.wikipedia.org/wiki/LM_hash Phrases or sentences are easier to remember than ‘p@$sw0rds!’. Passwords can contain ANY Unicode character Single sign-on systems reduce your options to the LCD. If forced: Use a keyboard pattern rather than words. If possible include non-ASCII characters like <alt>0176 (° degree). Don’t use predictable patterns DPAPI must store all prior passwords to work. https://www.elie.net/go/p14a

Physical Access Means Access to: The machine holding the data A network with access to the machine Backups of the machine User hardcopies User storage media (phone, thumb drive…)

Nullifying the Physical Access Barrier Key Sweeper video https://www.youtube.com/watch?v=WqkmGG0biXc

Nullifying the ID/Password barrier Network sniffing EMF sniffing Written or easily guessed passwords Malware introduced by user activity Malware introduced through lack of barriers Malware introduced due to barrier weaknesses EXCESSIVE ACCESS

Nullifying Encryption Having strong keys and protecting them is paramount. Microsoft SQL Server uses DPAPI which is vulnerable to certain software attacks. (See https://www.elie.net/go/p14a) It can’t protect its keys from an ‘inside job’. Where security is truly critical a 3rd party hardware based encryption system (using the EKM interface) is almost mandatory. These have no interface to reveal their keys. Only the box can decrypt what it encrypts.

Microsoft SQL Server Service Account Needs very little more than access to the directories where data, log and snapshot files are stored. Don’t give it more. Certainly not admin access! Configure credentials for use in specific cases where additional authority is required for other tasks; be they agent jobs, replication, service broker etc. Nothing else should ever be allowed to run under the service account. DPAPI protects the keys protecting credentials, certificates and data so anything using the same account can compromise those keys.

Understanding LOGINs At the ‘Server Instance’ level the Instance: Deals only with LOGINs (Stored in Master unless contained DB is on) Performs all authentication (even in contained DB env) A Login only needs connect authority to be authenticated (given a session) in the instance (unless they specify an initial catalog which is contained) Once a session is granted Server level permissions control what server level operations can be performed. None are required. Database permissions control database level activity

Understanding USERs At the Database level a database Deals only with USERs Delegates any authentication back to the instance (Contained databases are no exception – it’s a mater of where the data resides) Any unknown login is mapped to the GUEST user if enabled (It’s not, by default) If a login, certificate or asymmetric key isn’t mapped to a user NO access is granted

Ownership Chaining There are always 2 sets of permissions in effect when a procedure is running: Yours & the procedure’s. Works for row level access & execute only (DML). If you have access to a view, function or procedure, that access automatically extends to any other view, function, procedure or table owned by that object’s owner. No extra authority needs to be granted. Applies to any view, function or procedure you can use (for any reason: grant, chaining, execute-as, signing certificate). Includes cross database access in specific cases. This permission is NOT affected by a DENY on the user executing the statement.

Giving Permissions through Stored Procedures Ownership Chaining Read & Execute Read & Execute Giving Permissions through Stored Procedures http://www.sommarskog.se/grantperm.html

Ownership Chaining Doesn’t work when: Referenced objects are owned by another user. (breaks chain) Dynamic SQL is executed. (no owner - breaks chain) In cross database situations where: The SERVER LEVEL setting of ‘cross db ownership chaining’ is off (off by default). The request isn’t made by a Login mapped to a user in the referenced database (not a user) EXECUTE AS <User> is specified. Only Logins can make cross database calls.

Impersonation CREATE … WITH EXECUTE AS {owner|caller|self} CREATE … WITH EXECUTE AS [user = ] 'dbUser' CREATE … WITH EXECUTE AS LOGIN = 'Domain\User' Works on Multi-statement functions, stored procedures, triggers and queues. Operates as if that ID executed the function or procedure. DO NOT impersonate authoritative users such as dbo, OWNER or SELF (violates least privilege). Ownership chaining continues to work

Certificate Signing CREATE CERTIFICATE CertForUser … CREATE USER CertUser FROM CERTIFICATE CertForUser ADD SIGNATURE TO SensitiveProc BY CERTIFICATE CertForUser … Permissions are assigned by granting them to the user (or login) associated with the certificate. Works on Multi-statement functions, stored procedures, triggers and queues. An object can be signed by multiple certificates. The permissions the signature imparts are not inherited by referenced objects. Ownership chaining continues to work

Differences between certificate user and a user without login You can assign a procedure permissions from multiple certificates but you can only execute AS a single user or login Execute AS persists as nested calls are made (unless another EXECUTE AS intervenes) Execute AS changes CURRENT_USER() thus auditing should refer to ORIGINAL_LOGIN() Certificate permissions don’t persist (although ownership chaining does)

Test Script

Chaining

Certificate

Execute AS

Trustworthy Pros: Cons: This server level permission is granted to a specific database, not all databases. A database used only by the SA has the potential to be a ‘trustworthy’ database. Cons: Once granted, the database can impersonate any login – including logins with SA access!

Database Chaining Pros: Cons: No system level permissions can be compromised because only EXEC and row-level operations are affected Cons: The setting isn’t database specific. All databases are affected. As a DBO I can add any ID that exists in another database then use chaining to read/update/delete rows in any table.

Concepts I didn’t have time to cover Implications to allowing contained databases SSL – Requiring encrypted connections Dedicated Admin Connection considerations Impersonating non-database users Auditing Using the Login trigger & CONTEXT_INFO() Allowing non-SA users to perform bulk insert. Implementing row level security Encryption (backups, TDE, Columns)