Securing SQL Server 2000 Resource Guide

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Here are ten things you can do today to improve the security of your SQL Server installation:

On This Page
  1. Install the Most Recent Service Pack.
  2. Assess Your Servers Security with Microsoft Baseline Security Analyzer (MBSA).
  3. Use Windows Authentication Mode.
  4. Isolate Your Server and Back It Up Regularly.
  5. Assign a Strong sa Password.
  6. Limit Privilege Level of SQL Server Services.
  7. Disable SQL Server Ports on Your Firewall.
  8. Use the Most Secure File System.
  9. Delete or Secure Old Setup Files.
  10. Audit Connections to SQL Server.
    Ongoing Security Maintenance
    Additional Security Resources

1) Install the Most Recent Service Pack.

The single most effective action you can take to improve the security of your server is to upgrade to SQL Server 2000 Service Pack 3a (SP3a). To download SP3a, visit the SQL Server 2000 SP3a page.

You should also install all security patches as they are released. To sign up to be notified by e-mail of new security patches, visit the Product Security Notification page.

2) Assess Your Servers Security with Microsoft Baseline Security Analyzer (MBSA).

MBSA is a tool that scans for common insecure configurations in several Microsoft products including SQL Server and Microsoft SQL Server 2000 Desktop Engine (MSDE 2000). It can be run locally or over a network. It tests SQL Server installations for problems such as:

  • Too many members of the sysadmin fixed server role.

  • Granting of right to create CmdExec jobs to roles other than sysadmin.

  • Blank or trivial passwords.

  • Weak authentication mode.

  • Excessive rights granted to the Administrators group.

  • Incorrect access control lists (ACLs) on SQL Server data directories.

  • Plaintext sa password in setup files.

  • Excessive rights granted to the guest account.

  • SQL Server running on a system that is also a domain controller.

  • Improper configuration of the Everyone group, providing access to certain registry keys.

  • Improper configuration of SQL Server service accounts.

  • Missing service packs and security updates.

  • Microsoft distributes MBSA as a free download. For complete documentation and the latest version of MBSA, visit the MBSA page.

3) Use Windows Authentication Mode.

Whenever possible, you should require Windows Authentication Mode for connections to SQL Server. This will shield your SQL Server installation from most Internet-based attacks by restricting connections to Microsoft Windows user and domain user accounts. Your server will also benefit from Windows security enforcement mechanisms such as stronger authentication protocols and mandatory password complexity and expiration. Also, credentials delegation (the ability to bridge credentials across multiple servers) is only available in Windows Authentication Mode. On the client side, Windows Authentication Mode eliminates the need to store passwords, which is a major vulnerability in applications that use standard SQL Server logins.

To set up Windows Authentication Mode security with Enterprise Manager in SQL Server:

  1. Expand a server group.

  2. Right-click a server, and then click Properties.

  3. On the Security tab, under Authentication, click Windows only.

For more information, see the "Authentication Mode" topic in SQL Server Books Online or on MSDN.

4) Isolate Your Server and Back It Up Regularly.

Physical and logical isolation make up the foundation of SQL Server security. Machines hosting a database should be in a physically protected location, ideally a locked machine room with monitored flood detection and fire detection/suppression systems. Databases should be installed in the secure zone of your corporate intranet and never directly connected to the Internet. Back up all data regularly and store copies in a secure off-site location.

5) Assign a Strong sa Password.

The sa account should always have a strong password, even on servers that are configured to require Windows Authentication. This will ensure that a blank or weak sa password is not exposed in the future if the server is reconfigured for Mixed Mode Authentication.

To assign the sa password:

  1. Expand a server group, and then expand a server.

  2. Expand Security, and then click Logins.

  3. In the details pane, right-click SA, and then click Properties.

  4. In the Password box, type the new password.

For more information, see the "System Administrator (sa) Login" topic in SQL Server Books Online or on MSDN.

6) Limit Privilege Level of SQL Server Services.

SQL Server 2000 and SQL Server Agent run as Windows services. Each service must be associated with a Windows account, from which it derives its security context. SQL Server allows users of the sa login, and in some cases other users, to access operating system features. These operating system calls are made with the security context of the account that owns the server process. If the server is cracked, these operating system calls may be used to extend the attack to any other resource to which the owning process (the SQL Server service account) has access. For this reason, it is important to grant only necessary privileges to SQL Server services.

The following settings are recommended:

  • SQL Server Engine/MSSQLServer

    If there are named instances, they will be named MSSQL$InstanceName. Run as a Windows domain user account with regular user privileges. Do not run as local system, local administrator, or domain administrator accounts.

  • SQL Server Agent Service/SQLServerAgent

    Disable if not required in your environment; otherwise run as a Windows domain user account with regular user privileges. Do not run as local system, local administrator, or domain administrator accounts.

    Important: SQL Server Agent will need local Windows administrator privileges if one of the following is true:

  • SQL Server Agent connects to SQL Server using standard SQL Server Authentication (not recommended).

  • SQL Server Agent uses a multiserver administration master server (MSX) account that connects using standard SQL Server Authentication.

  • SQL Server Agent runs Microsoft ActiveX script or CmdExec jobs owned by users who are not members of the sysadmin fixed server role.

If you need to change the account associated with a SQL Server service, use SQL Server Enterprise Manager. Enterprise Manager will set appropriate permissions on the files and registry keys used by SQL Server. Never use the Services applet of Microsoft Management Console (in Control Panel) to change these accounts, because this requires manual adjustment of dozens of registry and NTFS file system permissions and Microsoft Windows user rights.

For more information, see the Microsoft Knowledge Base article Change the SQL Server Service Account Without Using SQL Enterprise Manager in SQL Server 2000.

Changes to account information will take effect the next time the service is started. If you need to change the account associated with SQL Server and SQL Server Agent, you must apply the change to both services separately using Enterprise Manager.

7) Disable SQL Server Ports on Your Firewall.

Default installations of SQL Server monitor TCP port 1433 and UDP port 1434. Configure your firewall to filter out packets addressed to these ports. Additional ports associated with named instances should also be blocked at the firewall.

8) Use the Most Secure File System.

NTFS is the preferred file system for installations of SQL Server. It is more stable and recoverable than FAT file systems, and enables security options such as file and directory ACLs and file encryption (EFS). During installation, SQL Server will set appropriate ACLs on registry keys and files if it detects NTFS. These permissions should not be changed.

With EFS, database files are encrypted under the identity of the account running SQL Server. Only this account can decrypt the files. If you need to change the account that runs SQL Server, you should first decrypt the files under the old account, then re-encrypt them under the new account.

9) Delete or Secure Old Setup Files.

SQL Server setup files may contain plain-text or weakly encrypted credentials and other sensitive configuration information that has been logged during installation. The location of these log files varies depending on which version of SQL Server has been installed. In SQL Server 2000, the following files may be affected: sqlstp.log, sqlsp.log, and setup.iss in the <systemdrive>:\Program Files\Microsoft SQL Server\MSSQL\Install folder for a default installation, and the <systemdrive>:\Program Files\Microsoft SQL Server\ MSSQL$<Instance Name>\Install folder for named instances.

If the current system is an upgrade from SQL Server version 7.0 installations, the following files should be checked as well: setup.iss in the %Windir% folder, and sqlsp.log in the Windows Temp folder.

Microsoft distributes a free utility, Killpwd, which will locate and remove these passwords from your system. To learn more about this free download, see the Microsoft Knowledge Base article Service Pack Installation May Save Standard Security Password in File.

10) Audit Connections to SQL Server.

SQL Server can log event information for review by the system administrator. At a minimum, you should log failed connection attempts to SQL Server and review the log regularly. When possible, save these logs to a different hard drive than the one on which data files are stored.

To enable auditing of failed connections with Enterprise Manager in SQL Server:

  1. Expand a server group.

  2. Right-click a server, and then click Properties.

  3. On the Security tab, under Audit Level, click Failure.

You must stop and restart the server for this setting to take effect.

For more information, see "SQL Server 2000 Auditing" on Microsoft TechNet and the "Using Audit Logs" topic in SQL Server Books Online or on MSDN.

Note: For information on protecting your server against the Slammer worm, visit the Finding and Fixing Slammer Vulnerabilities page. For detailed information about security features and best practices for SQL Server 2000 Service Pack 3 (SP3), read the article "Microsoft SQL Server 2000 SP3 Security Features and Best Practices".

Ongoing Security Maintenance

Without ongoing maintenance, your system can become vulnerable to new forms of attacks. Further, the security of your system will degrade over time due to human error of administrators managing the system. Follow these recommended steps on a regular basis:

  1. Use the Baseline Security Analyzer regularly to scan and evaluate the security of SQL Server.

  2. As new security fixes become available, it is important to apply these new fixes.

Additional Security Resources

You can find additional information about keeping your SQL Server 2000 servers secure in the following sources:

SQL Server 2000 C2 Administrator's and User's Security Guide