<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Security on Andy M Mallon - AM²</title><link>https://am2.co/category/security/</link><description>Recent content in Security on Andy M Mallon - AM²</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 02 Feb 2022 13:29:23 -0500</lastBuildDate><atom:link href="https://am2.co/category/security/index.xml" rel="self" type="application/rss+xml"/><item><title>How to revoke SA permissions that seem to be "stuck" to a login?</title><link>https://am2.co/2022/02/02/how-to-revoke-sa-permissions-that-seem-to-be-stuck-to-a-login/</link><pubDate>Wed, 02 Feb 2022 13:29:23 -0500</pubDate><guid>https://am2.co/2022/02/02/how-to-revoke-sa-permissions-that-seem-to-be-stuck-to-a-login/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/307824/52344"&gt;&lt;img src="https://am2.co/wp-content/uploads/blockquote.png" alt="clip art of &#10;a double-quote character" width="100" height="75" class="alignleft size-full wp-image-55062" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;Apologies in advance if I don't use some terminology correctly here. I'm not a DBA but I've been temporarily forced into the role.&lt;/p&gt;&#10;&lt;p&gt;I've inherited an application that runs on SQL Server 2016 Enterprise - one instance for PROD and another for TEST. These instances are set up in an &amp;quot;always on&amp;quot; configuration, so I have one Availability Group for PROD and one for TEST. Each Availability Group has two servers in it. Each instance has multiple databases in it, but only one DB in each instance is actually used by the application - the others look to have been created for testing purposes. I'm only mentioning that there are other DBs just in case it might be relevant in some way that I'm not aware of.&lt;/p&gt;</description></item><item><title>Can changing database owner affect permissions or role memberships?</title><link>https://am2.co/2020/03/30/can-changing-database-owner-affect-permissions-or-role-memberships/</link><pubDate>Mon, 30 Mar 2020 21:23:49 -0400</pubDate><guid>https://am2.co/2020/03/30/can-changing-database-owner-affect-permissions-or-role-memberships/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/263956/52344"&gt;&lt;img src="https://am2.co/wp-content/uploads/blockquote.png" alt="clip art of &#10;a double-quote character" width="100" height="75" class="alignleft size-full wp-image-55062" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;A couple years ago we ran into a situation where we were changing the database owner from a DBA's login to sa, and immediately thereafter we received a complaint that the service login (which was NOT the DBA's login) no longer had access to the database. On checking, the service login had indeed lost it's role memberships. &lt;/p&gt;</description></item><item><title>What the heck is the dbcreator role?</title><link>https://am2.co/2019/12/19/what-the-heck-is-the-dbcreator-role/</link><pubDate>Thu, 19 Dec 2019 07:30:14 -0500</pubDate><guid>https://am2.co/2019/12/19/what-the-heck-is-the-dbcreator-role/</guid><description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=7UbY3lmCSb0"&gt;&lt;img src="https://am2.co/wp-content/uploads/ksenia-makagonova-HP9nSjikXq0-unsplash-1024x683.jpg" alt="" width="512" height="342" class="alignright size-large wp-image-2251" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/server-level-roles?view=sql-server-ver15#fixed-server-level-roles" rel="noopener noreferrer" target="_blank"&gt;Microsoft docs&lt;/a&gt; defines the dbcreator role as:&lt;/p&gt;&#10;&lt;blockquote&gt;Members of the dbcreator fixed server role can create, alter, drop, and restore any database.&lt;/blockquote&gt;&#10;&lt;p&gt;But what specific permissions are actually included in that role? If we scroll down in the docs just a little, we&amp;rsquo;ll see a diagram that tells us that &lt;code&gt;dbcreator&lt;/code&gt; grants two permissions:&lt;/p&gt;</description></item><item><title>Testing as another user...without their password</title><link>https://am2.co/2019/12/18/testing-as-another-user-without-their-password/</link><pubDate>Wed, 18 Dec 2019 11:50:35 -0500</pubDate><guid>https://am2.co/2019/12/18/testing-as-another-user-without-their-password/</guid><description>&lt;figure class="wp-caption alignright" style="max-width:512px"&gt;&lt;a href="https://www.youtube.com/watch?v=6AXd5tcyneE"&gt;&lt;img src="https://am2.co/wp-content/uploads/greg-ortega-1LCzr14Ah5U-unsplash-1024x684.jpg" alt="" width="512" height="342" class="size-large wp-image-2381" /&gt;&lt;/a&gt; This guy doesn't have Elvis's password and is still able to impersonate him.&lt;/figure&gt;&#10;As a DBA or SQL Developer, you've surely encountered a scenario where something worked for you, but not for another user. DBAs usually are part of the sysadmin role, or have a collection of powerful permissions. If I run code as myself, I will *never* have permissions problems because my account is sysadmin. If I want to ensure permissions are correct, I need to run the code as the less-privileged account. &#10;&lt;h2 id="can-you-try-now"&gt;Can you try now?&lt;/h2&gt;&#10;&lt;h3 id="can-you-try-now-1"&gt;Can you try now?&lt;/h3&gt;&#10;&lt;h4 id="can-you-try-now-2"&gt;Can you try now?&lt;/h4&gt;&#10;&lt;h5 id="can-you-try-now-3"&gt;Can you try now?&lt;/h5&gt;&#10;&lt;p&gt;I honestly don&amp;rsquo;t think there is a more frustrating experience than getting into the feedback loop of making a permission change, and asking the user if it works, and when it doesn&amp;rsquo;t work, you try another change, and ask them to try again, and when it doesn&amp;rsquo;t work, you try another change, and ask them to try again, and when it doesn&amp;rsquo;t work, you try another change, and ask them to try again, and when it doesn&amp;rsquo;t work, you try another change, and ask them to try again&amp;hellip;&lt;/p&gt;</description></item><item><title>Why Best Practices Exist: Learning from others' mistakes</title><link>https://am2.co/2017/06/28/best-practices-exist-learning-others-mistakes/</link><pubDate>Wed, 28 Jun 2017 20:00:11 -0400</pubDate><guid>https://am2.co/2017/06/28/best-practices-exist-learning-others-mistakes/</guid><description>&lt;p&gt;The latest malware to make the headlines is really interesting to me. It&amp;rsquo;s a ransomware worm called &lt;strong&gt;Petya&lt;/strong&gt;. Ransomware is particularly interesting to me as a DBA, because DBAs are responsible for keeping data safe, and ransomware is specifically designed to destroy your data. I&amp;rsquo;m not a security expert, and I don&amp;rsquo;t even pretend I am&amp;ndash;but security is something we should all be interested in.&lt;/p&gt;</description></item><item><title>Big security loophole with SQL Logins</title><link>https://am2.co/2015/04/30/big-security-loophole-with-sql-logins/</link><pubDate>Thu, 30 Apr 2015 16:46:00 -0400</pubDate><guid>https://am2.co/2015/04/30/big-security-loophole-with-sql-logins/</guid><description>&lt;p&gt;Aaron Bertrand (&lt;a href="https://twitter.com/AaronBertrand" target="_blank"&gt;twitter&lt;/a&gt;|&lt;a href="http://sqlperformance.com/author/abertrand" target="_blank"&gt;blog&lt;/a&gt;) recently blogged asking for help to fix a big security loophole. I read the post then, but it was only this morning that I finally got around to REALLY looking at it, thinking about it, and testing it out for myself.&lt;br /&gt;&lt;br /&gt;Aaron can do a much better job at describing the issue than I can, so I urge you to read &lt;a href="http://blogs.sqlsentry.com/aaronbertrand/please-help-me-fix-a-big-security-loophole/" target="_blank"&gt;his blog post on the topic&lt;/a&gt;, or &lt;a href="http://dba.stackexchange.com/questions/99262/does-sys-sql-logins-is-policy-checked-mean-that-the-policy-has-been-checked" target="_blank"&gt;his Stack Exchange answer on the topic&lt;/a&gt;. Then, go up-vote &lt;a href="https://connect.microsoft.com/SQLServer/Feedback/Details/1250342" target="_blank"&gt;the Connect item he filed&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I&amp;rsquo;ll do my best to give a quick summary of the issue here, if you don&amp;rsquo;t want to read Aaron&amp;rsquo;s full version:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://msdn.microsoft.com/en-us/library/ms174355.aspxhttps://msdn.microsoft.com/en-us/library/ms174355.aspx" target="_blank"&gt;Microsoft&amp;rsquo;s documentation&lt;/a&gt; explains that sys.logins.is_policy_checked means &amp;ldquo;Password policy is checked.&amp;rdquo; Bill Clinton was right, &amp;ldquo;It depends upon what the meaning of the word &amp;lsquo;is&amp;rsquo; is.&amp;quot;&lt;br /&gt;This use of &amp;ldquo;is&amp;rdquo; in this terse definition &lt;b&gt;could&lt;/b&gt; have two meanings:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;As a descriptor of what has happened: &amp;ldquo;The password policy &lt;b&gt;&lt;i&gt;&lt;u&gt;has been&lt;/u&gt;&lt;/i&gt;&lt;/b&gt; checked for this login.&amp;quot;&lt;/li&gt;&lt;li&gt;As an instruction of what SQL Server should do in the future: &amp;ldquo;The password policy &lt;b&gt;&lt;i&gt;&lt;u&gt;will be&lt;/u&gt;&lt;/i&gt;&lt;/b&gt; checked for this login.&amp;quot;&lt;br /&gt;&lt;br /&gt;(If you aren&amp;rsquo;t already hung-up thinking about Bill Clinton, I probably just gave you a flashback to a grammar school teacher grilling you on conjugations of the verb &amp;ldquo;to be.&amp;rdquo;)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;As it turns out, the correct meaning of this column is actually #2: &amp;ldquo;The password policy &lt;b&gt;&lt;i&gt;&lt;u&gt;will be&lt;/u&gt;&lt;/i&gt;&lt;/b&gt; checked for this login.&amp;rdquo;  Most people (myself included) wrongly expect this column to have the other meaning.&lt;br /&gt;&lt;br /&gt;Further, there is no DMV that describes #1: &amp;ldquo;The password policy &lt;b&gt;&lt;i&gt;&lt;u&gt;has been&lt;/u&gt;&lt;/i&gt;&lt;/b&gt; checked for this login.&amp;rdquo;  If an auditor asks you to prove that all SQL logins meet your password policy, there is no way to prove that.&lt;br /&gt;&lt;br /&gt;Yes, I can use processes to manage my own environment to a point where I am confident that the passwords are strong. However, if I were an auditor, I would demand proof the DBA wasn&amp;rsquo;t skirting the rules by altering the flag before an audit (and flipping it back later).&lt;br /&gt;&lt;br /&gt;So, I join in Aaron&amp;rsquo;s call-to-action. Go up-vote &lt;a href="https://connect.microsoft.com/SQLServer/Feedback/Details/1250342" target="_blank"&gt;the Connect item&lt;/a&gt; and get this security loophole fixed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>