Archives for: "March 2014"

DISABLE and DENY LOGIN, DENY USER & Effect on Impersonation and Permissions
Mar 7th
DISABLE und DENY LOGIN, DENY USER & Effekt auf Impersonierung und Berechtigungen
(de) |
(en) |
Immer mal wieder kann man beobachten, dass Logins oder Usern die Connect-Berechtigung verboten bekommen wurde, oder ein Login deaktiviert wurde. Die richtige Erwartung und Verständnis kann daher kritisch sein. Sehen wir uns also eine einfache Demo an: |
Every once in a while one can observe that Logins or Users have been denied the Connect permission or a Login has been disabled. Therefore a correct expectation and understanding can be critical. So let’s see a simple demo: |
Ich deaktiviere also das sa-Konto ebenso wie das „DeniedLogin“-Konto – letzterem verbiete ich außerdem die Connect-Berechtigung (Erinnern wir uns daran: „Berechtigungen können nicht für sa, dbo, Entitäts-Besitzer, information_schema, sys oder für den Benutzer selbst erteilt, verweigert oder aufgehoben werden.“) Der Datenbank-User „SQLUser“ bekommt die Connect-Berechtigung auf die Datenbank verboten. |
So I am disabling the sa-account as well as the “DeniedLogin”-Account – the latter I also Deny the Connect permission (Remember we “Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself.”) The Database-User “SQLUser” gets denied the Connect permission on the database. In the GUI the result looks like this: |
Nun führen wir 4 Tests durch: |
Now let’s run 4 tests. |
Was diese Abfragen im Wesentlichen machen, ist, zu versuchen, den entsprechenden Login oder User zu impersonieren – und den Erfolg dadurch belegen, dass sie die dann jeweils aktiven Rollen-Mitgliedschaften zurückgeben. |
So essentially what those queries do, is trying to impersonate the respective Login or User – and proofing success by returning the then respective active role-memberships. Results: |
DeniedLogin: Impersonierung funktioniert + kein Verlust an Berechtigungen. |
DeniedLogin: Impersonation works + No loss of permissions. |
Dasselbe gilt für den sa: Impersonierung funktioniert + kein Verlust a Berechtigungen. Im Folgenden ein Test für den User, dem die Connect-Berechtigung auf die Datenbank entzogen worden ist – und nicht als Login verwendet werden kann. |
Same applies for sa: Impersonation works + No loss of permissions. In the following test for the User which has been denied the Connect-permission onto the database – and cannot be used as a Login. |
Ergebnisse: |
Results: Msg 15517, Level 16, State 1, Line 3 Cannot execute as the database principal because the principal "DeniedLogin" does not exist, this type of principal cannot be impersonated, or you do not have permission. Msg 916, Level 14, State 1, Line 3 The server principal "S-1-9-3-4049223906-1289824279-1154161590-488313048." is not able to access the database "ImpersonateLogin" under the current security context. |
Das Ergebnis ist für beide Datenbank-User effektiv das gleiche. Die GUID repräsentiert keinen reellen Server-Prinzipal, denn der User SQLUser hat keinen entsprechenden Login. Der Unterschied für den 2. User ist, dass dieser User nur innerhalb der Datenbank existiert, aber zugleich expliziert verboten wurde, sich mit ihr zu verbinden Das hat im Endeffekt dasselbe Resultat, wie ihn zu deaktivieren – genau wie der Guest-User es ist. |
The GUID does not represent a real server-principal, because the User SQLUser does not have a matching Login. The difference for the second user is, that this user only exists inside the database but at the same time has been explicitly denied to connect to it. This has essentially the same result as “disabling” it – just as the guest-user is. |
Damit wäre gezeigt, dass das Deaktivieren von Logins keinerlei Sicherheit gegenüber Angriffen von Innen gibt. Und sogenannte Privilegien Erweiterung findet in aller Regel z.B. von innen heraus statt. Auch der alte „Trick“, die Standard-Datenbank des Logins zu löschen, ist da keine Hilfe. Für Datenbank-User hat es durchaus Effekt und verhindert das Anmelden an der jeweiligen Datenbank – auch „von Innen heraus“.
|
Thereby it is shown, that disabling of Logins does not give any security against attacks from inside. And so-called privilege elevation (/-escalation) usually takes part from internal. Also the old “trick”, to drop the default-database of a Login, is of little help. For database-users is indeed does have an effect and prevents logon/connect to the respective database – also “from inside”. |
Konsequenterweise bleiben alle Berechtigungen (natürlich abgesehen von dem jeweiligen Deny) der jeweiligen Logins und User absolut unbeeinflusst von einer Deaktivierung jeglicher Weise. Das gilt auch im Zusammenhang mit „External Access“-Berechtigung für Logins basierend auf asymmetrischen Schlüsseln. ALTER LOGIN ist auch hier in BOL erklärt: technet.microsoft.com/en-us/library/ms189828.aspx
Ich hoffe, diese Dinge erklären einiges und speziell Empfehlungen in Sicherheits-Aspekten. |
Consequentially all permissions (besides the one denied of course) of the respective Login and User stay totally unaffected by and method of deactivation. This is also true in the context of “external access”-permission for Logins based on asymmetric keys. ALTER LOGIN is also explained in BOL here: technet.microsoft.com/en-us/library/ms189828.aspx
I hope those things clarified some things and especially recommendations in security-matters |
Happy securing
Andreas

Upcoming Conferences: SQLSaturdays in Denmark and Portugal. – Presenting In-Memory OLTP Deep-Dive for Administrators
Mar 3rd
(de) Am 29. März in Kopenhagen, Dänemark Da ich auch letztes Jahr bereits in Kopenhagen als Sprecher dabei war, kann ich aus erster Hand für die exzellente Organisation und Sprecherauswahl verbürgen. Und für Portugal verbürgt mein sehr geschätzter Kollege Niko Neugebauer (Blog, Twitter:@NikoNeugebauer) – nach allem, was bisher „geleaked“ ist, wird es wieder ein Kongeniales Event. Würdig der ersten SQLSaturday-Location in Europa überhaupt. |
(en) On March 29th in Copenhagen, Denmark Since I already participated as a speaker in Copenhagen last year, I can avouch from “insider information” for the excellent organization and speaker choice. And my much valued collegue Niko Neugebauer (Blog, Twitter:@NikoNeugebauer) vouches for Portugal – after all what has “leaked” in th emeantine, it will be another congenial event. Condign to the first SQLSaturday-Location in Europe ever. |
Ich möchte zumindest einige, mir persönlich bekannte Sprecher namentlich erwähnen, aber gleich betonen, dass auch alle anderen Sessions definitiv einen Blick Wert sind(!): In Dänemark sind dabei:
|
I would like to at least name some speakers, which I personally know, by name, but I would also like to stress immediately, that also all other sessions are definitely worth looking at just as well: In Denmark there will be:
I am excited to see all of you again soon! The complete Agenda can be found here: www.sqlsaturday.com/275/schedule.aspx I am excited to see all of you again soon in Copenhagen! |
In Portugal sind dabei:
Die vollständige Agenda befindet sich hier: |
In Portugal there will be:
The complete Agenda can be found here: www.sqlsaturday.com/267/schedule.aspx I am excited to see all of you again soon in Lisbon! |
Und meine Wenigkeit, was präsentiere ich? |
And my humble self, what am I presenting? |
SQL Server 2014 In-Memory OLTP / XTP Management Deep Dive
@SQLSaturday Denmark & Portugal
You have heard about Hekaton, respectively the new acronym XTP (eXtreme Transactional Processing) and you want to know how it works under the cover? In this session we will take a closer look at the architecture, where the performance benefits come from and how it works in detail. What kind of files is SQL Server using for transactional consistency, what happens when you delete data inside the log and inside the data files. We will see the Merge-Process and the Garbage Collector in action, see how memory management works for XTP enabled databases, and thereby get an in-depth understanding of how this completely new storage engine works and how to optimize for it.
CU in Copenhagen, Lisbon.. or at another conference soon :-)
Andreas