Home > Security Tips > Tech Tips > Stop direct attacks on SQL servers
Security Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

TECH TIPS

Stop direct attacks on SQL servers


Seth Fogie and Cyrus Peikari
12.18.2002
Rating: -5.00- (out of 5)


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


This tip, excerpted from InformIT, offers some ideas on how to secure your SQL server against hackers. Forewarned is, of course, forearmed.


Every SQL server application has a default administrator account. This account is used by the database administrator to set up databases, create user accounts, assign permission, and more. However, when a database server application is installed, this account must have a default password so that the database administrator (DBA) can access the database software for required setup and configuration tasks. The following is a list of the most common database applications and their default DBA accounts:

NameUserPassword
OracleSysoracle
MySQLRootnull
MS SQL ServerSaNull
DB2Dlfmibmdb2

This list of usernames/passwords is not complex and can be found at any number of Web sites. For this reason, one of the first tasks a DBA is urged to perform when setting up and configuring the SQL server is to assign a strong password to the database program administrator account (root, sa, sys, dlfm). Unfortunately, this is often completely ignored or procrastinated until it is forgotten. In other words, any hacker who stumbled upon this server connected to the Internet could completely own the data on it -- and perhaps the network to which the server is attached.

In addition to a lack of passwords, many DBAs use weak passwords that can be found in a dictionary, that are short (less than six characters), or that are common names, places, or events. These databases are also sitting targets for almost any hacker that detects the SQL server software via a port scan. As we will next illustrate, using programs, a hacker can simply throw passwords at the SQL server until it cracks. If the password is missing or is weak, it will be only a matter of minutes before he has access to the data.

Finding a SQL server is a simple task. It merely takes a properly configured port scanner or a scripted SQL scanner, to create a list of targets. For example, SQLScanner, which is a program available online (included in the SQLTools suite), allows a hacker to scan tens of thousands of computers at one shot looking for MS SQL Servers.

Once a hacker has a list of targets, the next step is to probe each server for more information about the version, port, and method by which it accepts incoming requests.

This program tells the hacker how to connect to the database and what methods may or may not work. In addition, it provides the SQL server's name, which can be handy when guessing passwords and determining the purpose of the server.

Next, a hacker probes the SQL server for weak accounts. Using a program such as SQLDict or SQLCracker (also included with the SQLTools suite), a hacker can quickly and systematically take a dictionary file and test the strength of a SQL server. Unfortunately, a scan lasting no more than five minutes often returns some positive results.

Once a hacker has access to a DBA account, or even a normal user account, the next step is to use that username and password to connect to a database server and take ownership of that data. In other words, this hacker can now download, updated, and delete data at his whim. This type of control may not come as a surprise, but were you aware that a database account can also give a hacker full access to the file system on a server, or even to the files on the network to which it is connected?

To show the power of DBA access, we will illustrate one of the many ways a hacker can abuse a SQL server to anonymously gain access to its files via a hijacked DBA account.

First, a hacker needs a method of sending anonymous requests to a database server. Fortunately, this requires only a Web site that is hosted at a company that supports scripting. On a remote Web site, a hacker can program or just upload a script that connects to and delivers a request to SQL server. One example of this type of application can be found at www.aspalliance.com/mtgal/source_code/tsql.exe. Once extracted, this ASP file provides its user with the ability to manually enter a connection string that sets up a connection to a remote SQL server. Once connected, this ASP application sends the entered SQL command to the target and outputs the results. Although a script like this has great legitimate uses, it is easy to see how it can also be abused.

The next step is to send an authenticated SQL request to the database server containing a command that helps the hacker gain full access to the server. One popular method is to use the xp_cmdshell extended stored procedure included with MS SQL Server. This script actually serves as a portal to the cmd.exe file of the server. In other words, a SQL command can move files or perform a directory listing. However, this command can take nefarious forms, including using TFTP to download ncx99.exe (a popular remote shell Trojan) or copying the server's SAM user account file to the Web server root folder so that it can be downloaded anonymously and then cracked. The point is, the database program on the server is only one of many possible items that can be compromised by a direct SQL attack.


To read the entire article from which this tip is excerpted, click over to InformIT. You'll have to register there, but the registration is free.


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




BROWSE BY TAG
Tech Tips,   Application and Platform Security,   Database Security Management,   VIEW ALL TAGS

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



RELATED CONTENT
Tech Tips
Video: The foundation of an email security strategy
The 5 A's of functional SAN security
Effective storage security policies
Smart options for safeguarding stored data
Outfox SOX: How to make regulations work for you
Roberta Bragg's 10 Windows hardening tips in 10 minutes
Using free network intrusion detection and prevention tools to stop hacks
Hacker techniques and exploits: Prevent system fingerprinting, probing
How to stop hacker theft: Employee awareness, risk assessment policies
Information Security Decisions Fall 2004: Speaker presentations

Database Security Management
What is the best database patch management process?
Unpatched vulnerability discovered in Microsoft SQL Server
SQL injection continues to trouble firms, lead to breaches
Oracle issues quarterly patches, fixes database flaws
Database monitoring, encryption vital in tight economy, Forrester says
Oracle to buy Sun Microsystems for $7.4 billion
Oracle issues 43 updates, fixes serious database flaws
Imperva assigns security risk levels to databases
How to create configuration management plans to install DLP
Information security book excerpts and reviews
Database Security Management Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
data encryption/decryption IC  (SearchSecurity.com)
International Data Encryption Algorithm  (SearchSecurity.com)
link encryption  (SearchSecurity.com)
MD2  (SearchSecurity.com)
MD4  (SearchSecurity.com)
MD5  (SearchSecurity.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.



Research Solutions for Network Security, Access Control and Security Threats
TechTarget Security Media
Information Security View this month\\'s issue and subscribe today.
Information Security Decisions Apply online for free conference admission.
SearchSecurity.com
HomeNewsMagazineMultimediaWhite PapersLearningAdviceTopicsEventsAbout Us

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




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