<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Laurentiu Cristofor's blog @microsoft.com : computer security</title><link>http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx</link><description>Tags: computer security</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>New attack on AES-256</title><link>http://blogs.msdn.com/lcris/archive/2009/10/14/new-attack-on-aes-256.aspx</link><pubDate>Thu, 15 Oct 2009 00:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907378</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/9907378.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=9907378</wfw:commentRss><description>&lt;P&gt;A new attack improves significantly on previous attacks against AES-256, see: &lt;A href="http://schneier.com/crypto-gram-0908.html#8"&gt;http://schneier.com/crypto-gram-0908.html#8&lt;/A&gt;. This doesn't mean that AES-256 is broken yet, but the surprising bit here is that AES-128 is not susceptible to this particular attack. Don't panic if you are using AES-256&amp;nbsp;and&amp;nbsp;read&amp;nbsp;Bruce Schneier's commentary carefully - for example, note that the attack is against a 10 round AES-256, while standard implementations use 14 rounds.&lt;/P&gt;
&lt;P&gt;It's interesting to see that the strength of AES-256 is eroded by new attacks, but AES-128 doesn't suffer from them yet. It's another example that larger (or more expensive) isn't necessarily also better.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907378" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+cryptography/default.aspx">SQL Server - cryptography</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/encryption/default.aspx">encryption</category></item><item><title>SQL Injection watch blog</title><link>http://blogs.msdn.com/lcris/archive/2009/08/14/sql-injection-watch-blog.aspx</link><pubDate>Sat, 15 Aug 2009 00:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9870586</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/9870586.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=9870586</wfw:commentRss><description>I was looking for information on a new SQL injection attack when I stumbled upon this very useful blog: &lt;A href="http://s3cwatch.wordpress.com/"&gt;http://s3cwatch.wordpress.com/&lt;/A&gt;. It's worth a look from time to time, to get an idea of what attacks are going on in the wild.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9870586" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>Basic SQL Server Security concepts: ownership, CONTROL, TAKE OWNERSHIP</title><link>http://blogs.msdn.com/lcris/archive/2009/08/11/basic-sql-server-security-concepts-ownership-control-take-ownership.aspx</link><pubDate>Wed, 12 Aug 2009 01:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9865191</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/9865191.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=9865191</wfw:commentRss><description>&lt;P&gt;I realized today that while I have discussed earlier object&amp;nbsp;&lt;A href="http://blogs.msdn.com/lcris/archive/2007/09/12/basic-sql-server-security-concepts-permissions-and-special-principals-sa-dbo-guest.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2007/09/12/basic-sql-server-security-concepts-permissions-and-special-principals-sa-dbo-guest.aspx"&gt;permissions&lt;/A&gt;, I have not gone into the details of object ownership.&amp;nbsp;I want to cover the following here: ownership of objects,&amp;nbsp;how it can be changed, and the relatively new permission CONTROL (introduced in SQL Server 2005).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Ownership:&lt;/STRONG&gt; This should&amp;nbsp;be&amp;nbsp;pretty clear - the owner of an object is usually its creator, but a different owner can be&amp;nbsp;specified at creation time using the AUTHORIZATION clause. The owner of an object has all possible permissions on that object and, most importantly, cannot be denied those permissions while he continues to be an owner.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CONTROL permission:&lt;/STRONG&gt; The CONTROL permission can be used to easily grant all permissions on an entity to some principal. It's the next best thing after ownership of the entity, but it's not quite as powerful as ownership. The main difference is that a grantee of CONTROL can still be denied some other permissions on the entity. For example, I can be granted CONTROL on a table, while at the same time I can be denied SELECT on that table, preventing me from selecting from it - this can never happen to the owner, because the owner cannot be granted or denied permissions.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Changing ownership:&lt;/STRONG&gt; &amp;nbsp;To change the owner of an entity, we can use the &lt;A href="http://msdn.microsoft.com/en-us/library/ms187359.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms187359.aspx"&gt;ALTER AUTHORIZATION&lt;/A&gt; statement. Changing ownership of an object creates some interesting scenarios in terms of what should be allowed and what should not be. Basically, owners should not be able to "dump" their objects to other users who may not want them and users should not be able to "steal" objects from those that own them. To accomplish this, two&amp;nbsp;checks are needed: one controls to whom&amp;nbsp;ownership can be given&amp;nbsp;to - we verify that the performer of the change has some right on the new owner (we check for IMPERSONATE for users and logins, ALTER or membership for roles, etc);&amp;nbsp;the other&amp;nbsp;check controls from whom&amp;nbsp;ownership can be taken away: we require the performer of the change to have TAKE OWNERSHIP permission on the object.&lt;/P&gt;
&lt;P&gt;Note&amp;nbsp;as a corollary that a grantee of CONTROL permission on an object has the ability to take ownership of the object&amp;nbsp;because CONTROL implies the TAKE OWNERSHIP permission as well - the way to prevent this would be to grant CONTROL and deny TAKE OWNERSHIP.&lt;/P&gt;
&lt;P&gt;TAKE OWNERSHIP is thus used to &lt;EM&gt;selectively&lt;/EM&gt; grant someone the ability to &lt;EM&gt;willingly&lt;/EM&gt; become the owner of an object or to facilitate the change of ownership of that object.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Side effect of ownership change:&lt;/STRONG&gt; A potentially surprising side effect of changing ownership of an object is that all permissions granted on that object will be lost. As always, it's a good idea to script all permissions granted on an entity before changing its ownership, so that the grants can be re-executed by the new owner, if appropriate.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9865191" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/basic+SQL+Server+security+concepts/default.aspx">basic SQL Server security concepts</category></item><item><title>TechCrunch anatomy of the Twitter attack</title><link>http://blogs.msdn.com/lcris/archive/2009/07/23/techcrunch-anatomy-of-the-twitter-attack.aspx</link><pubDate>Fri, 24 Jul 2009 02:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9846958</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/9846958.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=9846958</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://www.techcrunch.com/2009/07/19/the-anatomy-of-the-twitter-attack/" mce_href="http://www.techcrunch.com/2009/07/19/the-anatomy-of-the-twitter-attack/"&gt;http://www.techcrunch.com/2009/07/19/the-anatomy-of-the-twitter-attack/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The first step of registering an old email account to receive the password from a current account was a nice and&amp;nbsp;easy way to break into an email acount. After that, things pretty much fell like dominoes, but it's nice to see how inconspicuous a smart attacker can be. This story also&amp;nbsp;reminds us&amp;nbsp;the painful fact that the only way you can know about some security breach is if the attacker is destructive, or less skilled, or wants you to know. The victims of this attack could have spent the rest of their lives without knowing that their information is being monitored.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9846958" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>A SQL Injection attack and search engines</title><link>http://blogs.msdn.com/lcris/archive/2008/08/05/a-sql-injection-attack-and-search-engines.aspx</link><pubDate>Tue, 05 Aug 2008 22:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8834964</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/8834964.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=8834964</wfw:commentRss><description>&lt;P&gt;A few weeks after my previous posting of a SQL Injection Advisory link,&amp;nbsp;a new SQL Injection attack came up. Here's a post describing it; it also includes other useful links:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.rtraction.com/blog/devit/sql-injection-hack-using-cast.html"&gt;http://www.rtraction.com/blog/devit/sql-injection-hack-using-cast.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;A search for the query string &lt;EM&gt;"http://1.verynx.cn/w.js"&lt;/EM&gt; (the quotes are part of the search string) shows that there are still sites infected today.&lt;/P&gt;
&lt;P&gt;So, SQL Injection is alive and kicking - no big surprise here. But what may come as a surprise to you, if you're not aware of it yet, is that there is a further vulnerability here: vulnerable sites are&amp;nbsp;discoverable using a search engine - it happens when the SQL Injection results in some link getting inserted in web pages, as is the case in this recent attack. This means another attacker can use a search engine to get a list of vulnerable sites and hack them a second time, for a more devastating effect. This is&amp;nbsp;an instance of&amp;nbsp;Search Engine Hacking&amp;nbsp;- Google Hacking&amp;nbsp;is currently&amp;nbsp;the popular term, but any search engine can be used, not&amp;nbsp;just google. Note that this is not really about hacking the search engine, but about using the search engine for hacking.&lt;/P&gt;
&lt;P&gt;Here is&amp;nbsp;more in-depth&amp;nbsp;information on this techique of search engine hacking:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.amazon.com/Google-Hacking-Penetration-Testers-1/dp/1931836361" mce_href="http://www.amazon.com/Google-Hacking-Penetration-Testers-1/dp/1931836361"&gt;Google Hacking for Penetration Testers&lt;/A&gt;&lt;BR&gt;&lt;A class="" href="http://en.wikipedia.org/wiki/Google_Hacking" mce_href="http://en.wikipedia.org/wiki/Google_Hacking"&gt;Google Hacking page on Wikipedia&lt;/A&gt;&lt;BR&gt;&lt;A class="" href="http://johnny.ihackstuff.com/ghdb.php" mce_href="http://johnny.ihackstuff.com/ghdb.php"&gt;Google Hacking Database&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also note that search engine hacking goes beyond SQL Injection attacks - the sources mentioned above&amp;nbsp;contain more examples of searching for different vulnerabilities. If you're&amp;nbsp;the administrator of a Web site, you cannot afford to ignore this technique.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8834964" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/search+engines/default.aspx">search engines</category></item><item><title>New Microsoft Security Advisory on SQL Injection</title><link>http://blogs.msdn.com/lcris/archive/2008/06/25/new-microsoft-security-advisory-on-sql-injection.aspx</link><pubDate>Wed, 25 Jun 2008 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8652823</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/8652823.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=8652823</wfw:commentRss><description>&lt;P&gt;This&amp;nbsp;came up&amp;nbsp;yesterday: &lt;A href="http://www.microsoft.com/technet/security/advisory/954462.mspx"&gt;http://www.microsoft.com/technet/security/advisory/954462.mspx&lt;/A&gt;. It has good information and links.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8652823" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>A discussion of password authentication schemes</title><link>http://blogs.msdn.com/lcris/archive/2008/05/09/a-discussion-of-password-authentication-schemes.aspx</link><pubDate>Fri, 09 May 2008 23:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8481962</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/8481962.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=8481962</wfw:commentRss><description>&lt;P&gt;I have talked in the past about how passwords for SQL logins are protected in SQL Server (see &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2007/04/30/sql-server-2005-about-login-password-hashes.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2007/04/30/sql-server-2005-about-login-password-hashes.aspx"&gt;this post&lt;/A&gt;). I would like to describe this scheme in a more generic way and compare it with the alternative of encrypting the passwords, because I have seen people wondering which method they should use.&lt;/P&gt;
&lt;P&gt;First, what is authentication? Authentication is the process we go through to verify the identity of a user. It should not be confused with authorization, which is about what actions we allow an already identified user to do. Authorization happens after authentication and relies on its result.&lt;/P&gt;
&lt;P&gt;Authentication schemes&amp;nbsp;are based on&amp;nbsp;information&amp;nbsp;falling in three large categories: what the user knows (passwords, PINs, birth date, mother's maiden name), what the user has (id card, badge, debit card, credit card, smartcard), and what the user is (photograph, retina scan, fingerprint, voice recognition). Sometimes combinations are used - a debit card&amp;nbsp;requires knowing its PIN and an identification card will have some biometrics information like a photograph and maybe height and weight information as well.&lt;/P&gt;
&lt;P&gt;The goal of password authentication is therefore to verify a user's identity based on a password associated with him that only he should know. If more people know the password, then we cannot really authenticate the user - we're authenticating the group of people that know the password. The good thing about a password is that we can commit it to memory and&amp;nbsp;we can later recall it when&amp;nbsp;we need it - the fact that it resides only in memory is appealing from a security point of view because&amp;nbsp;others can't yet read our&amp;nbsp;minds reliably. The bad thing about a password is that we have to commit it to memory and we may fail to recall it later when we need it - this is&amp;nbsp;an inconvenience that may not have any security impact by itself, but it&amp;nbsp;usually leads to one because, to avoid the situation, we'll usually&amp;nbsp;pick something easy to remember which might also be easy to guess. Writing it down on a piece of paper is not that bad as long as we keep that piece of paper secure.&amp;nbsp;A password is also vulnerable during the moment it leaves our mind to be presented for authentication&amp;nbsp;- by typing it on a keyboard or by saying it on the telephone. Note that all these observations apply to any authentication method based on what the user knows&amp;nbsp;- in fact, the other ones I listed have more problems than passwords - PINs are shorter, and the birth date and the mother's maiden name are not only known to&amp;nbsp;one person.&lt;/P&gt;
&lt;P&gt;So let's look at how we can perform password authentication.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 1 - Store:&lt;/STRONG&gt; Store the user password somewhere in the system. Whenever the user provides his password, we compare it with the stored one and, if they match, we have successfully authenticated him.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Problems:&lt;/EM&gt; One, but big: the password is stored in clear, meaning that whoever has access to the storage place can learn the passwords stored there. This is a big problem because it means the password can be accessed by bypassing the application and just examining the disk; it will be there if the disk breaks down and gets replaced, for example. How can we improve this? A particularly bad&amp;nbsp;direction would be to try to come up with our own obfuscation scheme for not storing the passwords in clear. We'll not go there, so let's look at proven technologies. We can use an encryption algorithm that has already proved its usefulness in the field.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 2 - Store encrypted:&lt;/STRONG&gt; Have some encryption key created for the purpose of encrypting passwords. We store the user password encrypted with this key and whenever the user will provide us with his password, we'll decrypt the stored one and compare them.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Problems:&lt;/EM&gt; A couple smaller ones: the first problem is about finding a way to protect the encryption key, the second problem is that anybody with access to the encryption key will still have access to all the passwords. Finding a way to protect the encryption key is tricky - as I mentioned in other posts, encryption doesn't really solve the problem of protecting information - it just changes the problem of protecting a lot of information into a problem of protecting a tiny bit of information - the encryption key. Whether we address this issue or not, there is no denying that it adds some complexity to the solution. I also don't like the idea that administrators of the system could know my password - yes they could send it back to me if I forget it, but they could also leak it or just use it to find out more about how I choose my passwords. So, I am not happy with this solution - how can we improve it? Well, here comes hashing! Hashing works one-way - you can get a hash from some information, but you cannot retrieve that information from the hash.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 3 -&amp;nbsp;Store&amp;nbsp;hash:&lt;/STRONG&gt; Choose a hashing algorithm and store the hash of the user password. When the user provides his password, hash it and compare the result against the stored hash.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Problems:&lt;/EM&gt; One tiny one: Hash collisions - it is possible for two different passwords to have the same hash value, but cryptographic hash algorithms make this very unlikely. Also, there's no way we can find out a password if the user forgets it - we'll have to instead change his password and provide him with the new password and a method of changing it. Of course, before doing this we have to figure out another way of authenticating him - Web applications usually solve this problem by sending the password to the email account associated with the user.&lt;/P&gt;
&lt;P&gt;What did we gain with this method? The password is not stored in clear, we don't have any encryption keys to manage,&amp;nbsp;and we have better guarantees that the system and its administrators&amp;nbsp;are not&amp;nbsp;able to retrieve the passwords from the stored hashes. The administrators can still monitor the system when you are providing the password, but that is more difficult than just decrypting the encrypted passwords and is an issue that all these password authentication methods&amp;nbsp;have anyway.&lt;/P&gt;
&lt;P&gt;But it's not over yet! We can make this better. To understand why, let's look at how we can attack this method and whether we can thwart some attacks. &lt;/P&gt;
&lt;P&gt;A simple way to attempt to retrieve passwords from hashes would be to build a large collection of possible passwords - we won't be able to have all possible passwords in it, but we can collect a lot of &lt;EM&gt;likely&lt;/EM&gt; passwords and we can grow this collection over time. Once we have this collection, we can hash all these passwords using the same algorithm that the application uses (we can reverse engineer it by examining the application or we can simply use the application itself to generate the hashes by creating accounts for all those potential passwords). Whatever the method, we can end up with a collection of hashes and corresponding passwords -&amp;nbsp;we now have&amp;nbsp;a dictionary&amp;nbsp;that we can use&amp;nbsp;to attempt to break other hashes by simply looking them up in it. Of course, we won't be able to break any password, but if we break one and it happens to be an administrator account, it's enough.&lt;/P&gt;
&lt;P&gt;This sounds bad, right? You're bound to have some users with poor passwords, maybe even administrators (sa with&amp;nbsp;empty password was a bane of&amp;nbsp;many SQL Server installations)&amp;nbsp;and this attack will break those passwords. It's important to remember that a prerequisite for this attack is to have access to the password hashes in the first place, which is not trivial to get except for the administrators. But this is still not very nice and there is actually a little trick we can do that will make a dictionary attack much more costly.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Method 4 - Store salted hash:&lt;/STRONG&gt; The trick we'll use is to add some randomness to the hash generation process - this is called "salting" the hash. What we're going to do is to randomly generate a&amp;nbsp;piece of information called the "salt" for each password that is set for a user. This salt will be combined with the password and we'll store both the salt and the hash in the system. Whenever the user will submit a password, we'll lookup the salt and hash, we'll combine the salt with the submitted password, we'll hash the result and we'll compare it against the stored hash.&lt;/P&gt;
&lt;P&gt;How can we combine the salt with the password? One simple way is to prepend the salt to the password - this will work well with most hashing algorithms. Appending&amp;nbsp;the salt&amp;nbsp;may not be as good - it may end up affecting only part of the hash, depending on how the hash algorithm works. If you want to get creative here, look&amp;nbsp;for more information about the hashing algorithm in a cryptography book.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does this help with the dictionary attack? Well, because for each hash we have a salt value, a single dictionary won't cut it anymore - the attacker would have to build a dictionary for each salt value - and that is expensive because hashing is not a cheap operation.&lt;/P&gt;
&lt;P&gt;How large should a salt be? If you make it too small,&amp;nbsp;1 byte, for example, it is still feasible to build 256 dictionaries to cover all possible values of that salt. So salts should be picked up to be larger values. For example, a 4 byte salt would require more than 4 billion dictionaries - this is the value used in SQL Server 2005.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8481962" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/encryption/default.aspx">encryption</category></item><item><title>Security in a nutshell</title><link>http://blogs.msdn.com/lcris/archive/2008/04/23/security-in-a-nutshell.aspx</link><pubDate>Wed, 23 Apr 2008 23:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8420029</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/8420029.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=8420029</wfw:commentRss><description>&lt;P&gt;Here's&amp;nbsp;an attempt to&amp;nbsp;succintly describe why achieving security is difficult:&lt;/P&gt;
&lt;P&gt;The engineer&amp;nbsp;wants to implement a program P that allows users to perform action A.&lt;BR&gt;The hacker looks at program P and&amp;nbsp;wonders how&amp;nbsp;can he&amp;nbsp;use it to perform actions &lt;STRONG&gt;other&lt;/STRONG&gt; than A.&lt;BR&gt;The security guy wants to implement a program P that allows users to perform action A &lt;STRONG&gt;and only&lt;/STRONG&gt; action A.&lt;/P&gt;
&lt;P&gt;Some observations based on this description:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- defining A precisely is harder than it may sound&lt;BR&gt;&amp;nbsp;- it can be&amp;nbsp;non-trivial to implement&amp;nbsp;P&amp;nbsp;so that it performs&amp;nbsp;A&lt;BR&gt;&amp;nbsp;-&amp;nbsp;if P&amp;nbsp;fails to accomplish A, it will likely&amp;nbsp;accomplish something else than A&lt;BR&gt;&amp;nbsp;- there is a cascading effect that increases the probability of not being able to achieve the security guy's goal&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8420029" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>SQL Server: Password policy FAQ</title><link>http://blogs.msdn.com/lcris/archive/2008/02/20/sql-server-password-policy-faq.aspx</link><pubDate>Thu, 21 Feb 2008 03:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7826814</guid><dc:creator>lcris</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/lcris/comments/7826814.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=7826814</wfw:commentRss><description>&lt;P&gt;I am starting this post to collect frequent Q&amp;amp;A related to password policy. I plan to keep updating the post if anything new is worth adding to it. Note that this FAQ does not cover SQL Server Compact Edition. Also note that BOL stands for Books OnLine.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: What is the SQL Server password policy feature?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Password policy is a feature introduced in SQL Server 2005 for the purpose of strengthening SQL Authentication by having it enforce the same password policies that Windows is set to enforce. This means password policy is specific to SQL logins. A password policy determines what passwords are acceptable and also when they expire or whether the account should be locked out after a number of unsuccessful login attempts due to the use of incorrect passwords.&lt;/P&gt;
&lt;P&gt;While the primary use of password policy is to strengthen SQL Authentication, password policy is also enforced whenever setting a new password&amp;nbsp;with the encryption features introduced in SQL Server 2005 - this enforcement only refers to password strength; there is no expiration/lock out enforcement for these passwords. This enforcement cannot be disabled.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: On what versions of SQL Server is the password policy available?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; The password policy enforcement is done using a new API introduced in Windows 2003: the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/aa370661(VS.85).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa370661(VS.85).aspx"&gt;NetValidatePasswordPolicy&lt;/A&gt; API. Thus, password policy is only available on versions of the Microsoft Windows OS starting with the 2003 version. Note that if this API ever gets backported to older OSs, then SQL Server should automatically start using it. The best way to determine if something changed about the availability of this feature on older OSs is to check the API page for any updates.&lt;/P&gt;
&lt;P&gt;Note that on older OSs, SQL Server does perform a few basic password complexity checks, as described&amp;nbsp;at the end&amp;nbsp;of&amp;nbsp;this &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms161959.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms161959.aspx"&gt;password policy BOL article&lt;/A&gt;. However, this is all that is available on older OSs - there are no lock out or expiration features.&lt;/P&gt;
&lt;P&gt;Password policy is not restricted based on SQL Server edition.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I use the password policy feature?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; If you are creating a new login using &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms189751.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms189751.aspx"&gt;CREATE LOGIN&lt;/A&gt;, you can use two clauses related to password policy: CHECK_POLICY and CHECK_EXPIRATION. If they are not specified, the default for CHECK_POLICY is ON and for CHECK_EXPIRATION is OFF. These options can be changed at a later time using &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx"&gt;ALTER LOGIN&lt;/A&gt;. CHECK_POLICY governs the bulk of password policy enforcement related to password strength and lock out. CHECK_EXPIRATION separately covers the enforcement of password expiration, which was considered too disruptive for the rolling out of this feature, to be enabled by default. CHECK_EXPIRATION is also required when using the MUST_CHANGE option, to force a password change on the first login through that account. CHECK EXPIRATION depends on CHECK_POLICY; other dependencies are covered in BOL.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I manage this feature using&amp;nbsp;Management Studio?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; There should&amp;nbsp;be checkboxes in a login properties dialog corresponding to the T-SQL options. A GUI can change more often than T-SQL syntax, so I prefer to describe features using the T-SQL interface. Also, I&amp;nbsp;prefer to use only&amp;nbsp;T-SQL for SQL Server management operations.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How do I check the password policy settings on my system?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Execute &lt;EM&gt;secpol.msc&lt;/EM&gt;, then look&amp;nbsp;at Account Policies. If you are on a standalone machine and you are an administrator, you can change these settings. If your machine is joined to a domain, these settings&amp;nbsp;are controlled&amp;nbsp;by the domain administrator.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: Why can't I set the policy options for Windows logins in SQL Server?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Because Windows logins already benefit from password policy enforcement at the OS level.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: I keep getting messages about my password not being acceptable when creating a new login. How do I fix this?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; The error message will usually indicate what the problem is; for example, it will tell you if the password is too short. To&amp;nbsp;find more details about&amp;nbsp;what restrictions are in place for passwords, you can check the policy settings using the &lt;EM&gt;secpol.msc&lt;/EM&gt; tool, as described in a previous answer. You can also disable the policy enforcement for the login, but this is not recommended as it can make that login more vulnerable to a bruce force attack.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: I am running SQL Server on Windows XP/2000, etc. Does this mean I cannot benefit from password policy enforcement?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Pretty much, yes. On OSs that don't support the password policy API, SQL Server only performs a&amp;nbsp;&lt;EM&gt;tiny&lt;/EM&gt; number of checks on the password strength&amp;nbsp;-&amp;nbsp;to prevent you, for example, from using an empty password. The actual checks are described in the last part of this &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms161959.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms161959.aspx"&gt;password policy BOL article&lt;/A&gt;. These checks are governed by the CHECK_POLICY settings, so they can be turned off or on. If you ever hit a password policy error on older OSs than Windows 2003, then you really need to revisit the method you are using to pick passwords.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: I am getting a password policy error even though I run on Windows XP/2000. I thought there is no password policy enforcement for these systems. What's going on?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; You are using really weak passwords. See above answer.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7826814" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>Can encryption make you more vulnerable?</title><link>http://blogs.msdn.com/lcris/archive/2008/02/11/can-encryption-make-you-more-vulnerable.aspx</link><pubDate>Tue, 12 Feb 2008 03:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7629291</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/7629291.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=7629291</wfw:commentRss><description>&lt;P&gt;A &lt;A class="" href="http://security.itworld.com/4341/encryption-makes-you-more-vulnerable-080211/page_1.html" mce_href="http://security.itworld.com/4341/encryption-makes-you-more-vulnerable-080211/page_1.html"&gt;recent article&lt;/A&gt; brings up this question and argues that encrypting data at rest&amp;nbsp;can open the door to a new range of security and usability problems. Speaking only of the security aspects, I both agree and disagree,&amp;nbsp;so&amp;nbsp;I'd like to add a few comments on this topic.&lt;/P&gt;
&lt;P&gt;I think that the article makes a very good point that&amp;nbsp;represents a great truth about security: the features you build to protect against attackers could end up being used by the attackers against you - this is&amp;nbsp;the double-edged aspect of security. Once&amp;nbsp;a system is compromised and the attacker gets&amp;nbsp;to control&amp;nbsp;it, he can use its defenses against the lawful users. This is not a new idea, but it is one that can be easily forgotten when adding new security features.&lt;/P&gt;
&lt;P&gt;That being said, I don't think that the scenario presented in the article about ransoming data is a new or very interesting scenario. Here are the reasons why:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- An attacker can use his own encryption routines to encrypt the data - it doesn't matter if the compromised system had any encryption capabilities. Malware with the capability to encrypt data has existed for years and cyber-criminals are known to be proficient at using encryption to protect their data. Thus, ransoming is not really a new threat - it just appears new to those that also see encryption as a new technology.&lt;BR&gt;- Ransoming could only work in a database system that lacks a disaster recovery procedure. Data loss is an ever-present threat for databases - even if ransoming would be new, it would be addressed by the same measures that address an old threat - data/key backups.&lt;BR&gt;- The weakest link in ransoming is the ransom collection - that's where the attacker exposes himself - this makes ransoming not very tempting.&lt;BR&gt;- Ransoming is also a bad idea because it tells the system owner that his system has been breached and gives him a chance to close that breach.&lt;BR&gt;- If an attacker can get access to data worth ransoming, it is more easy for him to make money from selling it and keeping his access secret than by attempting to ransom it.&lt;/P&gt;
&lt;P&gt;However, I &lt;STRONG&gt;do&lt;/STRONG&gt; think that encryption can make you more vulnerable - it can do that by giving people a false sense of security&amp;nbsp;if they think that just by having data encrypted,&amp;nbsp;it&amp;nbsp;becomes&amp;nbsp;secure. I went in a bit more detail about this idea&amp;nbsp;&lt;A class="" href="http://blogs.msdn.com/lcris/archive/2006/11/30/who-needs-encryption.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2006/11/30/who-needs-encryption.aspx"&gt;here&lt;/A&gt;, but the&amp;nbsp;point is that deploying encryption is not only about encrypting data but about carefully considering how the data will be accessed &lt;STRONG&gt;and&lt;/STRONG&gt; about securing that access -&amp;nbsp;sadly, the latter part&amp;nbsp;is where the security of most applications fails. Encryption addresses well certain scenarios such as stealing data at rest, but those scenarios do not necessarily represent how most data&amp;nbsp;is getting compromised today.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7629291" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+cryptography/default.aspx">SQL Server - cryptography</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/encryption/default.aspx">encryption</category></item><item><title>SQL Server undocumented password hashing builtins: pwdcompare and pwdencrypt</title><link>http://blogs.msdn.com/lcris/archive/2007/10/31/sql-server-undocumented-password-hashing-builtins-pwdcompare-and-pwdencrypt.aspx</link><pubDate>Wed, 31 Oct 2007 21:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5802629</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/5802629.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=5802629</wfw:commentRss><description>&lt;P&gt;First, I must say that I don't know why these exist in an undocumented form. They have been around for a long time&amp;nbsp;and a search on their names gets me back pages of hits. Being undocumented means that their actual implementation may change slightly from one version of SQL Server to another, mainly because the password hash format&amp;nbsp;could change - and it has changed for the last three major versions of SQL Server. They could also disappear entirely&amp;nbsp;in a future&amp;nbsp;release. So, you shouldn't write applications relying on these functions, but they may come in handy&amp;nbsp;for ad-hoc queries, when you know they're available.&lt;/P&gt;
&lt;P&gt;So here's a short description of the two functions:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;pwdencrypt&lt;/STRONG&gt;: takes a varchar value as parameter and returns a varbin value that is the SQL Server password hash of the input value. I have seen people talking about the use of this function for hashing passwords when implementing custom application authentication. &lt;STRONG&gt;Do not use this!&lt;/STRONG&gt; Starting with SQL Server 2005, you can use instead the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms174415.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms174415.aspx"&gt;HashBytes&lt;/A&gt; function, to implement any custom hashing scheme that you want. HashBytes provides you with direct access to several hashing algorithms, so there is no point in using pwdencrypt. In fact, I can't come up with any useful need for pwdencrypt and the only reason I included it here is to warn you against using it.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;pwdcompare&lt;/STRONG&gt;: takes two arguments - a varchar value that is a cleartext password and a varbin value that is a SQL Server password hash, and returns 1 if they match and 0 if they don't. There is a third optional parameter that can be set to 1 if the second parameter represents a pre-SQL Server 2000 password&amp;nbsp;hash value. This third parameter will most likely be dropped in a future SQL Server version.&lt;/P&gt;
&lt;P&gt;pwdcompare is useful if you are an administrator looking for accounts that have weak passwords. For example, to query for logins that have an empty password, the following queries can be used (first one will work on SQL Server 2000 and the second one uses the SQL Server 2005 new catalogs):&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;select&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;name&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;from&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys.syslogins&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;where&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;pwdcompare&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;''&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;password&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt; 1&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;select&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;name&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;from&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;sys.sql_logins&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;where&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;pwdcompare&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;''&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;FONT size=2&gt; password_hash&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt; 1&lt;/P&gt;
&lt;P&gt;Obviously, these queries can be used to search for other weak passwords than empty ones. Does this constitute a threat against the strength of password hashes by allowing a TSQL brute-force attack? Not really, because such an approach would be&amp;nbsp;very slow&amp;nbsp;- it would be much&amp;nbsp;more efficient&amp;nbsp;to attempt such an attack using a compiled program, and even such approach would only have a good chance of success against a short or weak password. So, the pwdcompare function doesn't make an attacker's job easier. Other than helping administrators with checking for weak passwords, I can't think of another use for this function.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5802629" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item><item><title>Basic SQL Server Security concepts: SIDs, orphaned users, and loginless users</title><link>http://blogs.msdn.com/lcris/archive/2007/10/25/basic-sql-server-security-concepts-sids-orphaned-users-and-loginless-users.aspx</link><pubDate>Fri, 26 Oct 2007 03:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5683564</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/5683564.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=5683564</wfw:commentRss><description>&lt;P&gt;I am grouping here two topics (orphaned users and&amp;nbsp;loginless users)&amp;nbsp;that are actually very different, but I have often seen confusion between them, so I am covering them together in an attempt to dispel that confusion.&lt;/P&gt;
&lt;P&gt;In a &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2007/03/23/basic-sql-server-security-concepts-logins-users-and-principals.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2007/03/23/basic-sql-server-security-concepts-logins-users-and-principals.aspx"&gt;previous discussion&lt;/A&gt; of logins and users, I pointed out that the way a login gets mapped to users in databases is via&amp;nbsp;its SID value. This mapping is a one to many mapping - a login maps to several users (each one in a different database), but a user maps back to a single login.&amp;nbsp;When a Windows login is created,&amp;nbsp;its SID value is taken to be the SID of the corresponding Windows principal, but for&amp;nbsp;SQL Server specific logins the SID values are generated at creation time, unless they are explicitly provided via the SID clause of &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms189751.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms189751.aspx"&gt;CREATE LOGIN&lt;/A&gt;. The SID value represents the identity of the login and is invariant for the life of the login - this is why the SID clause is not available for &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx"&gt;ALTER LOGIN&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The SID link between a login and a user&amp;nbsp;can be severed&amp;nbsp;when databases are moved from one server to another - this is because on the new server, there may be no login having the same SID as that user. When such a situation happens, we say that&amp;nbsp;the user was &lt;EM&gt;orphaned&lt;/EM&gt; - it becomes an &lt;EM&gt;orphan user&lt;/EM&gt;. Orphan users can also result from the deletion of a login - in previous versions, SQL Server attempted to warn about the existence of corresponding users, but even that check would fail to detect users in databases that were offline, so SQL Server 2005 no longer performs&amp;nbsp;it&amp;nbsp;(it was also an expensive check, as it required accessing each database). The bottom line is that orphaned users can appear in various ways and we have to either&amp;nbsp;fix them when they occur or we have to&amp;nbsp;prevent&amp;nbsp;them from occurring at all. The&amp;nbsp;classic method for restoring the SID link&amp;nbsp;was to use the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms189828.aspx"&gt;sp_change_users_login&lt;/A&gt; procedure, but starting with SQL Server 2005 SP2, a new LOGIN clause of &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms176060.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms176060.aspx"&gt;ALTER USER&lt;/A&gt; has also been made available, which helps fix Windows&amp;nbsp;users in addition to SQL users - a feature that sp_change_users_login was lacking. These methods will fix the SID of a user to match that of a login, effectively remapping the user to&amp;nbsp;match the login.&amp;nbsp;For the preventive approach, the main tool we have available is to create logins with an explicit SID value - this will help when moving a database between two or more&amp;nbsp;servers, by allowing&amp;nbsp;us to create in advance SQL Server logins that not only have&amp;nbsp;the same name, but&amp;nbsp;the same SID value as well. This will also help with recreating a login that was inadvertently dropped.&lt;/P&gt;
&lt;P&gt;Some people seem to think that having the possibility to change a login's SID to match that of a user&amp;nbsp;would be a great&amp;nbsp;feature. That is not true. Changing a login's SID would be wrong because it would attack the problem on the wrong side of the login-user relationship. When fixing the user SID, only that SID needs to be changed and this would be a database scoped operation, but when fixing a login SID, all corresponding user SIDs would have to be changed as well, otherwise we would generate more orphaned users instead of fixing them - and fixing all users mapped to a login isn't a task that can be easily performed,&amp;nbsp;because it would require the availability of all databases in which the login is mapped - something that cannot be guaranteed. There is a good reason why this issue is referred to as orphaned users and not as childless logins.&lt;/P&gt;
&lt;P&gt;So, orphaned users are an issue that normally&amp;nbsp;requires some fixing, when it occurs. Loginless users, on the other hand, are an intentional construct. They are created using the WITHOUT LOGIN clause of &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/ms173463.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms173463.aspx"&gt;CREATE USER&lt;/A&gt;&amp;nbsp;and they represent standalone users that &lt;STRONG&gt;cannot&lt;/STRONG&gt; map to a login (they have special&amp;nbsp;SID values preventing this), so you cannot connect to a database as a loginless user, although you can impersonate one via EXECUTE AS.&amp;nbsp;A loginless user is valuable in many situations where an application needs to have users that don't necessarily&amp;nbsp;correspond to a human user. For example, an application may be in need to create objects from time to time and to designate an owner for them - it could do this in the caller's context, but that would mean the caller would end up owning objects he may not be aware of - it is better for the application to designate a loginless user as the owner of those objects. One of my favorite uses of loginless users is to break ownership chains (see &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2007/09/13/basic-sql-server-security-concepts-ownership-chaining-good-and-evil-schemas.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2007/09/13/basic-sql-server-security-concepts-ownership-chaining-good-and-evil-schemas.aspx"&gt;previous discussion&lt;/A&gt;) by&amp;nbsp;assigning different loginless users as owners. Raul has a &lt;A class="" href="http://blogs.msdn.com/raulga/archive/2006/07/03/655587.aspx" mce_href="http://blogs.msdn.com/raulga/archive/2006/07/03/655587.aspx"&gt;lengthier&amp;nbsp;post&lt;/A&gt; on the topic of loginless users that offers&amp;nbsp;further examples of use, including some TSQL sample code.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5683564" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/basic+SQL+Server+security+concepts/default.aspx">basic SQL Server security concepts</category></item><item><title>SQL Server 2005: A note about the use of certificates</title><link>http://blogs.msdn.com/lcris/archive/2007/10/04/sql-server-2005-a-note-about-the-use-of-certificates.aspx</link><pubDate>Fri, 05 Oct 2007 06:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5285355</guid><dc:creator>lcris</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/lcris/comments/5285355.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=5285355</wfw:commentRss><description>&lt;P&gt;To avoid any confusion, this post is not about the use of certificates for securing the communication between a client machine and the server; instead, this&amp;nbsp;refers&amp;nbsp;to the use of certificates created via the CREATE CERTIFICATE DDL.&lt;/P&gt;
&lt;P&gt;I am prompted in writing this post by a recent question I just saw, which I know I answered&amp;nbsp;many times before, but I now realized I never wrote about it here. The question is simply around the differences between how certificates are used elsewhere and how certificates are used in SQL Server. I'll answer this question here and I'll add some additional information and references, which I hope you will find useful.&lt;/P&gt;
&lt;P&gt;The main use of certificates that we are familiar with from daily browsing activities is about the signing of code on the Internet. This signing is done as a way to prove the authenticity of a piece of software, because a signature can help&amp;nbsp;validate the manufacturer of a piece of software. I say &lt;EM&gt;"can help"&lt;/EM&gt;, because not everyone checks carefully the details of a digital signature to ensure it is indeed&amp;nbsp;trustworthy. For more details around this type of use scenario, you can look into &lt;A class="" href="http://en.wikipedia.org/wiki/Public_key_infrastructure" mce_href="http://en.wikipedia.org/wiki/Public_key_infrastructure"&gt;PKI - Public Key Infrastructure&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Certificates can be used in many ways, because asymmetric key encryption is a&amp;nbsp;very powerful&amp;nbsp;tool, so, when certificates were introduced in SQL Server, one of&amp;nbsp;the design goals was to build a generic store for encryption keys, without putting any unnecessary restrictions on their use. Because of this, expiry settings or certificate revocation&amp;nbsp;are not enforced.&amp;nbsp;SQL Server&amp;nbsp;just regards the certificate as a key container and&amp;nbsp;keeps track of all of its settings, but&amp;nbsp;it doesn't restrict its use - it is up to&amp;nbsp;you to decide&amp;nbsp;what&amp;nbsp;to do with&amp;nbsp;it. The main use scenarios within SQL Server do not require any restrictions, so the only thing that&amp;nbsp;is done is to give some warnings at the time the certificate is imported - if it was expired, for example. I should also note that features within SQL Server may do additional checks on a certificates's settings: for example, the Service Broker feature does check for expiration of its certificates. If your intent is to plug into PKI, that is also possible through CLR.&lt;/P&gt;
&lt;P&gt;So, what are the main use scenarios for having certificates in SQL Server? Here they are:&lt;/P&gt;
&lt;P&gt;1. You can use certificates to sign T-SQL code.&lt;BR&gt;2. You can use certificates to encrypt symmetric encryption keys or small pieces of data.&lt;/P&gt;
&lt;P&gt;Let's discuss these a little. Signing T-SQL code is the most powerful security feature shipped with SQL Server 2005 (my opinion, of course, as is any other subjective evaluation you may read on this blog). But, really, think about it: signing allows you to grant permissions to code instead of granting them to principals calling the code -&amp;nbsp;this opens a world of possibilities in terms of how you can manage permissions and how you can restrict access to objects. So that you don't get any wrong idea at my enthusiasm for this feature, I will add that I made no significant contributions to it, so I am not trying to push forward my work ;) For a simple example of the things you can do with signing, you can have a look at this &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2006/01/13/512829.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2006/01/13/512829.aspx"&gt;example&lt;/A&gt;. &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2006/01/13/512829.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2006/01/13/512829.aspx"&gt;Raul's blog&lt;/A&gt;&amp;nbsp;has additional examples and information on this feature.&lt;/P&gt;
&lt;P&gt;You can also use special builtin functions (SignByCert)&amp;nbsp;to sign your own data, but unfortunately, due to&amp;nbsp;a bug, their implementation uses the MD5 algorithm instead of the SHA1 algorithm used&amp;nbsp;in T-SQL signing, so they are not interoperable - you cannot use these functions to simulate the internal code signing, so that you could manually compute the signature of a function, for example; instead, you would need to actually create the function and sign it via ADD SIGNATURE, then read the signature blob from the system catalogs.&lt;/P&gt;
&lt;P&gt;The second use of certificates is quite natural for an encryption key&amp;nbsp;- we would definitely&amp;nbsp;like to encrypt something with it. The reason why certificates are more convenient to use for protecting symmetric keys than other methods is simply because they can be backed up individually. This also gives them an edge over their cryptographic sibling - the asymmetric keys. For a discussion of why there are two objects encapsulating RSA keys in SQL Server, see this &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2006/03/13/550904.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2006/03/13/550904.aspx"&gt;explanation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Some people think that certificate encryption is inherently safer than symmetric key encryption - it is not. There is no significant gain in strength from securing your data with an RSA key instead of using an AES one, as long as you are using equivalent key lengths - not equal, but&amp;nbsp;equivalent - more on this below. The RSA encryption is slower than any symmertric key encryption and its larger key length is simply due to&amp;nbsp;it being a fundamentally different technique and requiring longer key lengths than symmetric key algorithms, to offer the same strength of encryption. For a&amp;nbsp;discussion of key lengths and a comparison of key lengths across symmetric and asymmetric algorithms,&amp;nbsp;you can check&amp;nbsp;this &lt;A class="" href="http://en.wikipedia.org/wiki/Key_length" mce_href="http://en.wikipedia.org/wiki/Key_length"&gt;article&lt;/A&gt;&amp;nbsp;or a cryptography book. This means that certificates are not appropriate for data encryption and their use should be restricted to the encryption of symmetric keys (which are small enough that the encryption performance is not a concern) and to the application of digital signatures (when the key is only used to encrypt what is basically a hash of the signed data, hence, again,&amp;nbsp;performance is not a concern&amp;nbsp;given that&amp;nbsp;the length of a&amp;nbsp;SHA1 hash value&amp;nbsp;is 20 bytes/160 bits).&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5285355" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+cryptography/default.aspx">SQL Server - cryptography</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/encryption/default.aspx">encryption</category></item><item><title>SQL Server 2008: Transparent data encryption feature - a quick overview</title><link>http://blogs.msdn.com/lcris/archive/2007/10/03/sql-server-2008-transparent-data-encryption-feature-a-quick-overview.aspx</link><pubDate>Thu, 04 Oct 2007 02:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5270262</guid><dc:creator>lcris</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/lcris/comments/5270262.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=5270262</wfw:commentRss><description>&lt;P&gt;I have kept silent on this feature while it was being developed, but as it has now&amp;nbsp;been publicly&amp;nbsp;advertised in various ways (being mentioned &lt;A class="" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2138363&amp;amp;SiteID=1" mce_href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2138363&amp;amp;SiteID=1"&gt;here&lt;/A&gt;, &lt;A class="" href="http://download.microsoft.com/download/a/c/d/acd8e043-d69b-4f09-bc9e-4168b65aaa71/SQL2008_ProductOverview.doc" mce_href="http://download.microsoft.com/download/a/c/d/acd8e043-d69b-4f09-bc9e-4168b65aaa71/SQL2008_ProductOverview.doc"&gt;here&lt;/A&gt;, &lt;A class="" href="http://www.pcworld.com/article/id,137558-pg,1/article.html" mce_href="http://www.pcworld.com/article/id,137558-pg,1/article.html"&gt;here&lt;/A&gt;, and &lt;A class="" href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;amp;articleId=9037060&amp;amp;intsrc=hm_list" mce_href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;amp;articleId=9037060&amp;amp;intsrc=hm_list"&gt;here&lt;/A&gt;, for example), I think it is probably time to write a bit about it. Given that my posts so far have covered SQL Server 2005, I'll point out again that this is a SQL Server &lt;STRONG&gt;2008&lt;/STRONG&gt; feature!&lt;/P&gt;
&lt;P&gt;The transparent data encryption feature in the next SQL Server version is the last feature I worked on while I was in the SQL Server security team, before my &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2007/04/21/transition.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2007/04/21/transition.aspx"&gt;move&lt;/A&gt; to&amp;nbsp;MSR. Transparent data encryption is quite a long name, so I'll just refer to it as TDE from now on.&lt;/P&gt;
&lt;P&gt;TDE addresses&amp;nbsp;two of the encryption requests we have received most often&amp;nbsp;from forum questions and from discussions with customers:&lt;/P&gt;
&lt;P&gt;(1) a way to&amp;nbsp;enable data encryption without affecting applications that consumed that data (for an idea of what problems are raised&amp;nbsp;when encrypting a&amp;nbsp;table column&amp;nbsp;in a database, see this&amp;nbsp;&lt;A class="" href="http://blogs.msdn.com/lcris/archive/2005/12/22/506931.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2005/12/22/506931.aspx"&gt;post&lt;/A&gt;)&lt;BR&gt;(2) a way to encrypt an entire database&lt;/P&gt;
&lt;P&gt;TDE addresses both these requests by providing a database level encryption feature. Both&amp;nbsp;the data and the log files of a database are encrypted on disk and get decrypted when they are read into memory. This makes encryption really transparent to applications. Because database applications attempt to minimize their I/O (a costly operation),&amp;nbsp;tying encryption and decryption&amp;nbsp;to I/O&amp;nbsp;will also take advantage of existing application design optimizations to minimize the performance impact of encryption.&lt;/P&gt;
&lt;P mce_keep="true"&gt;It is important to note that TDE should not be perceived as a replacement of the encryption solutions shipped with SQL Server 2005; instead, TDE should be viewed as a complementary feature providing encryption at a coarser granularity level. Whereas the encryption features introduced in SQL Server 2005 provide a way to encrypt individual pieces of data&amp;nbsp;(something we&amp;nbsp;refer to&amp;nbsp;as cell-level encryption, because it offers finer granularity than column level encryption), the new TDE feature&amp;nbsp;enables encryption at database level. Also, from a cryptographic point of view, the algorithms used in TDE have also been available with the cell-level encryption, so the two features&amp;nbsp;offer the same encryption strength.&lt;/P&gt;
&lt;P mce_keep="true"&gt;The encryption of a database with TDE is done using a special key called, simply,&amp;nbsp;&lt;EM&gt;database encryption key&lt;/EM&gt; (or DEK, for short). The DEK can be managed using standard DDL (CREATE/ALTER/DROP) and the actual state of the encryption can be turned on or off using the ALTER DATABASE statement and&amp;nbsp;a new clause: SET ENCRYPTION [ON | OFF].&amp;nbsp;Information about DEKs can be gathered from a DMV called sys.dm_database_encryption_keys. If you like using&amp;nbsp;a GUI for database operations, all these features are also exposed from within Management Studio. I&amp;nbsp;prefer typing SQL queries&amp;nbsp;when it comes to managing a database,&amp;nbsp;which is the reason why in my posts you'll&amp;nbsp;find more details about&amp;nbsp;DDL and system catalogs&amp;nbsp;than about&amp;nbsp;menus and dialog options.&lt;/P&gt;
&lt;P mce_keep="true"&gt;If you have&amp;nbsp;a &lt;A class="" href="http://technet.microsoft.com/en-us/sqlserver/bb498264.aspx" mce_href="http://technet.microsoft.com/en-us/sqlserver/bb498264.aspx"&gt;CTP build&lt;/A&gt;, you can quickly check for the presence of the TDE&amp;nbsp;feature by issuing the following statement: &lt;EM&gt;alter database&amp;nbsp;&amp;lt;db_name&amp;gt; set encryption on&lt;/EM&gt;. A syntax error will mean that&amp;nbsp;the feature is not present, while a more specific error message will indicate&amp;nbsp;that the feature is available - note that the statement should&amp;nbsp;result in no state changes&amp;nbsp;anyway, as long as you have not used TDE before. As of today, to my knowledge, only the latest CTP&amp;nbsp;build includes this feature.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5270262" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+cryptography/default.aspx">SQL Server - cryptography</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/encryption/default.aspx">encryption</category></item><item><title>Security and copy protection</title><link>http://blogs.msdn.com/lcris/archive/2007/09/24/security-and-copy-protection.aspx</link><pubDate>Tue, 25 Sep 2007 01:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5112494</guid><dc:creator>lcris</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/lcris/comments/5112494.aspx</comments><wfw:commentRss>http://blogs.msdn.com/lcris/commentrss.aspx?PostID=5112494</wfw:commentRss><description>&lt;P&gt;I have been watching the &lt;A class="" href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=92&amp;amp;SiteID=1" mce_href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=92&amp;amp;SiteID=1"&gt;SQL Server Security forum&lt;/A&gt; for several years now and there is one question that gets spawned about once a&amp;nbsp;month under different titles. It invariably begins with a request for guidance on how to secure access to&amp;nbsp;a database, which sounds like a reasonable security inquiry, but after a while it becomes clear that the subject is copy protection for some application's database. All right, but why does it matter? Well, it matters because these are very different topics. (Note that I am using &lt;A class="" href="http://en.wikipedia.org/wiki/Copy_protection" mce_href="http://en.wikipedia.org/wiki/Copy_protection"&gt;copy protection&lt;/A&gt; as an umbrella term - these days, &lt;A class="" href="http://en.wikipedia.org/wiki/Digital_rights_management" mce_href="http://en.wikipedia.org/wiki/Digital_rights_management"&gt;DRM&lt;/A&gt; is the fashionable term, which stands for digital rights management and which covers more than the simple operation&amp;nbsp;of&amp;nbsp;copying. But I'm trying to keep things simple.)&lt;/P&gt;
&lt;P&gt;Let's see what&amp;nbsp;security and copy protection&amp;nbsp;are about. Security is about controlling &lt;STRONG&gt;access&lt;/STRONG&gt; to data - a person is either allowed to access the data or not. Security may restrict the way&amp;nbsp;in which&amp;nbsp;the access can be gained, but it cannot control what the person will do with the information once&amp;nbsp;he gets access to it - that person may give it away, sell it, or&amp;nbsp;store it for&amp;nbsp;his&amp;nbsp;personal use. This is where copy protection comes in and attempts to establish some control over the &lt;STRONG&gt;use&lt;/STRONG&gt; of the data. The goal of copy protection is to restrict what the user can do with some information once he already got it. To be sure, the goal of copy protection may pertain to security, but the problem is that there are no viable techniques that allow us to achieve that&amp;nbsp;- the techniques used so far&amp;nbsp;are simply&amp;nbsp;not capable&amp;nbsp;of providing the guarantees that one&amp;nbsp;associates with security techniques.&lt;/P&gt;
&lt;P&gt;But why is copy protection a hard problem?&amp;nbsp;The difficulty of achieving copy protection should become immediately apparent with the following simple example: let's say the data I want to protect is a confidential telephone number. There is no way one can possibly copy-protect that, because no matter what access restrictions&amp;nbsp;one would set around the record storing the phone number, the people that have access to it can do whatever they want with it. There is no techology that we can use to enforce the restrictions we would like placed on that telephone number. Some solutions may come to mind, but they are either extreme, or expensive, or both: permanent surveillance of the persons that came into contact with the phone number (Big Brother method), restricting the contact that those persons have with any unauthorized person (imprisonment technique), or&amp;nbsp;inflicting capital punishment on&amp;nbsp;those persons (medieval approach) - so, basically, there are no&amp;nbsp;solutions that we can implement in IT. What remains is recourse to the legal system - we can launch an investigation in the leak of the telephone number and we can hope to catch the culprit and have him sentenced -&amp;nbsp;this may not help that much after the fact, but it &lt;EM&gt;might&lt;/EM&gt; be a strong enough deterrent.&lt;/P&gt;
&lt;P&gt;At this point, someone may argue that the example I gave above&amp;nbsp;is simplistic - that we may not care about the loss of a single phone number but about the loss of 1 billion phone numbers that cannot possibly be memorized by a person, or that the information that we want to protect is hard to memorize - maybe it is an image or an audio file. Well, it doesn't matter. What that simplistic example shows is that there is a hole that cannot be covered - the fact that the user gets access to the information whose use we are supposed to restrict. Having more information to protect may make the user's task of copying it&amp;nbsp;more difficult&amp;nbsp;if&amp;nbsp;he only has access to a pen and a bit of paper, but when the user has a computer in his hands - a tool designed to relieve man from tedious activities such as computing or memorizing lots of stuff - then there is really no additional difficulty raised.&lt;/P&gt;
&lt;P&gt;But what about all those copy protection schemes that are in use today? How do they work&amp;nbsp;- or do they work? They are there, indeed, but what all of them do is that they&amp;nbsp;obfuscate data with a secret algorithm hard coded in software that knows how to provide the data to the user in a limited set of scenarios, but would not allow other scenarios. This sounds hopeful until you realize that there is no way to really protect the algorithm from a&amp;nbsp;curious user - the computer has to execute it and whatever the computer executes, the user can read - it's his machine after all and&amp;nbsp;he only needs to invest some time (a few months) into reading a book that teaches the assembly language of his computer - he just needs to be literate and fairly intelligent. This problem of being able to discover the obfuscation algorithm may not seem a high risk to some, but the situation is even worse: you only need &lt;STRONG&gt;one&lt;/STRONG&gt; dedicated person to figure the algorithm out and to write a program that reverses the obfuscation, and then he can distribute that software for the use of all the other people that want unrestricted access to the data - and this time they only need to know how to download a piece of software of the Internet.&lt;/P&gt;
&lt;P&gt;If after reading this&amp;nbsp;one still has a shadow of a doubt, it must be related to the use of encryption. Encryption is supposed to be the panacea&amp;nbsp;to any security problem: you want data protection - encrypt it; you want double protection - encrypt it twice. The truth is that encryption will only help if properly used and in the case of copy protection, its use&amp;nbsp;will degenerate into obfuscation, as I have already discussed in &lt;A class="" href="http://blogs.msdn.com/lcris/archive/2006/11/30/who-needs-encryption.aspx" mce_href="http://blogs.msdn.com/lcris/archive/2006/11/30/who-needs-encryption.aspx"&gt;this post&lt;/A&gt;. Some copy protection schemes use encryption to some extent, but the problem of securing the encryption key is where designers have to rely on obfuscation and that is what the&amp;nbsp;attackers will go after. But actually, in most cases, the implementation of the encryption algorithm or of the entire application is flawed in such a way that data can be accessed without even worrying about getting the encryption keys.&lt;/P&gt;
&lt;P&gt;The difference between security and copy protection can&amp;nbsp;be likened to&amp;nbsp;the difference between encryption and obfuscation. With encryption (and other security schemes), the data&amp;nbsp;has some strong&amp;nbsp;guarantee of being&amp;nbsp;secure even if the algorithm is made public, as long as the encryption key is kept secret; in fact, all&amp;nbsp;successful commercial algorithms&amp;nbsp;have&amp;nbsp;had their details made available to researchers before and after being adopted.&amp;nbsp;With obfuscation, the data is safe as long as the algorithm is kept a secret, but as soon as the algorithm is discovered, the entire scheme fails - and there is no way to keep the algorithm secret against a smart attacker that has access to the code that executes the algorithm and to the machine on which the algorithm executes.&lt;/P&gt;
&lt;P&gt;Another way of illustrating the difference is via the following generic scenarios. In a security scenario, Alice wants to grant Bob access to some data and does not want Charles to have access to that data. In a copy protection scenario, Alice needs to grant Bob access to some data but wants to prevent him from communicating that data to Charles. Same characters, but very different story.&lt;/P&gt;
&lt;P&gt;Final comparison - copy protection is about preventing the dissemination of some information, while security is about preventing access to it in the first place.&lt;/P&gt;
&lt;P&gt;By this time, it should be clear that copy protection schemes are not offering any security, because they cannot provide any reasonable guarantees around their policy enforcement. But are&amp;nbsp;copy protection schemes&amp;nbsp;really useless? From a security point of view,&amp;nbsp;my answer is yes. From a practical point of view,&amp;nbsp;my answer is that&amp;nbsp;a copy protection scheme&amp;nbsp;may serve some purpose if the product using it has limited use and its users are either not interested, or they are not capable of breaking the scheme, or they don't have the financial capabilities of hiring someone who can. There is some inherent irony here: the more successful&amp;nbsp;a product will become, the less effective its copy protection scheme will be, as it will attract more attention.&lt;/P&gt;
&lt;P&gt;The best bet is to work around the need for a copy protection scheme. One way to do this is to&amp;nbsp;have a software application be reliant on an online&amp;nbsp;service requiring some sort of validation from&amp;nbsp;its company's servers. For example, an online RPG requires the use of game servers and even if the credentials would be shared, only one person can play at any time. Another way would be to have the software only run on dedicated devices, whose use is limited - see video game consoles - there is still the risk of copying the media, but if the media used is expensive to produce (game cartridges), then this risk is alleviated somewhat.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5112494" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server+-+security/default.aspx">SQL Server - security</category><category domain="http://blogs.msdn.com/lcris/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/lcris/archive/tags/computer+security/default.aspx">computer security</category></item></channel></rss>