Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Checking my SQL Server log I see several entries like this:

Date: 08-11-2011 11:40:42
Source: Logon
Message: Login failed for user 'sa'. Reason: Password did not match for the login provided. [CLIENT:]
Date: 08-11-2011 11:40:42
Source: Logon
Message: Error: 18456. Severity: 14. State: 8.

Date: 08-11-2011 11:40:41
Source: Logon
Message: Login failed for user 'sa'. Reason: Password did not match for the login provided. [CLIENT:]
Date: 08-11-2011 11:40:41
Source: Logon
Message: Error: 18456. Severity: 14. State: 8.

And so on.. Is this a possible attack on my SQL Server from the chineese???! I looked up the IP adress, at which stated it was chineese.

And what to do? - Block the IP adress in the firewall? - Delete the user sa?

And how do I protect my web server the best?! :)

Thanks in advance!

share|improve this question

migrated from Nov 8 '11 at 12:20

This question came from our site for professional and enthusiast programmers.

Not really a programming question. – paxdiablo Nov 8 '11 at 12:17
Probably better suited or – S.L. Barth Nov 8 '11 at 12:20
Ah, sorry for that :) Thanks for the migrate. – Behrens Nov 8 '11 at 12:23
up vote 4 down vote accepted

It looks like a cheap brute force attack.

The fact that the whole internet can get as far as attempting to authenticate against your SQL Server is probably a massive problem. Unless you have particular reasons for this, access to SQL should be restricted to only those servers that require access to the resource.

Also, don't go down the line of blocking specific IP addresses, or you'll never stop. Block everything except authorised locations. And don't delete your user accounts unless you're certain you don't need them.

share|improve this answer
How do i block everything except for the localhost and my specific work ip-adress (I'm doing the programming via my IIS server on my laptop and thereafter uploading it to the web). – Behrens Nov 8 '11 at 12:54
By using a VPN. – Bart Silverstrim Nov 8 '11 at 13:18
Pretty much. Having anythign open to the niternet is gross negelct. Put up a firewall, vpn into the server using a secure protocol, be happy. – TomTom Mar 28 '12 at 11:27

Can you explain your layout a bit better?

Are you allowing SQL logins from the internet, or any sort of SQL traffic at all? If so, why?

You should be severely restricting any sort of connections to your SQL server to your local network or to specific external IPs (although I'd suggest something more secure if you have that need).

My solution would be for you to take a look at your firewall and lock it down so it allows the minimum required access to provide service availability.

share|improve this answer
It it possible the reach the SQL database by using the domainname, username and password.. This is because im developing the websites from my iis-server at my laptop, and thereafter uploading to the webserver. – Behrens Nov 8 '11 at 12:56
It's possible if the SQL server is running on the web server. You would be the one to answer that. Regardless, my original answer will help: you need to implement a firewall on or preferably between that computer and the internet. That log shows an external IP attempting to login, so you need to add a firewall rule denying any traffic outside of your local network or a set of trusted IPs at the very least. – Chris N Nov 8 '11 at 13:13
Three words: Use a VPN. – Bart Silverstrim Nov 8 '11 at 13:17
Yes, the SQL server is running on the web server :) But even when trying to deactivate the rules "MS SQL over TCP protocol" and "MS SQL Probe" i can still connect to the sql database through my website. And the firewall are set by default to block every incoming connection which doesnt match a rule. – Behrens Nov 8 '11 at 13:19

For anyone looking for an program that will create the IPSEC policy, filters, etc and automatically scan the event log and add IP's to the block list, I've written a small program that does just that.

As a web hosting provider my customers need external access to my SQL Server instance. I too had the problem where my event log would be filled with thousands of entries for hackers attempting to login to my MSSQL instance with the 'sa' login. After much searching, I decided to write my own program, have it create the neccessary IPSEC items, and then scan the event log every 60 seconds for attacks from new IP addresses. It then adds the IP address to the IPSEC filter, and blocks all traffic to and from the IP. I have only tested this on Windows Server 2008, but believe it will work on other versions as well. As a side note you may need to run it with administrator privileges so that it has the correct permissions to access the event log and to create IPSec policies and filters.

Feel free to download the program using the link below. Donations are always appreciated using the link in the right-click menu of the taskmanager icon.

Please note that this only works for SQL login attempts using the 'sa' login, but I could modify it to work for other log events as well. Also, you can view the IP's that have been blocked, but you will continue to see some items in the event log since the program only runs every 60 seconds. This is due to not being able to delete a single event log entry, and I didn't think deleting the entire log would be a good idea. As a result you will need to clear the log manually on ocassion. If needed I do have a version that archives the log file after 5,000 entries and then clears it. I found that this helps in CPU utilization since the app doesn't have to keep processing the same event log entries on each run.

DISCLAIMER - By downloading and installing the above-mentioned program, you agree to hold me harmless for any damage, loss of data, corruption, or any other functionality issues resulting from the use of said software. I have tested the program to the best of my ability and currently have it running on 2 servers, but you have been warned to use at your own risk.

share|improve this answer
Welcome to Server Fault! Please read our faq in particular May I promote products or websites I am affiliated with here?. – Iain Mar 28 '12 at 11:22

Use SQL Profiler to look at the login requests to the SQL server. You may find it's an internal IP address and the name of the application trying to access the SQL Server.

If it is an external IP address, then WHY!?! Why have you exposed a SQL server directly to public internet traffic. If you don't know then your going to have to find out!

Also make sure the sa password is actually very strong. On my SQL Servers, the sa password is actually a very long garbage randomly created use once and throw away password.

share|improve this answer
I made it a rubish 128 character long password consisting of a-z, A-Z and 0-9 .. I can't rename my sa account tho :/ ... I cant seem the find the place where to lockdown the external traffic... – Behrens Nov 8 '11 at 12:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.