7

On one of my servers (Win 2012 R2), SQL Server 2012 is constantly under attack with the SA account being hit like 10 times per second with different passwords. I don't have an SA account but still I would like to stop this probing as its probably consuming resources. I keep checking the logs and blocking the offending IPs at firewall level manually, still I would like a better solution. SQL Server runs locally with IIS to serve its websites, I only need to connect to SQL Server remotely for database development with SSMS, so at first I thought setting up a VPN but not sure if this is going to play well with SSMS and other services like FTP. As in interim solution where can I stop SQL Server from being visible to the outside world at the firewall by disabling port 1433, or elsewhere? I can then enable/disable this when developing and perhaps just for my IP. Thanks.

4
  • You appear to be able to block IPs in the Windows firewall; I'm sure closing ports should also be available as an option, no?
    – mustaccio
    Commented Aug 17, 2015 at 23:52
  • I have closed the SQL port and that stopped all the probing by I have to remember to enable my IP in all the time (dynamic IP) for development. Isn't there a tool that looks at the windows log files and on those events that show a SQL probe, add the IPs to the firewall to block them automatically? Commented Aug 17, 2015 at 23:58
  • May be there is such a tool, but then 1) you may want to clarify what you ask in the question itself and 2) it's not a SQL Server problem; you may have better chance asking about it at Server Fault
    – mustaccio
    Commented Aug 18, 2015 at 0:03
  • You could use a port forwarder and proxy to hit the dev box from the same ip. You could RDP in to that network to do work. You can automate the IP settings and only have it off while you're working then have it turn back on. You can set it up as part of something like a octopus/jenkins system like you do dev. There's many options, do any of those work for you? Commented Aug 18, 2015 at 1:08

2 Answers 2

5

SQL Server runs locally with IIS to serve its websites

The main problem I see is having sql server and IIS running on the same server. IIS serves website and SQL Server should be on a different server and only allowed connection from IIS to SQLServer.

There are things that you can do to mitigate the problem:

1
  • With SQL server on a different server I experience lag in web page responsiveness as it will have to request data further than locally, so its a no for me right now. I will try the port change away from the default, maybe that will help with minimal side effects, also the logon trigger script is a great idea and will test fully soon. For now, disabled the firewall inbound rule for SQL server and that's doing a great job with minimal inconvenience. Thanks. Commented Aug 19, 2015 at 14:17
7

So the IIS on this server is intended to be externally accessible from your internal data network but the SQL Server instance on this same server is not meant to allow for external connections except for only through the web interfaces of your applications, correct?

If so, then is not adding an explicit rule in the Windows Firewall on this server to allow only the private IP address ranges to connect via local network on SQL Server ports not acceptable? I assume you trust your internal IP addresses on this port and don't suspect those as the authentication attempts with malicious intent?

Allow the [localhost IP] IIS apps to authenticate to SQL (may need to check site bindings, etc. and/or setup internal DNS pointers too).

On your external side, you should only be allowing the port 80 or 443 to port forward/NAT to the IIS server on those ports only and not all ports too it I would think -- stop at corporate firewall too I guess and only allow the web app ports to go to that server from the external interface with your firewall appliance proxies, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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