Now that you did get a chance to see my previous post around Database designs there have been few who have asked more of these posts. In continuation to that concept, this blog post will concentrate on highlighting the SQL Server security practices that I often call out and recommend to customers in our Architecture and design sessions. As always the disclaimer remains the same – these are generic practices / suggestions and might not be the same in your environment and deployment scenarios.
Security is a topic that is always seen as a after thought and I start reiterating to our every single customer how critical and important this is. Most of these are to be done by the database administrator of the environment. It is also left to us to keep track and constantly audit if any of them have been deviated or broken.
Other Practices posts have been:
This by no means is not the end-all list of security tips I suggest. But this is a great starting point for you.
- The SQL Server service pack level is current.
- Ensure physical security of your server and only authorized people get access to the datacenter.
- Make sure SQL is installed with Windows Authentication as much as possible.
- Cross database ownership chaining is disabled.
- Always block TCP port 1433 and UDP port 1434 on your perimeter firewall. If named instances are listening on additional ports, block those too.
- Database Engine Ad Hoc distributed queries is disabled.
- Make sure xp_cmdshell is disabled. Don’t use it.
- The default trace option is enabled by default. Though non-intrusive, check the need if the same needs to be on production environment.
- The DB software installation account is restricted to authorized users only.
- Automated tools are used to provide audit trail reports using System Center or any other tool.
- SQL Server Agent jobs are monitored in accordance with procedures for failures and success.
- Database data files are stored in the same logical storage partition and permissions are proper.
- Never install SQL Server on a domain controller.
- The ports which the DB uses should be configured appropriately and must not be left to default (1433).
- SQL Server registry keys should be properly secured.
- Plan for an upgrade/migration plan to address an unsupported DB software version.
- Remove sample databases from production servers.
- Make sure DB password complexity has not been disabled.
- DB account passwords are set to expire every 60 days or more frequently based on your environment.
- The sa password has been changed from the default. Disable "sa" and make sure to rename them.
- Make sure the ‘remote admin connections’ (also referred to as the Dedicated Administrator Connection (DAC)) option is not disabled.
- Dedicated accounts have to be designated for SQL Server Agent proxies.
- The Database installation account is separate from the logged in user on the server.
- Do review changes to DBA role assignments and the logins who have DBA role access.
- Make sure no unnecessary privileges granted to the Windows Service accounts or to Windows Users on the local machine.
- The SQL Server service uses a least-privileged local or domain user account.
- The SQL Server service account is not assigned excess host system privileges.
- Audit trail data is not maintained for one year.
- The auditing of logins is configured for failed (or all) logins.
- Database executable and configuration files are being monitored for unauthorized modifications.
- Transaction logs have to be reviewed for unauthorized modification of classified data.
- Audit trail data is reviewed regularly to detect database access by unauthorized applications.
- Audit records are restricted only to authorized individuals.
- Make sure audit logs are included in backup operations regularly.
- Auditing attempts to bypass access controls must be logged.
- Trace Rollover should be enabled for audit traces that have a maximum trace file size.
- Database passwords used by batch and/or job processes should be in encrypted format.
- Sensitive information stored in the database has been identified and protected using encryption.
- The Service Master Key is backed up and stored offline and off site.
- Make sure the procedures and restrictions for import of production data to development databases are implemented. If obfuscation of data needs to be done while importing, this needs to be adhered to.
- Access to Master Key is restricted, controlled and audited.
- Symmetric keys should use a master key, certificate, or asymmetric key to encrypt the key.
- Permissions assigned to PUBLIC or GUEST for a database must be reviewed monthly.
- Application user privilege has to be reviewed monthly or more frequently to ensure compliance with least privilege and documented policy of your organization.
- Track who has permissions in using the WITH GRANT OPTION.
- Never grant permissions to the public database role.
- Do not enable the guest account.
- Periodically scan fixed server and database roles to ensure that membership is only granted to trusted individuals.
- Ensure that the mapping between database users and logins at the server level is correct.
- Assign permissions to roles rather than directly to users.
- Objects may be owned by roles / schemas, rather than directly by users, if you want to avoid application changes when the owning user is dropped.
Common Security Lapses
- DB backup and restoration files are not protected from unauthorized access.
- Make sure the Database Master Key passwords are not stored in credentials within the database.
- Database backup procedures are defined and implemented properly.
- Backup and recover procedures have been implemented/tested.
- Check for unapproved inactive or expired database accounts on the database/server.
- The DB is periodically tested for vulnerability management and compliance.
- Make sure the database is NOT accessible to internet users and is located in a DMZ.
- Replication snapshot folders are protected from unauthorized access.
Linked server providers should not allow ad hoc access.
- Developers are not assigned excess privileges on production databases.
- The Named Pipes network protocol is disabled.
- The Analysis Services ad hoc data mining queries configuration option has been disabled.
- Analysis Services Anonymous Connections are disabled.
- Track and audit stored procedures executing at startup.
- Error log retention should be set to meet log retention policy. Else increase number of Log files.
- Database TRUSTWORTHY status should be authorized and documented or set to off.
- The SMO and DMO SPs option should be set to disabled if not required. Try not to use this.
- The Agent XPs option should be set to disabled if not required.
- Database Engine Ad Hoc distributed queries should be disabled.
- Run separate SQL Server services under separate Windows accounts.
- Assign static ports to named instances of SQL Server.
- Keep an inventory of all versions, editions, and languages of SQL Server for which you are responsible. Include instances of Express Editions in your inventory as it will help in patching.
Do tell me if you found this useful and I am sure there are areas of Development and coding that I will write in future blog posts.Share this article
This entry was posted on Friday, March 8th, 2013 at 08:00 and is filed under Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.