SQL Server Security: Marek Chmel
SQL Server Security: Marek Chmel
Marek Chmel
Lead Database Administrator @ AT&T
MVP: Data Platform | MCSE: Data Management and Analytics
MCT: Regional Lead | Certified Ethical Hacker CEHv8
[email protected]
@MarekChmel
Motivation
§ SQL Server is a major part of IT infrastructure
§ SQL Server stores sensitive data
§ Properly securing SQL Server is crucial for application and DBA team
Session Agenda
§ Understanding Authentication Modes
§ Server Level Security
§ Database Level Security
§ Security Audit
§ Security Review
SQL Security Progress through the time
§ Redefined Engineering security processes – 2005
§ SQL no longer a windows admin – 2005
§ CC EAL4+ for SQL 2005 SP2
§ T-SQL Encrypt/Decrypt functions – 2005
§ Audit – 2008
§ TDE – 2008
§ EKM – 2008
§ Support for Windows Core – 2012
§ Separation of Duty – 2014
§ Always Encrypted, RLS and more on 2016
Organizational Security & Compliance
§ Data Protection
§ Control Access
• User Defined Server Roles
• Default Schema for Groups
• Contained Database Authenticaton
• AAD
§ Compliance
• SQL Server Audit
w Resilience
w User Defined
w Filtering
• 3rd party verified (Common Criteria)
Data Protection
Known for the lowest vulnerabilities across major RDBMS
User
Database Role
User Schema
Database Role
§ SQL 2012+
• hashBytes = 0x0200 | fourByteSalt | SHA512(utf16EncodedPassword+fourByteSalt)
SQL SA
SQL Single User Mode
§ There are several parameters which can be used to start the SQL Server
• Startup parameters –f and –m (single user and minimal configuration)
• With any of these parameters local windows admins are sysadmins for SQL
§ No logon triggers apply with this configuration
DEMO
§ Get-SQLInstanceDomain | Invoke-SQLAuditWeakLoginPw
DEMO
Credential passwords
Linked server passwords
Managing Users
§ Create a login
§ Create a database scope user
§ Assign permissions to the user
Special Users
§ DBO
The sa login and members of sysadmin role are mapped to dbo account
§ Guest
This user account allows logins without user accounts to access a
database
SQL Server Cryptography Architecture
When to Use Keys and Certificates
§ When to use Certificates
• To secure communication in database mirroring
• To sign packets
• To encrypt data or connections
§ When to use Keys
• To help secure data
• To sign plaintext
• To secure symmetric keys
Auditing Security
§ What Is Auditing?
§ Security Auditing with Profiler
§ Auditing with DDL Triggers
§ Introducing SQL Server Audit
§ SQL Server Audit Action Groups and Actions
Auditing with triggers
§ DDL Triggers
• Prevent certain changes in your database schema
• You want something to occur in the database in response to a change in your
database schema
• You want to record changes or events in the database schema
• Start, stop, pause and modify the trace results
• Replay the trace results
§ Logon Triggers
CREATE TRIGGER tr_LogOn_CheckIP ON ALL SERVER
FOR LOGON
Introducing SQL Server Audit
§ SQL Server Auditing
• Tracks and logs events that occur on the system
• Can track changes on the server or database level
• Can be managed with Transact-SQL
DEMO
SQL Audit
Row Level Security
§ Fine-grained access control over specific rows in a
database table
§ Help prevent unauthorized access when multiple
users share the same tables, or to implement
connection filtering in multitenant applications
§ Administer via SQL Server Management Studio or
SQL Server Data Tools
§ Enforcement logic inside the database and schema
bound to the table.
Benefits of row-level security
Always Encrypted
Q&A
Marek Chmel
MVP: Data Platform | MCSE: Data Management and Analytics | MCT: Regional Lead | CEH v8
[email protected]
@MarekChmel