• subscribe
June 20, 2011 12:37 PM

Hardening SQL Server

Minimize security risks to protect your data
SQL Server Pro
InstantDoc ID #135858

SQL Server applications rely on data, and protecting that data has never been more important than it is today. SQL Server is a popular target for hackers, so your data is at risk of being intentionally compromised. In addition, your data is at risk of being accidentally compromised. You can minimize these risks by hardening SQL Server, which involves reducing its surface area and controlling access to it.

 

Reducing the Surface Area

The pathways that can be exploited to gain access to or elevate privileges in SQL Server are referred to as the surface area. To reduce the surface area of SQL Server, apply the following best practices.

Install only the required SQL Server components. Installing SQL Server is often looked at as little more than a mundane task, but that’s when you need to begin your hardening efforts. When installing SQL Server, you shouldn’t include SQL Server Analysis Services (SSAS), SQL Server Integration Services (SSIS), or the Full-Text Engine and its Filter Daemon Launcher. It’s easy to add these components later if they’re required. 

Don’t install SQL Server Reporting Services (SSRS) on the same server as the database engine. If you install SSRS on the same server as the database engine, Web services will open a hole in your security layer. Historically, IIS and Web services have had a lot of vulnerabilities, which allowed hackers to take control of the server, thus putting anything hosted on the server at risk. You can avoid this risk by not installing SSRS on the database server.

Disable the SQL Server services that won’t be immediately used. You should disable (or leave disabled) the services that aren’t being used. For example, you should:

  • Disable the SQL Server VSS Writer service, which is the SQL Writer Service that’s used by the Volume Shadow Copy Service (VSS). It should be enabled only when it’s being actively used.
  • Leave the Active Directory Helper service disabled. SQL Server will enable and disable it as needed.
  • Leave the SQL Server Browser service disabled. This service, which typically isn’t required, responds to requests for SQL Server resources and redirects the caller to the correct port. Keeping the Browser service disabled will remove the redirector as an attack vector, helping to obscure the correct entry ways into your SQL Server components.

Don’t use the default TCP/IP ports. After installation, you should configure SQL Server to use nondefault numbers for the TCP/IP ports. The default ports are known entry points into SQL Server, and they have been exploited in the past. This is less of a concern if your server isn’t accessible through the Internet, but viruses, Trojan horses, and hackers have other ways to exploit these holes. This approach doesn’t remove an attack pathway; it merely conceals it. Thus, it’s known as security by obscurity.

Disable the network protocols that aren’t required. You should disable (or leave disabled) the network protocols that aren’t needed. In most cases, both Named Pipes and TCP/IP aren’t needed for connecting to SQL Server, so you should determine the best network protocol for your server and disable the other one. For example, Figure 1 shows Named Pipes disabled and TCP/IP enabled but configured to listen on a nondefault port.

Figure 1: Disabling the network protocols that aren’t required
Figure 1: Disabling the network protocols that aren’t required

In Figure 1, note the status of the Shared Memory and Virtual Interface Adapter (VIA) protocols. You can usually leave Shared Memory enabled because this protocol is used by only local connections on the server. However, you should leave the VIA protocol disabled unless you’re using VIA hardware.

Make sure that the antivirus and firewall software versions are current and configured correctly. To be properly protected, the server should be running a current version of the antivirus and firewall programs. In addition, they should be configured to close any ports that might have been left open by default. For example, you need to make sure that the firewall isn’t leaving the default port for SQL Server open.

Manage the surface area configurations. After you initially reduce the surface area, you need to manage its configurations. In SQL Server 2005, Microsoft introduced the Surface Area Configuration Manager (and its command-line counterpart sac.exe) for this purpose. However, this tool performs only the most common management tasks (e.g., enabling remote connections and supported protocols). To perform the less common tasks (e.g., designating service accounts and authentication mode), you need to use the SQL Server Configuration Manager, the system stored procedure sp_configure, or a Windows tool (e.g., Windows Management Instrumentation—WMI).



ARTICLE TOOLS

Comments
  • Robert L Davis
    5 months ago
    Sep 15, 2011

    Hi dbird, thanks for the comment! Definitely, the older it the SQL Server version, the harder it is to add different components. This is an area where the SQL team have made pretty good improvements.

  • dbird
    5 months ago
    Sep 08, 2011

    I cannot agree with your statement "Its easy to add these components later if theyre required. "

    We did that for SQL Server 2005 Reporting Services and it was painfully difficult getting it to install after a few SQL Server patches. We install all. For the features we do not need at the moment we set their service to manual or disabled.

    On production I put SSRS on its own server but not for security reasons. I found SSRS can cause CPU or memory contention on shared database servers. Also when it comes time to migrate a server to a new release of SQL Server, keeping SSRS seperate makes it easier to migrate databases and reports seperately.

    Just my 2 Cents, thanks for the article. It offers many ideas worthy of thought and consideration.

You must log on before posting a comment.

Are you a new visitor? Register Here
  • SQL on VMware
    A couple questions here. 1. Thoughts for mission critical SQL hosted on VMware? 2. Is SQL 2008...
  • Import data from text file in SQL Server
    Hello Everyone, I want to import data from text file in SQL Server. SO I want to know whether any o...
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...