Guide · SQL Server

Password attempts on an internet-facing SQL Server: how to protect it

If the SQL Server log shows hundreds of "Login failed for user 'sa'" entries an hour, you are not alone. SQL Server ports open to the internet are scanned all the time by automated tools that try passwords. This guide explains what these entries mean and how to protect your server step by step.

Doz Teknoloji · Updated November 21, 2026 · 7 min read

What error 18456 tells you

For every failed sign-in, SQL Server writes an entry with error number 18456 to its error log and the Windows Application log. The entry holds the account name tried, the client address the attempt came from and a state number. The client trying to connect gets no detail, for security reasons; only the server log shows the real reason.

Common state numbers:

If the attempts come from internet addresses and states 5 or 8 dominate, you are most likely facing an automated password scanner. A few regular attempts from the same internal address are usually an application still using an old password.

Where the real risk is

The attempts themselves keep the server a little busy, but the real danger is one of them succeeding. If the password of a fully privileged account such as "sa" is guessed, an attacker can read or delete databases or look for ways to run commands on the server. Weak passwords, or passwords used in more than one place, make this risk larger.

Protecting the server, step by step

  1. Take SQL Server off the internet. This is the most effective step. Close port 1433 (or the port you use) to the internet on the firewall. If outside access is really needed, allow it over a VPN or only from specific source addresses. Do not leave UDP 1434, used by the SQL Server Browser service, open to the internet either.
  2. Use Windows authentication only, if you can. If your applications do not need SQL passwords, run the server in Windows Authentication mode. The change needs a restart of the SQL Server service.
  3. Disable or rename the "sa" login. If you need mixed authentication: ALTER LOGIN sa DISABLE; Use logins with hard-to-guess names and only the permissions they need instead.
  4. Use strong, unique passwords. Keep the Windows password policy option (CHECK_POLICY = ON) on for SQL logins and never reuse the same password on other systems.
  5. Give applications the least privilege. An application login should reach only its own database and only the operations it needs; it should not be a sysadmin.
  6. Force encrypted connections. With "Force Encryption" turned on in SQL Server Configuration Manager and a valid certificate, passwords and data do not cross the network in clear text.
  7. Make sure failed sign-ins are logged. The "Login auditing" server property should be at least "Failed logins only". Without the log you cannot see the attack.
  8. Stay up to date. Install SQL Server and Windows updates regularly; out-of-support versions get no security updates.

When the attempts come from the internal network

Attempts from inside matter too. Most often it is an application, a scheduled task or an old reporting tool trying to connect with a login whose password changed; the address and login name in the log lead you to the source. But many attempts from an unknown internal machine can be a sign of a compromised computer; in that case look into that machine separately.

Watching the attempts continuously

Password attempts easily get lost among hundreds of log lines. Secura RMM counts failed sign-ins per client address from the event log, without signing in to SQL Server, and shows whether each address is on the internet or the local network. It alerts you when the number of attempts in the last hour exceeds 50 (the default). The account names tried are not read. The same page shows mixed authentication, the port, forced encryption and whether failed sign-ins are logged. See SQL Server monitoring for details.

Frequently asked questions

Is changing the SQL Server port enough?

No. A different port reduces some automated scans, but scanners try other ports too. The real protection is keeping the server off the internet and using strong authentication.

Will anything break if I disable "sa"?

Yes, if an application uses sa. First find which applications connect as sa and give them their own logins; then disable sa.

Do failed sign-ins slow SQL Server down?

A very large number of attempts uses some resources and swell the log. But the real problem is not performance; it is the risk that one attempt succeeds.

Related: SQL Server monitoring · Why the SQL Server log grows · Vulnerability and patch tracking