{"id":7087,"date":"2025-12-04T14:28:58","date_gmt":"2025-12-04T19:28:58","guid":{"rendered":"https:\/\/andreas-wolter.com\/?p=7087"},"modified":"2025-12-04T17:51:42","modified_gmt":"2025-12-04T22:51:42","slug":"202512_renaming-sql-servers-sa-account","status":"publish","type":"post","link":"https:\/\/andreas-wolter.com\/en\/202512_renaming-sql-servers-sa-account\/","title":{"rendered":"To rename or not, that is the question \u2013 how to protect SQL Server\u2019s built-in sysadmin account sa"},"content":{"rendered":"<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7067\" src=\"https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_rename_sa.png\" alt=\"rename sa to \" width=\"624\" height=\"337\" srcset=\"https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_rename_sa.png 624w, https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_rename_sa-300x162.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/>\r\n\r\nThis is another one of those subjects that keep circulating: <strong>should you rename your sa account?<\/strong>\r\n<p>\u00a0<\/p>\r\nPlenty of \u201csecurity check\u201d scripts swear you should. Meanwhile, when you talk to actual humans in the real world, you\u2019ll notice that almost nobody does it. (Funny how that works.)\r\n<p>\u00a0<\/p>\r\nSo what does <em>Sarpedon Quality Lab\u00ae<\/em> recommend &#8211; and why? Our answer (read to the end) may surprise you.\r\n<p>\u00a0<\/p>\r\n<h2>Some background first<\/h2>\r\nThis discussion goes back to the 2000\u2019s, when SQL Server installations around the globe were breached simply by connecting to port 1433 using the username \u201csa\u201d, the default sysadmin account \u2013 often with<strong> no password <\/strong>(which was the default for many installations back then).\r\n\r\nFast forward to 2022, with ransomware on the rise: the \u201cBlueSky\u201d ransomware specifically brute-forced the sa account of its victims and \u201cFreeWorld\u201d did the same in 2023. The list goes on.\r\n\r\nSince Microsoft SQL Server\u2019s default sysadmin account is \u201csa\u201d, it\u2019s always the first target.\r\n\r\nToday, everyone knows you need a strong password, but what else can be done to prevent falling victim to brute-force attacks?\r\n<p>\u00a0<\/p>\r\nLet\u2019s get the most obvious solutions out of the way:\r\n<ol>\r\n \t<li><strong>Don\u2019t expose your database server to the internet<\/strong>. This is the most obvious and effective measure against external attacks.<\/li>\r\n \t<li><strong>Disable SQL Authentication<\/strong>. Using Windows AD accounts with <strong>Kerberos authentication<\/strong> is a better choice. Kerberos not only handles secure authentication but also validates the server\u2019s identity to the client &#8211; provided it\u2019s configured correctly.<\/li>\r\n<\/ol>\r\n<p>\u00a0<\/p>\r\nBut what if we need to use SQL Authentication?\r\n<h2>Options to protect the sa-acount in SQL Server<\/h2>\r\nAssuming we must keep mixed Mode Authentication enabled, we can do 3 things with the sa-account:\r\n<ol>\r\n \t<li><strong>Rename sa<\/strong><\/li>\r\n \t<li><strong>Disable sa<\/strong> \u2013 note that this does not prevent impersonation from within the SQL engine (<a href=\"https:\/\/andreas-wolter.com\/en\/disable-and-deny-login-deny-user-effect-on-impersonation-and-permissions\/\">DISABLE and DENY LOGIN, DENY USER &#038; Effect on Impersonation and Permissions<\/a>)<\/li>\r\n \t<li><strong>Set a super strong password<\/strong> \u2013 up to 128 characters are supported<\/li>\r\n<\/ol>\r\nIn the following screenshot you can see, that with sa renamed to \u201cthedude\u201d, system sessions use the new name since the SID does not change. The same applies to objects that were owned by sa \u2013 system tables use the SID for referential integrity, hence the rename itself goes smoothly: SQL Agent jobs and other objects display the new name of the owner when it was sa before.\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-7065\" src=\"https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed-1030x512.jpg\" alt=\"SQLServer_sa_renamed\" width=\"1030\" height=\"512\" srcset=\"https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed-1030x512.jpg 1030w, https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed-300x149.jpg 300w, https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed-768x382.jpg 768w, https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed-705x351.jpg 705w, https:\/\/andreas-wolter.com\/wp-content\/uploads\/2025\/12\/202512_SQLServer_sa_renamed.jpg 1200w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/>\r\n<h3>Renaming sa Pros and Cons<\/h3>\r\nWhile renaming the sa account is technically simple, the reality is a bit more nuanced.\r\n<h4><strong>Pros:<\/strong><\/h4>\r\n<ul>\r\n \t<li><strong>Brute<\/strong><strong>\u2011<\/strong><strong>force attacks are extremely common<\/strong>, and letting an attacker waste time hammering a non\u2011existent sa account can buy you valuable time for detection and containment.\r\n<ul>\r\n \t<li>Note: Note: The client always receives the same generic error message &#8211; \u201cLogin failed for user\u201d, error 18456 &#8211; whether the password is wrong or the login doesn\u2019t exist. Only the error state (visible in the SQL Server Error Log) reveals the real cause.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Figuring out the new name of sa requires access to SQL Server in the first place.<\/strong>\r\n<ul>\r\n \t<li>The SID of the original sa account is fixed at 0x01 and cannot be changed, but an attacker would still need to already have SQL Server access to query system views and discover the renamed account. At that point, you\u2019re dealing with a completely different attack vector.<\/li>\r\n \t<li>The alternative &#8211; capturing TDS packets on the network and waiting for a real sa session &#8211; is theoretically possible, but it\u2019s hardly the first thing an attacker would invest resources in.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>You are a <strong>federal agency like the U.S. Department of Defense (DoD)<\/strong> or work for one of the agencies: The <strong>STIG<\/strong> (Security Technical Implementation Guide) for SQL Server, published by the Defense Information Systems Agency (DISA) requires it.<\/li>\r\n<\/ul>\r\n<p>\u00a0<\/p>\r\n<h4><strong>Cons:<\/strong><\/h4>\r\n<ul>\r\n \t<li><strong>Many real<\/strong><strong>\u2011<\/strong><strong>world applications still require sa<\/strong> for parts of their workflow &#8211; sometimes only during setup, sometimes during ongoing operations.\r\nYes, vendors <em>should<\/em> fix this and never require sa, but as long as this remains common practice, renaming sa cannot be recommended universally for every customer.<\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li><strong>Scripts and processes often rely on standard ownership by sa<\/strong>, such as database owner, Always On Availability Group owner, or other server level objects.\r\n<ul>\r\n \t<li>This <strong>requires strict process control<\/strong> during deployments to ensure the alternative name is always used consistently.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Even Microsoft components occasionally expect sa by name.\r\n<\/strong>Replication, certain patches, or other subsystems have been known to fail when sa has been renamed. You cannot blindly assume everything will continue working.<\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li><strong>The new name may already be known.\r\n<\/strong>If an attacker has compromised a less critical SQL Server in the same environment, and the renamed sa account is standardized across servers, the benefit evaporates.<\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li><strong>It can cause confusion.<\/strong>\r\nRenamed accounts can complicate troubleshooting &#8211; e.g., working with Agent job owners, auditing login sessions, and generally supporting the SQL Server.<\/li>\r\n<\/ul>\r\n<p>\u00a0<\/p>\r\n<h3><strong><em>Storytime<\/em><\/strong><\/h3>\r\nWhile I worked on the <strong>Microsoft SQL Server security team<\/strong>, we started a project to explore ways to eliminate the attack vector that sa represents.\r\n\r\nAs with so many things, however, the project was eventually abandoned &#8211; not due to lack of desire, but <strong>because of resource constraints and the complexity of changing an account that\u2019s widely used<\/strong>, not only internally but also by various satellite services of SQL Server.\r\n\r\nSo, dear reader\u2026 consider yourself warned \ud83d\ude09.\r\n<p>\u00a0<\/p>\r\n<h3>Disabling sa<\/h3>\r\n<strong>Can I reach the same goal by disabling sa?<\/strong>\r\n<p>\u00a0<\/p>\r\nAlmost. If sa is disabled it cannot be breached. But disabling it leads to a <strong>different error message<\/strong> altogether:\r\n<p>\u00a0<\/p>\r\n<em>Login failed for user &#8216;sa&#8217;. Reason: The account is disabled. (Microsoft SQL Server, Error: <strong>18470<\/strong>)<\/em>\r\n<p>\u00a0<\/p>\r\nThis makes it immediately obvious to an attacker that sa exists but is unavailable &#8211; so they\u2019ll typically give up on brute\u2011forcing it and move on to something else much sooner.\r\n<p>\u00a0<\/p>\r\n<h2>Conclusion<\/h2>\r\nUnfortunately, there is <strong>no perfect answer<\/strong>.\r\n<p>\u00a0<\/p>\r\nIn a perfectly controlled and managed system, renaming sa would be ideal, since disabling it alone immediately signals to an attacker to look elsewhere.\r\n\r\nHowever, in the real world, it is <strong>difficult &#8211; sometimes impossible &#8211; to ensure that no dependencies on the name sa exist<\/strong> in applications, code, jobs, or other database objects. Renaming can therefore introduce risks. If you are supporting a <strong>federal agency<\/strong>, for example, you may need to implement workarounds, such as temporarily renaming it back to sa for certain operations.\r\n\r\nDisabling sa is technically a useful option, effectively rendering all attacks on the account futile. But since the resulting error message explicitly discloses that the account is disabled, I hesitate to recommend it universally.\r\n<p>\u00a0<\/p>\r\n<h2>What <em>Sarpedon Quality Lab<\/em> recommends &#8211; it may surprise you<\/h2>\r\n<ol>\r\n \t<li><strong>Set a very long password\r\n<\/strong>At least 40 characters, (up to SQL Server\u2019s maximum of 128)) including numbers and both uppercase and lowercase letters. &#8211; Use special characters sparingly to avoid those corner cases where they cause issues. Length makes the difference.<\/li>\r\n \t<li><strong>Closely monitor Security Audits<\/strong>\r\nKeep an eye on failed (and successful) Login attempts of specifically the sa<\/li>\r\n \t<li><strong>Do not rename sa.<\/strong>\r\nGiven the large and highly heterogeneous customer base we work with, we cannot recommend renaming sa as a general practice. It introduces too much operational risk.\r\n(And let\u2019s just say Microsoft isn\u2019t exactly arguing with us on this one \ud83d\ude09.)<\/li>\r\n \t<li><strong>Leave sa enabled.<\/strong>\r\nDon\u2019t give away the fact that brute-forcing sa is futile. Let them trigger your alerts.<\/li>\r\n<\/ol>\r\n<p>\u00a0<\/p>\r\n<h2>Ending thoughts and wishes to the SQL Server team<\/h2>\r\nHopefully, this guidance helps those who need to make that decision to justify it.\r\n<p>\u00a0<\/p>\r\n<strong>Requests to Microsoft:<\/strong>\r\n<ul>\r\n \t<li><strong>Surface \u201cLogin disabled\u201d simply an error state\r\n<\/strong>A failed login should not reveal why it failed, so attackers gain no insight during brute-force attempts. This seems like <em>low-hanging fruit<\/em> and could even be delivered in a CU.<\/li>\r\n \t<li><strong>Limit or block the use of SA\r\n<\/strong>As I have written before (<a href=\"https:\/\/andreas-wolter.com\/en\/7wishes-access-control-sqlserver-azuresql-security\/\">My 7 wishes for access control in SQL Server and Azure SQL security<\/a>), SQL Authentication won\u2019t go away for at least another decade or two. Customers need better guardrails to avoid using sa at all.\r\nAdditionally, the database engine remains vulnerable as long as internal processes run unchecked under sysadmin, as highlighted by recent CVEs\u2014for example: <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/kb5063756-description-of-the-security-update-for-sql-server-2022-gdr-august-12-2025-f56e3677-84b7-4ba3-ab13-b33fcfabb212\" target=\"_blank\" rel=\"noopener\">https:\/\/support.microsoft.com\/en-us\/topic\/kb5063756-description-of-the-security-update-for-sql-server-2022-gdr-august-12-2025-f56e3677-84b7-4ba3-ab13-b33fcfabb212<\/a><\/li>\r\n<\/ul>\r\n<p>\u00a0<\/p>\r\n<h6>Happy securing<\/h6>\r\nAndreas\r\n<p>\u00a0<\/p>\r\n<h6>Thanks to my colleagues for reviewing and keeping me honest:<\/h6>\r\nThomas Grohser, SQL Server Infrastructure Architect and recognized expert in SQL Server security\r\n\r\nRalf Dietrich, Database security and forensics expert\r\n<p>\u00a0<\/p>\r\n<h4><strong>Links for further reading:<\/strong><\/h4>\r\n<ul>\r\n \t<li>DISABLE and DENY LOGIN, DENY USER &#038; Effect on Impersonation and Permissions\r\n<a href=\"https:\/\/andreas-wolter.com\/en\/disable-and-deny-login-deny-user-effect-on-impersonation-and-permissions\/\">https:\/\/andreas-wolter.com\/en\/disable-and-deny-login-deny-user-effect-on-impersonation-and-permissions\/<\/a><\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li>SQL Server Error 18456\r\n<a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/errors-events\/mssqlserver-18456-database-engine-error?view=sql-server-ver17\" target=\"_blank\" rel=\"noopener\">https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/errors-events\/mssqlserver-18456-database-engine-error?view=sql-server-ver17<\/a><\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li>Are Your Passwords in the Green?\r\n<a href=\"https:\/\/www.hivesystems.com\/blog\/are-your-passwords-in-the-green\" target=\"_blank\" rel=\"noopener\">https:\/\/www.hivesystems.com\/blog\/are-your-passwords-in-the-green<\/a><\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li>BlueSky ransomware\r\n<a href=\"https:\/\/thedfirreport.com\/2023\/12\/04\/sql-brute-force-leads-to-bluesky-ransomware\/\" target=\"_blank\" rel=\"noopener\">https:\/\/thedfirreport.com\/2023\/12\/04\/sql-brute-force-leads-to-bluesky-ransomware\/<\/a><\/li>\r\n \t<li>FreeWorld ransomware\r\n<a href=\"https:\/\/www.helpnetsecurity.com\/2023\/09\/06\/ms-sql-cyberattack\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.helpnetsecurity.com\/2023\/09\/06\/ms-sql-cyberattack\/<\/a> ).<\/li>\r\n<\/ul>","protected":false},"excerpt":{"rendered":"This is another one of those subjects that keep circulating: should you rename your sa account? \u00a0 Plenty of \u201csecurity check\u201d scripts swear you should. Meanwhile, when you talk to actual humans in the real world, you\u2019ll notice that almost nobody does it. (Funny how that works.) \u00a0 So what does Sarpedon Quality Lab\u00ae recommend [&hellip;]","protected":false},"author":4,"featured_media":7067,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[206,258],"class_list":["post-7087","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security-en","tag-sql-security","tag-sysadmin-en"],"_links":{"self":[{"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/posts\/7087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/comments?post=7087"}],"version-history":[{"count":17,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/posts\/7087\/revisions"}],"predecessor-version":[{"id":7090,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/posts\/7087\/revisions\/7090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/media\/7067"}],"wp:attachment":[{"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/media?parent=7087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/categories?post=7087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andreas-wolter.com\/en\/wp-json\/wp\/v2\/tags?post=7087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}