Home > SQL Server Tips > Microsoft SQL Server > Discover and lock down vulnerable SQL Server services
SQL Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MICROSOFT SQL SERVER

Discover and lock down vulnerable SQL Server services


Kevin Beaver, CISSP
03.21.2006
Rating: -3.75- (out of 5)


Expert advice on database administration
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


In a previous tip, 10 hacker tricks to gain access to SQL Server, I outlined various ways SQL Server can be compromised. Here I'm going to expand upon a couple of vulnerabilities that I see time and time again when performing security assessments.

How to discover vulnerable SQL Server systems

I often find that SQL Server-based systems are not adequately protected by a firewall. Yep, the tried-and-true firewall -- the one thing you'd think everyone has -- is still not in place in all situations where SQL Server protection is needed. If this is your setup, you can forget SQL injection attacks; if SQL Server is not protected from the elements, an attacker can access your system directly, whether it's by obtaining a remote-command prompt by exploiting an operating system vulnerability or by cracking operating system or SQL Server passwords. The fact of the matter is that bad things can happen when SQL Server is hanging out in the wind. Firewalling shields the system from an external hacker's point of view and protects it from unauthorized insider access or, ideally, both.

Start testing for vulnerabilities by running SQLPing to locate vulnerabilities, both outside and inside. You can use a port scanner and try to map things out, but the best (free) tool for this is called SQLPing2 from Chip Andrews at SQLSecurity.com.

In Figure 1, I show a sanitized SQLPing2 scan I ran to find some internally accessible systems. Notice that SQLPing2 found systems running SQL Server, the version number, port and even a system with no sa password. It also can discover multiple SQL Server instances running on UDP port 1434, which can be loaded with user name and password lists for more extensive password cracking. I'll cover SQL Server password cracking in a future tip.


Figure 1: Using SQLPing2 to discover SQL Server systems on the internal network.

The beauty of this tool is that you can use it to test your network from the outside world and to see what your firewall is (or isn't) blocking. It does all of this in just a few seconds.

How to lock down vulnerable SQL Server systems

So, now that you've discovered "naked" SQL Server systems running on your network, accessible by people who shouldn't be able to connect, what do you do about it? You've got three cut-and-dried options:

1. Put your SQL Server behind a firewall

I know it sounds obvious, but many applications are written so that SQL Server must be readily accessible by various systems, which often means it doesn't have a network firewall or DMZ network protecting it. Developers and network managers alike think that's the only way to provide such access, or business partners and customers may want it a certain way, but we all know that everything's negotiable.

2. Enable Windows Firewall on your SQL Server system

I know it doesn't sound very "enterprise-like," but it can work -- very well. This is especially true when you're trying to protect SQL Server systems that are already behind a firewall but need protection from unauthorized internal access. Once you enable the Windows Firewall, just create a new port to allow SQL Server traffic from specific systems, as shown in Figure 2.


Figure 2: Use the Windows Firewall to protect SQL Server from unauthorized access.

Usually there are only a select few network systems that need to connect to SQL Server – most do not. The Windows Firewall is a perfect solution here. Whichever firewall option you use, don't forget to allow/block both TCP port 1433 and UDP port 1434 (the latter if you're running multiple database instances on the same server).

3. Protect SQL Server using a database-centric firewall, intrusion detection and monitoring system.

This is a more costly yet enterprise-worthy option. Consider protecting SQL Server with tools like Application Security Inc.'s AppRadar, Imperva Inc.'s SecureSphere or Guardium Inc.'s SQL Guard. These systems go beyond mere port blocking and network access control and actually monitor and block database access and transactions themselves.

I recommend using network and host firewall and IPS controls first -- they will buy you a lot of protection against both internal and external attackers. However, if you perform a vulnerability assessment and still discover security holes, check out the database security solutions I mentioned in option three. Otherwise, just enjoy the absolute peace of mind you will have by locking down the SQL Server system.

About the author: Kevin Beaver, CISSP, is an independent information security consultant, author and speaker with Atlanta-based Principle Logic LLC. He has more than 18 years of experience in IT and specializes in performing information security assessments. Beaver has written five books including Hacking For Dummies (Wiley), Hacking Wireless Networks For Dummies, (Wiley) and The Practical Guide to HIPAA Privacy and Security Compliance (Auerbach). He can be reached at kbeaver@principlelogic.com.

More information from SearchSQLServer.com

  • Tip: Ten hacker tricks to exploit SQL Server systems
  • Tip: Using Metasploit for real-world security tests
  • Checklist: How to test SQL Server security

  • Rate this Tip
    To rate tips, you must be a member of SearchSQLServer.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


    RELATED CONTENT
    Microsoft SQL Server
    Top 10 SQL Server development tips of 2008
    Avoid cursors in SQL Server with these methods to loop over records
    Implementing security audit in SQL Server 2008
    What's new in SQL Server 2008 Reporting Services?
    SQL Server replication methods: Snapshot, merge or transactional
    New security features in SQL Server 2008 leave some work for you
    How to disable the shrink database task in SQL Server 2000 and 2005
    New datetime data types in SQL Server 2008 offer flexibility
    SQL Server out of memory: Troubleshoot and avoid SQL memory problems
    SQL Server errors, failures and other problems fixed from the trenches

    SQL Server security
    Implementing security audit in SQL Server 2008
    Tutorial: Learn SQL Server basics from A-Z
    New security features in SQL Server 2008 leave some work for you
    Can I encrypt and restore a database backup in SQL Server 2005?
    FAQ: How to troubleshoot and grant SQL Server permissions
    Secure SQL Server from SQL injection attacks
    How insiders hack SQL databases with free tools and a little luck
    Sarbanes-Oxley compliance checklist: IT security and SQL audits
    SQL Server source code analysis and management adds database security
    Ten common SQL Server security vulnerabilities you may be overlooking

    RELATED GLOSSARY TERMS
    Terms from Whatis.com − the technology online dictionary
    data corruption  (SearchSQLServer.com)
    data hiding  (SearchSQLServer.com)

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary

    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



    SQL Server Development - .NET, C#, T-SQL, Visual Basic
    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts