SQL Server 2008 Security Overview - Presentation Transcript
ISSA Data Security for Audit and Compliance Andrew Fryer Evangelist Microsoft Ltd
Session Objectives
Understand that Security is an important consideration for applications as well as the server
Know what is available in SQL Server and how it can help you achieve security objectives
Agenda
Protecting applications
Data protection
Authentication/Authorization
SQL Injection
SQL 2008 Compliance New Features
Transparent Data Encryption
Extensible Key Management
Audit
A true story.....(kind of)
The Company
The Application
The MD
The IT Manager
The DBA
What happened
Day 1 due diligence
Review and change admin passwords
10 minutes later
Helpdesk reports problems
Login failures
Smoking gun
ODBC DSN
10 minutes later
Helpdesk reports problems
Module failures, report failures
Code review !
using ‘sa’ context!
Code review
Issues
No centralized data access layer
Embedded SQL
Lookup Order:
Lookup Customer:
Connection strings with hardcoded passwords
“ SELECT * FROM Orders WHERE OrderId=“ + varOrderId
SELECT * FROM Customer WHERE SurName Like ‘”+ varSearchTerm +”’”
Provider=sqloledb;Data Source=xxx;Initial Catalog=billingDB;User Id= sa ;Password=‘’;
Protecting Applications
Authentication
Data Encryption
In SQL Server 2000, 3 rd party support required
Since SQL Server 2005
Built-in support for data encryption
Support for key management
Encryption additions in SQL Server 2008
Transparent Data Encryption
Extensible Key Management
Channel Encryption
Support for full SSL Encryption since SQL Server 2000
Clients: MDAC 2.6 or later
Force encryption from client or server
Login packet encryption
Used regardless of encryption settings
Supported since 2000
Self-generated certificates avail since 2005
Permission Strategy
Follow principal of least privilege!
Avoid using sysadmin/sa and db_owner/dbo
Grant required perms to normal login
Never use the dbo schema
User-schema separation
Applications should have own schema
Consider multiple schemas
Leverage Flexible Database Roles
Facilitates role separation
Consider Auditing user activity
Ownership Chaining
Beware of Ownership Chaining
Module Signing
Alice has permission to call SP
SP run under Alice’s context but with elevated privilege
SP protected against tampering
Alice (non privileged login) SP_ENABLE_LOGIN ALTER LOGIN Bob ENABLE Cert_login ALTER ANY LOGIN
Execution Context Best Practices
Controlled escalation of privileges
DB scoped: EXECUTE AS and App Roles
Cross-DB scoped: Certificates
Avoid using dynamic SQL under an escalated context
Do not use use CDOC and SETUSER
Avoid allowing guest access on user DBs
SQL Injection
SQL Injection is an attack where malicious code is inserted into strings and later passed to SQL Server for parsing and execution.
SELECT * FROM Customer WHERE SurName Like ‘”+ varSearchTerm +”%’”
''';DROP TABLE CUSTOMERS--'
SELECT * FROM Customer WHERE SurName Like ‘%’; DROP TABLE CUSTOMERS —’
SQL Injection – defence
Use parameterized SQL queries
Use Type-Safe SqlParameter in .Net
Use parameterized SPs
Least-privilege Principle
Escape special characters
Escape quotes with quotename/replace
Escape wildcards in LIKE statements
Validate buffer length to avoid truncation
class DataAccess { static void GetNewOrders(DateTime date, int qty) { using (NorthWindDB nw = new NorthWindDB ()) { var orders = from o in nw.Orders where o.OrderDate > date select new { o.orderID, o.OrderDate, Total = o.OrderLines.Sum(l => l.Quantity); foreach (SalesOrder o in orders) { Console.WriteLine("{0:d} {1} {2}", o.OrderDate, o.OrderId, o.Total); } } } } Data Access Code with LINQ Query syntax is native application code Data objects are first-class citizens No dynamic SQL therefore no injection
Business Reasons
Compliance requirements for PCI, HIPAA, GLBA among many other acronyms
Key Management, Encryption, and Auditing are key components to meeting these compliance requirements
Refer to Compliance SDK and the SQL Compliance site: http://www.microsoft.com/sql/compliance
Data Encyption
SQL Server 2005
Built-in encryption functions
Key management in SQL Server
Encrypted File System (EFS)
Bit-Locker
SQL Server 2008
Extensible Key Management (EKM)
Transparent Data Encryption (TDE)
Extensible Key Management
Key storage, management and encryption done by HSM module
0 comments
Post a comment