SQL Server Security Best Practices - Database Management - Blogs - Quest Community
SQL Server Security Best Practices - Database Management - Blogs - Quest Community
Data is a critical asset of every organization, and poorly-secured databases are too often to blame for security breaches. This
article details SQL server security best practices, as well as essential security considerations for protecting your databases from
malicious attacks.
https://blog.quest.com/13-sql-server-security-best-practices/ 1/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
Data security is comprised of three essential pillars – confidentiality, integrity and availability (CIA) and deals with specific
processes to protect data from intentional and accidental access. Let’s break down the different areas and steps to take when
approaching SQL Server security, one of the most popular relational databases in use today.
When it comes to SQL Server security, physical security cannot be overlooked. Physical security refers to limiting unauthorized
access to data centers or other physical server components. For example, you can implement a locked room with restricted
access using a smart card, fingerprint or face recognition. You can also configure a restricted network segment for SQL Server.
Data centers house an organization’s infrastructure such as routers, switches, servers, firewalls and storage devices. Physical
security deals with protecting hardware, software and the network from any unauthorized access or natural disasters. It can
involve the following areas:
Securing the premises and equipment access for authorized personal only
Maintaining access control systems
24x7x365 vigilance using on-site security guards or CCTV monitoring
Uninterruptible power supply (UPS)
Having a fire alarm system and an aspirating smoke detection system
Having an active water leakage detector panel
Rodent repellent systems
Fire suppression systems
Controlling and monitoring temperature and humidity
Periodic hardware maintenance
SQL Server is installed on top of an existing operating system such as Windows or Linux. Therefore, operating system security
plays a vital role in SQL Server security. Below are some recommendations for protecting your operating system:
https://blog.quest.com/13-sql-server-security-best-practices/ 2/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
Similarly, you can force the encrypted connection to SQL Server using the following option.
https://blog.quest.com/13-sql-server-security-best-practices/ 3/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
The SQL Server surface area is comprised of database engine features that provide additional functionality such as sending
emails. These components might be a potential target to gain access to SQL Server for malicious activities. Therefore, you
should disable the component and features in SQL Server that are not being used, as this will limit the chances of a potential
attack. The major components that you can review and disable are listed below.
You can refer to this article for detailed information on server configuration options.
Microsoft SQL Server uses the default port 1433 for all database connections. It is a common security risk in many database
environments because database professionals typically do not change the default port. It is a well-known port, and intruders can
utilize this opportunity to access SQL Server. Therefore, you should use a non-default port to harden your SQL Server security.
You can modify this using the SQL Server Configuration Manager.
https://blog.quest.com/13-sql-server-security-best-practices/ 4/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
The protection of your data depends upon the ability to authenticate access to specific data. SQL Server provides two options
for database authentication.
Windows authentication
Windows and SQL authentication (Mixed-mode)
To verify the server authentication model, right-click on the SQL Server instance and navigate to Security.
https://blog.quest.com/13-sql-server-security-best-practices/ 5/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
The Windows authentication uses active directory accounts for authentications. You can have a centralized policy control for
password complexity, password expiration, account lockout and active directory groups in the active directory. Therefore, you
should use Windows authentication instead of SQL Server authentication. Here, the user connects using a Windows account,
and SQL Server validates the credentials using the Windows principal token. It uses the Kerberos security protocol for
authentications. Refer to authentication mode for more details.
However, if you need to use the SQL Server logins, you can still enforce the password policy as highlighted below.
SQL Services uses a Windows account to run its services. You should not use the high-privileged, built-in accounts such as
https://blog.quest.com/13-sql-server-security-best-practices/ 6/9
Network Service or Local System. Similarly, for a domain service account, you should assign role-appropriate privileges.
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
Therefore, I would recommend referring to configure Windows service accounts and permissions for more specifics about SQL
Server service accounts permissions.
Microsoft releases regular service packs (SQL Server 2016 or earlier) and cumulative packs (SQL Server 2017 onwards) for
fixing known issues and security issues. Therefore, you should always plan to implement SQL Server patching on the
production instances. However, do not directly apply patches on production instances. Always apply them first in the test
environment, validate and plan for production deployment.
You can refer to the latest updates for Microsoft SQL Server to find details on the latest service packs and cumulative packs.
When it comes to SQL Server security, securing your backups is critical. Typically, database professionals do not consider all
the requirements for securing database backups. Database backup is the process of creating a copy of the operational state,
architecture and stored data of a database. Therefore, it is equivalently important to protect it. It means restricting access to
backup files and encrypting them properly. When it comes to securing backups, here are a few reminders.
Do not provide everyone with rights on the backup folder to create, view, modify and delete backup files
Use database backups with encryption; refer to this article on backup encryption for more details
A key area in SQL Server security is encryption. You can use various encryption mechanisms to protect sensitive data in your
SQL Server database. The different encryption options are as follows.
Always Encrypted: The always encrypted technique helps to encrypt sensitive data inside the client applications. The
always encrypted-enabled driver automatically encrypts and decrypts sensitive data in the client applications. The
encryption keys are never revealed to the SQL Server database engine. It protects confidential data.
Transparent data encryption (TDE): The TDE encrypts data at rest. It helps to secure the data files, log files and backup
files.
Column-level encryption: Column-level encryption helps to encrypt specific column data, for example, credit card
numbers and social security numbers.
Static data masking: Static
https://blog.quest.com/13-sql-server-security-best-practices/ data masking replaces the sensitive data using the defined data transformation rules. 7/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
Dynamic data masking: Dynamic data masking helps to limit sensitive data exposure to non-privileged users.
Row-level security: The row-level security restricts the data row access.
If you are using SQL authentication, it creates a login SA with the sysadmin permissions. To safeguard your SQL Server, do the
following.
Auditing is often overlooked when it comes to SQL Server security. You should do regular SQL Server auditing for failed
logins. You can use the default login audit mechanism for reviewing the accounts. For example, suppose any user is trying to
connect to SQL Server with a high privilege account. In that case, you can see the login failure and incoming request (client) IP
address. This can help you capture and eliminate suspicious activity.
You can use the extended events, SQL trace, change data capture, triggers (DDL, DML or Logon), database or server-level
audit specifications for the SQL Server audit.
Database professionals should be careful when assigning server-level or database-level permissions. Sometimes, we see that
developers get sysadmin at the server level or the database owner’s permissions at the database level. These are the highest
permissions a user can have on an instance or database level, respectively.
Refer to fixed server-level roles to understand fixed server-level roles and their capabilities.
Refer to database-level roles to better understand fixed database-level roles.
https://blog.quest.com/13-sql-server-security-best-practices/ 8/9
6/16/23, 3:58 PM SQL Server Security Best Practices - Database Management - Blogs - Quest Community
SQL Server uses the browser service for the named instance. It listens to all incoming requests for SQL Server connections. It
uses UDP port 1434 and responds to the requests with the TCP/IP port number required to connect to SQL Server. Therefore,
you can turn off the browser service and explicitly define the port number in the application strings. This avoids port number
exposure to the incoming connection requests and helps with the security of SQL Server.
You can refer to the article How SQL Server browser works to better understand the SQL Server browser service.
https://blog.quest.com/13-sql-server-security-best-practices/ 9/9