<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/6.11.7-stable" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>SQL Server &#38; BI Blog by Andreas Wolter - Latest Comments on CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
		<link>https://www.insidesql.org/blogs/andreaswolter/?disp=comments</link>
		<atom:link rel="self" type="application/rss+xml" href="https://www.insidesql.org/blogs/andreaswolter/?tempskin=_rss2&#38;disp=comments&#38;p=3549" />
		<description></description>
		<language>en-EU</language>
		<docs>http://backend.userland.com/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=6.11.7-stable"/>
		<ttl>60</ttl>
		<item>
			<title>andreaswolter [Member] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Mon, 15 Oct 2018 08:30:50 +0000</pubDate>
			<dc:creator><a href="http://www.andreas-wolter.com" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_20"><span class="identity_link_username">andreaswolter</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c8394@https://www.insidesql.org/blogs/</guid>
			<description>Thank you, S.E.
Btw:
this Blog is actually &quot;closed&quot;.
I have moved to http://andreas-wolter.com/en/blog/ 
Andreas</description>
			<content:encoded><![CDATA[Thank you, S.E.
Btw:
this Blog is actually "closed".
I have moved to http://andreas-wolter.com/en/blog/ 
Andreas]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c8394</link>
		</item>
		<item>
			<title> S.E. [Visitor] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Mon, 15 Oct 2018 07:37:11 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_8393">S.E.</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c8393@https://www.insidesql.org/blogs/</guid>
			<description>The SQL Agent problem has been resolved with SQL Server 2016. When creating/modifying a job with/to a different owner, you receive the following messages, respectively:
&lt;p&gt;
Only a member of the sysadmin server role can &lt;em&gt;&lt;strong&gt;add&lt;/strong&gt;&lt;/em&gt; a job for a different owner with @owner_login_name. (Microsoft SQL Server, Error: 14515)
&lt;/p&gt;
&lt;p&gt;
Only a system administrator can &lt;em&gt;&lt;strong&gt;reassign&lt;/strong&gt;&lt;/em&gt; ownership of a job. (Microsoft SQL Server, Error: 14242)
&lt;/p&gt;

I tested this with the GUI but as far as I checked the code, the check is present inside the called SPs.</description>
			<content:encoded><![CDATA[The SQL Agent problem has been resolved with SQL Server 2016. When creating/modifying a job with/to a different owner, you receive the following messages, respectively:
<p>
Only a member of the sysadmin server role can <em><strong>add</strong></em> a job for a different owner with @owner_login_name. (Microsoft SQL Server, Error: 14515)
</p>
<p>
Only a system administrator can <em><strong>reassign</strong></em> ownership of a job. (Microsoft SQL Server, Error: 14242)
</p>

I tested this with the GUI but as far as I checked the code, the check is present inside the called SPs.]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c8393</link>
		</item>
		<item>
			<title>cody_konior [Member] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Thu, 05 Feb 2015 05:16:26 +0000</pubDate>
			<dc:creator><a href="https://www.insidesql.org/blogs/andreaswolter/?disp=user&amp;user_ID=59" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_59"><span class="identity_link_username">cody_konior</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c7991@https://www.insidesql.org/blogs/</guid>
			<description>Thanks for writing this, it&#039;s the most comprehensive overview of sysadmin role vs CONTROL SERVER I&#039;ve seen; if only it wasn&#039;t all so much bad news!

This is the kind of thing Microsoft themselves should have documented more fully. It&#039;s really astounding that the problems with system procedures haven&#039;t been fixed even in SQL Server 2014.</description>
			<content:encoded><![CDATA[Thanks for writing this, it's the most comprehensive overview of sysadmin role vs CONTROL SERVER I've seen; if only it wasn't all so much bad news!

This is the kind of thing Microsoft themselves should have documented more fully. It's really astounding that the problems with system procedures haven't been fixed even in SQL Server 2014.]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c7991</link>
		</item>
		<item>
			<title>andreaswolter [Member] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Thu, 24 Oct 2013 22:58:22 +0000</pubDate>
			<dc:creator><a href="http://www.andreas-wolter.com" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_20"><span class="identity_link_username">andreaswolter</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c3004@https://www.insidesql.org/blogs/</guid>
			<description>And let&#039;s exclude the possibility of injecting a SQL Agent Job-step that is running under sa or other code injecting methods for now ;-)
That&#039;s more like a general problem.
It is a point though of course: the job is not done by just denying. 

Rather should the server be secured from ground-up. Mistakes can be exploited easily, if you know what you are looking for. :)</description>
			<content:encoded><![CDATA[And let's exclude the possibility of injecting a SQL Agent Job-step that is running under sa or other code injecting methods for now ;-)
That's more like a general problem.
It is a point though of course: the job is not done by just denying. 

Rather should the server be secured from ground-up. Mistakes can be exploited easily, if you know what you are looking for. :)]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c3004</link>
		</item>
		<item>
			<title>andreaswolter [Member] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Thu, 24 Oct 2013 22:33:52 +0000</pubDate>
			<dc:creator><a href="http://www.andreas-wolter.com" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_20"><span class="identity_link_username">andreaswolter</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c3003@https://www.insidesql.org/blogs/</guid>
			<description>Hi David,

Thank you for your feedback.

I can completely understand the &quot;bad feeling&quot; that many have with working based on denies. But when the permission hierarchy is clear, it actually does make sense once in a while, to sort of trim down permissions.

Whether this is valid in this case.. let’s see.

How exactly do you want the undo the deny?
He can’t do it onto himself, and trying to do grant it to the role does not help.

Your point is very important though: I should maybe stress more, that I did &lt;strong&gt;DENY the Login&lt;/strong&gt; and &lt;strong&gt;not just the Role&lt;/strong&gt; on purpose. That’s actually the point. Denying the role can easily be undone. Totally true.

So thank you very much for making me think about this point again.
I am very open to hear any of the other 99 ideas :-) 

Andreas</description>
			<content:encoded><![CDATA[Hi David,

Thank you for your feedback.

I can completely understand the "bad feeling" that many have with working based on denies. But when the permission hierarchy is clear, it actually does make sense once in a while, to sort of trim down permissions.

Whether this is valid in this case.. let’s see.

How exactly do you want the undo the deny?
He can’t do it onto himself, and trying to do grant it to the role does not help.

Your point is very important though: I should maybe stress more, that I did <strong>DENY the Login</strong> and <strong>not just the Role</strong> on purpose. That’s actually the point. Denying the role can easily be undone. Totally true.

So thank you very much for making me think about this point again.
I am very open to hear any of the other 99 ideas :-) 

Andreas]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c3003</link>
		</item>
		<item>
			<title> David Browne [Visitor] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Thu, 24 Oct 2013 21:57:38 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_3002">David Browne</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c3002@https://www.insidesql.org/blogs/</guid>
			<description>There are probably 100 ways for a login with CONTROL SERVER to become a sysadmin.  You shouldn&#039;t try to block them, because you&#039;ll never get an exhaustive list and the security is illusory.

For instance a login with CONTROL SERVER can undo the DENY that block impersonation.

grant impersonate on login::sa to role_dba</description>
			<content:encoded><![CDATA[There are probably 100 ways for a login with CONTROL SERVER to become a sysadmin.  You shouldn't try to block them, because you'll never get an exhaustive list and the security is illusory.

For instance a login with CONTROL SERVER can undo the DENY that block impersonation.

grant impersonate on login::sa to role_dba]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c3002</link>
		</item>
		<item>
			<title>andreaswolter [Member] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Tue, 15 Oct 2013 20:21:40 +0000</pubDate>
			<dc:creator><a href="http://www.andreas-wolter.com" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_20"><span class="identity_link_username">andreaswolter</span></a> <span class="bUser-member-tag">[Member]</span></dc:creator>
			<guid isPermaLink="false">c2547@https://www.insidesql.org/blogs/</guid>
			<description>Hi Alvaro

Thanks for adding this important point.

I would not consider this a “hole” (It is quite logically and just follows the permission hierarchy) but it is important to keep in mind:
A Login != a User
And Control Server =&gt; Control “Any” Database

Using “hand-crafted” permissions is in fact the most secure option.

But be aware: Even if you specifically “DENY IMPERSONATE On USER::xyz”, depending on the schema the data is in, the CONTROL-SERVER-Login can still get the data easily if he is able to exploit an owner-ship chain (!). And this is as easy as it could be…

So to really make sure he cannot get certain data, I highly recommend to “DENY CONNECT ON DATABASE::[DB_ContainingTheData] To ControlServerLogin”

Thanks for your elaborate comment and scenario,

Andreas</description>
			<content:encoded><![CDATA[Hi Alvaro

Thanks for adding this important point.

I would not consider this a “hole” (It is quite logically and just follows the permission hierarchy) but it is important to keep in mind:
A Login != a User
And Control Server => Control “Any” Database

Using “hand-crafted” permissions is in fact the most secure option.

But be aware: Even if you specifically “DENY IMPERSONATE On USER::xyz”, depending on the schema the data is in, the CONTROL-SERVER-Login can still get the data easily if he is able to exploit an owner-ship chain (!). And this is as easy as it could be…

So to really make sure he cannot get certain data, I highly recommend to “DENY CONNECT ON DATABASE::[DB_ContainingTheData] To ControlServerLogin”

Thanks for your elaborate comment and scenario,

Andreas]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c2547</link>
		</item>
		<item>
			<title> Alvaro Fdez [Visitor] in response to: CONTROL SERVER vs. sysadmin/sa: permissions, system procedures, DBCC, automatic schema creation and privilege escalation - caveats</title>
			<pubDate>Mon, 14 Oct 2013 16:08:02 +0000</pubDate>
			<dc:creator><span class="user anonymous" rel="bubbletip_comment_2513">Alvaro Fdez</span> <span class="bUser-anonymous-tag">[Visitor]</span></dc:creator>
			<guid isPermaLink="false">c2513@https://www.insidesql.org/blogs/</guid>
			<description>Hi Andreas,

Adding to the scenarios in your article. Let&#039;s say the DBA team add a CONTROL SERVER&#039;s account as a user in a user database - for the sake of later forbid him access to user data in that database (ie, DENY CONTROL ON SCHEMA, or DENY CONTROL on a certain table, etc.). The team also DENY ALTER ANY LOGIN and ALTER USER for that CONTROL_SERVER login/user as well.

In that database, let&#039;s say there is a &quot;schemauser&quot; user (and server login). So we DENY IMPERSONATE ON LOGIN::schemauser to the CONTROL_SERVER login and, in effect, given the set of privileges denied above, and existing a mapping between the CONTROL SERVER login and a user for that login in that database, the CONTROL_SERVER account won&#039;t be able to access user data/schemas.

But unless the DBA team also explicitly DENY IMPERSONATE ON USER::schemauser TO CONTROL_SERVER_user , he will be able to do a EXECUTE AS USER=schemauser to access the data as the schemauser.

So in my case, creating a CONTROL SERVER login and at the same time, trying to prevent him access to user data, will force the DBA team to:

1- Deny any kind of ALTER LOGIN or ALTER USER (or APPLICATION ROLE) privileges at a minumum.

2-Always pay attention to newly created logins/users in that database, because the CONTROL SERVER account will just keep track of a new user and impersonate him as described -- unless the DBA team, on each login/user creation, automatically repeats the DENY IMPERSONATE ON LOGIN/USER::the_newly_created_login_or_user ...

For a project involving separation of duties (but that required to forbid access to user data)  I frankly ended not creating a such &quot;marvellous&quot; CONTROL SERVER account, but instead granting individual privileges out of the hundreds of them  (project was over a SQL2008 R2 unfortunately,couldn&#039;t use SQL2012 server roles)

Regards,
Alvaro Fdez</description>
			<content:encoded><![CDATA[Hi Andreas,

Adding to the scenarios in your article. Let's say the DBA team add a CONTROL SERVER's account as a user in a user database - for the sake of later forbid him access to user data in that database (ie, DENY CONTROL ON SCHEMA, or DENY CONTROL on a certain table, etc.). The team also DENY ALTER ANY LOGIN and ALTER USER for that CONTROL_SERVER login/user as well.

In that database, let's say there is a "schemauser" user (and server login). So we DENY IMPERSONATE ON LOGIN::schemauser to the CONTROL_SERVER login and, in effect, given the set of privileges denied above, and existing a mapping between the CONTROL SERVER login and a user for that login in that database, the CONTROL_SERVER account won't be able to access user data/schemas.

But unless the DBA team also explicitly DENY IMPERSONATE ON USER::schemauser TO CONTROL_SERVER_user , he will be able to do a EXECUTE AS USER=schemauser to access the data as the schemauser.

So in my case, creating a CONTROL SERVER login and at the same time, trying to prevent him access to user data, will force the DBA team to:

1- Deny any kind of ALTER LOGIN or ALTER USER (or APPLICATION ROLE) privileges at a minumum.

2-Always pay attention to newly created logins/users in that database, because the CONTROL SERVER account will just keep track of a new user and impersonate him as described -- unless the DBA team, on each login/user creation, automatically repeats the DENY IMPERSONATE ON LOGIN/USER::the_newly_created_login_or_user ...

For a project involving separation of duties (but that required to forbid access to user data)  I frankly ended not creating a such "marvellous" CONTROL SERVER account, but instead granting individual privileges out of the hundreds of them  (project was over a SQL2008 R2 unfortunately,couldn't use SQL2012 server roles)

Regards,
Alvaro Fdez]]></content:encoded>
			<link>https://www.insidesql.org/blogs/andreaswolter/2013/08/control-server-vs-sysadmin-sa-permissions-privilege-escalation-caveats#c2513</link>
		</item>
			</channel>
</rss>
