<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>Tales from the Crypto : EFS</title><link>http://msmvps.com/blogs/alunj/archive/tags/EFS/default.aspx</link><description>Tags: EFS</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Sometimes It Seems Like Unix(*) Needs to Learn from Windows</title><link>http://msmvps.com/blogs/alunj/archive/2009/09/26/1727475.aspx</link><pubDate>Sun, 27 Sep 2009 03:22:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1727475</guid><dc:creator>Alun Jones</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1727475</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1727475</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2009/09/26/1727475.aspx#comments</comments><description>&lt;p&gt;(*) By &amp;ldquo;Unix&amp;rdquo;, I mean Linux, Unix, AIX, OS/X, and similar flavours.&lt;/p&gt;
&lt;p&gt;Way back when, about twenty or so years ago, I was a Unix admin, and a Unix developer. I had to be both, because I was the only person in the company who could spell Unix.&lt;/p&gt;
&lt;p&gt;My favourite game was to go along to presentations for Microsoft Windows &amp;lsquo;new features&amp;rsquo; and say &amp;ldquo;Oh, but hasn&amp;rsquo;t Unix had that for the last twenty years?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Sure enough, there were countless things that Windows users and developers were just discovering (TCP/IP, shared libraries, multiple sessions on the same computer) that had been in Unix for some time. Linux was yet to make a mention, but as I&amp;rsquo;ve moved firmly into the Windows world, and left Unix behind, I&amp;rsquo;ve pretty much assumed that technologically speaking, if Windows has it, Unix and the like must also have the same functionality.&lt;/p&gt;
&lt;p&gt;As I re-engage with Unix and Linux developers and IT professionals in recent months, though, I can see that there are some areas &amp;ndash; particularly in security - where Windows is far ahead of the *x operating systems. Here&amp;rsquo;s a few:&lt;/p&gt;
&lt;dl&gt;&lt;dt&gt;Where&amp;rsquo;s my EFS?&lt;/dt&gt;&lt;dd&gt;EFS, the Encrypting File System, is one of Windows&amp;rsquo; best-kept secrets. It&amp;rsquo;s not really a secret, of course, but it acts like one &amp;ndash; there are so few people willing to use it, and mostly because they&amp;rsquo;re scared of or don&amp;rsquo;t understand it.&lt;/dd&gt;&lt;dd&gt;EFS allows users (under administrative control and with appropriate recovery measures in place) to choose files to encrypt, and to declare which other users can access the encrypted files.&lt;/dd&gt;&lt;dd&gt;EFS-encrypted files are encrypted on disk, and the keys cannot be broken simply by mounting an offline attack, because the key for each file is encrypted with users&amp;rsquo; public keys, and the private keys are held securely in the users&amp;rsquo; certificate store.&lt;/dd&gt;&lt;dd&gt;What does *x have in response? Whole disk encryption by third-party products (OK, Windows has Bitlocker and any number of third-party products). EFS protects individual files, and is far more fine-grained than the &amp;lsquo;all or nothing&amp;rsquo; access of WDE (or FDE, Full Disk Encryption, if you prefer).&lt;/dd&gt;&lt;dt&gt;Single Certificate Store&lt;/dt&gt;&lt;dd&gt;This isn&amp;rsquo;t really a &amp;ldquo;single&amp;rdquo; store so much as a predictable location for the certificate store. If you want to read a user&amp;rsquo;s certificates and keys, you know where to find them (although you generally only have access if you &lt;span style="text-decoration:underline;"&gt;are&lt;/span&gt; the user in question. Private keys from the certificate store are protected using the DPAPI, appropriately protecting them (apart from some key recovery scenarios, you have to log in using the password associated with the keys).&lt;/dd&gt;&lt;dd&gt;Similarly, certificates and keys belonging to the system and its service accounts are also in predictable locations.&lt;/dd&gt;&lt;dd&gt;This makes life easy for tools that need to scan for certificates due to expire.&lt;/dd&gt;&lt;dd&gt;Where are certificates and keys stored in *x? All over the place. Generally in &amp;ldquo;PEM&amp;rdquo; files, usually (but not always) in the same directory in which the application that installs them is.&lt;/dd&gt;&lt;dd&gt;How are these private keys protected in *x? There&amp;rsquo;s sometimes a password to open up the private key from the PEM file, and usually the PEM file has a restrictive access mask on it. [Read further for more problems with this]&lt;/dd&gt;&lt;dt&gt;Single SSL Library&lt;/dt&gt;&lt;dd&gt;It&amp;rsquo;s not uncommon to see several instances of OpenSSL installed on any particular system, whether it&amp;rsquo;s *x or Windows, if the system runs applications that use OpenSSL.&lt;/dd&gt;&lt;dd&gt;Windows developers, of course, can simply use the SSL API built in to Windows (CryptoAPI, CAPI and SChannel), and not have to worry about shipping an SSL library with their application, or keeping up with new versions as they come out, or tracking down customers and notifying them of updates to address security flaws (such as the Debian Linux key generation flaw I posted about a while ago).&lt;/dd&gt;&lt;dt&gt;Single SSL Configuration&lt;/dt&gt;&lt;dd&gt;If I want to disable SSL v2, or ciphers with fewer than 128 bits, on Windows I can change a few registry settings and know that I&amp;rsquo;ve fixed every application that uses SChannel. I can even do that remotely, with remote registry editing from a script or group policy tattooing the registry.&lt;/dd&gt;&lt;dd&gt;To do the same for OpenSSL, it seems that I have to find every application that uses OpenSSL and change the configuration files there.&amp;nbsp; &lt;/dd&gt;&lt;dt&gt;Data Protection API and configuration file protection&lt;/dt&gt;&lt;dd&gt;This is the one that really started me on this article.&lt;/dd&gt;&lt;dd&gt;How do you store a password in a configuration file?&lt;/dd&gt;&lt;dd&gt;Yes, the &amp;lsquo;right&amp;rsquo; security answer is &amp;ldquo;you don&amp;rsquo;t&amp;rdquo;, but that&amp;rsquo;s naive. The fact is that there are many instances wherein you have to store a password &amp;ndash; to access and authenticate to a remote application, or (if you&amp;rsquo;re using OpenSSL) to open a password-protected PEM or PFX file in order to read out the private key.&lt;/dd&gt;&lt;dd&gt;On Windows, the Patterns and Practices team have documented how to do this &amp;ndash; basically, you use the DPAPI to encrypt the password into the config file, and again to decrypt it back out &amp;ndash; and your DPAPI keys are encrypted by your master key, which is derived from your password. The end result is that you can&amp;rsquo;t get those DPAPI keys without the password.&lt;/dd&gt;&lt;dd&gt;What do the *x platforms have?&lt;/dd&gt;&lt;dd&gt;&amp;rdquo;Put the password in plain text, and protect it with a restrictive access mask&amp;rdquo;, is what I&amp;rsquo;m told. And in a search, I couldn&amp;rsquo;t find anything better being recommended. OK, one person recommended encoding the password with base64, but that&amp;rsquo;s hardly a security measure.&lt;/dd&gt;&lt;dd&gt;Jesper brought up the excellent question of &amp;ldquo;how is it different?&amp;rdquo; &amp;ndash; in the *x system, the password is marked as only being accessible to the correct user. I was about to answer him when Steve F spoke up for me, and noted that in the DPAPI case, you have to read the file, and then an API has to be called to decrypt the password; in the *x case, you simply have to read the file. There are many many more exploits that allow the reading of a file under privileged rights than there are exploits that allow the execution of code.&lt;/dd&gt;&lt;dt&gt;Patch Management and Group Policy&lt;/dt&gt;&lt;dd&gt;Microsoft has done a really good job of implementing enterprise-level management features into their operating systems, from Group Policy and WMI to WSUS and other update management tools.&lt;/dd&gt;&lt;dd&gt;The *x systems I&amp;rsquo;ve seen seem to be built from the perspective that each system has its own attendant administrator, who is only too happy to manually deploy patches or tweak settings in line with some policy on a scrap of paper or post-it.&lt;/dd&gt;&lt;/dl&gt;
&lt;p&gt;Maybe I&amp;rsquo;m missing some huge advances, and maybe some of these issues are resolved with a third-party tool &amp;ndash; but then, maybe that&amp;rsquo;s part of the problem too. All of the above are a part of the operating system in Windows, and can be relied on to exist by developers, and their use by applications can be expected by IT professionals.&lt;/p&gt;
&lt;p&gt;[Disclaimer: Yes, I know there are still areas where Microsoft needs to learn from Unix and Linux, and perhaps it&amp;rsquo;d be good if you&amp;rsquo;d educate me on those, too. This isn&amp;rsquo;t a &amp;ldquo;Windows is better than *X&amp;rdquo; debate, it&amp;rsquo;s a &amp;ldquo;hey, even if you think *X is better than Windows, here are some areas *X needs improving in&amp;rdquo;.]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; There have been some excellent comments posted overnight in response to this article, and as I had hoped, I am mostly still &amp;#39;in the dark&amp;#39; about what Linux and Unix-like systems offers. I&amp;#39;ll be looking at these as I have time, and responding when I can. For now, just let me say that I am impressed to see so much technical content in the responses, and so little of the &amp;quot;fanboy&amp;quot; behaviour that often characterises these discussions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1727475" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Programmer+Hubris/default.aspx">Programmer Hubris</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/What+my+wife+knows/default.aspx">What my wife knows</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/EFS/default.aspx">EFS</category></item><item><title>In Defence of the Self-Signed Certificate</title><link>http://msmvps.com/blogs/alunj/archive/2008/05/10/1618962.aspx</link><pubDate>Sat, 10 May 2008 17:49:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1618962</guid><dc:creator>Alun Jones</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1618962</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1618962</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2008/05/10/1618962.aspx#comments</comments><description>&lt;p&gt;Recently I discussed using EFS as a simple, yet reliable, form of file encryption. Among the doubts raised was the following from an &lt;a href="http://www.windowsecurity.com/articles/Implementing-EFS-Windows-Server-2003-Domain.html"&gt;article by fellow MVP Deb Shinder&lt;/a&gt; on EFS:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;EFS generates a self-signed certificate. However, there are problems inherent in using self-signed certificates:  &lt;ul&gt; &lt;li&gt;Unlike a certificate issued by a trusted third party (CA), a self-signed certificate signifies only self-trust. It’s sort of like relying on an ID card created by its bearer, rather than a government-issued card. Since encrypted files aren’t shared with anyone else, this isn’t really as much of a problem as it might at first appear, but it’s not the only problem.  &lt;li&gt;If the self-signed certificate’s key becomes corrupted or gets deleted, the files that have been encrypted with it can’t be decrypted. The user can’t request a new certificate as he could do with a CA. &lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt; &lt;p&gt;Well, she&amp;#39;s right, but that only really gives a part of the picture, and it verges on out-and-out recommending that self-signed certificates are completely untrustworthy. Certainly that&amp;#39;s how self-signed certificates are often viewed.&lt;/p&gt; &lt;p&gt;Let&amp;#39;s take the second item first, shall we?&lt;/p&gt; &lt;p&gt;&amp;quot;Request a new certificate&amp;quot; isn&amp;#39;t quite as simple as all that. If the user has deleted, or corrupted, the private key, and didn&amp;#39;t save a copy, then requesting a new certificate will merely allow the user to encrypt new files, and won&amp;#39;t let them recover old files. [The exception is, of course, if you use something called &amp;quot;Key Recovery&amp;quot; at your certificate authority (CA) - but that&amp;#39;s effectively an automated &amp;quot;save a copy&amp;quot;.]&lt;/p&gt; &lt;p&gt;Even renewing a certificate changes its thumbprint, so to decrypt your old EFS-encrypted files, you should keep your old EFS certificates and private keys around, or use CIPHER to re-encrypt with current certificates.&lt;/p&gt; &lt;p&gt;So, the second point is dependent on whether the CA has set up Key Recovery - this isn&amp;#39;t a problem if you make a copy of your certificate and private key, onto removable storage. And keep it very carefully stored away.&lt;/p&gt; &lt;p&gt;As to the first point - you (or rather, your computer) already trust dozens of self-signed certificates. Without them, Windows Update would not work, nor would many of the secured web sites that you use on a regular basis.&lt;/p&gt; &lt;p&gt;Whuh?&lt;/p&gt; &lt;p&gt;&lt;a href="http://msmvps.com/blogs/alunj/WindowsLiveWriter/InDefenceoftheSelfSignedCertificate_8C22/image_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="455" alt="certmgr shows that all Trusted Root Certificates are self-signed." src="http://msmvps.com/blogs/alunj/WindowsLiveWriter/InDefenceoftheSelfSignedCertificate_8C22/image_thumb.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Hey, look - they&amp;#39;ve all got the same thing in &amp;quot;Issued To&amp;quot; as they have in &amp;quot;Issued By&amp;quot;!&lt;/p&gt; &lt;p&gt;Yes, that&amp;#39;s right - every single &amp;quot;Trusted Root&amp;quot; certificate is self-signed!&lt;/p&gt; &lt;p&gt;If you&amp;#39;re new to PKI and cryptography, that&amp;#39;s going to seem weird - but a moment&amp;#39;s thought should set you at rest.&lt;/p&gt; &lt;p&gt;Every certificate must be signed. There must be a &amp;quot;first certificate&amp;quot; in any chain of signed certificates, and if that &amp;quot;first certificate&amp;quot; is signed by anyone other than itself, then it&amp;#39;s not the first certificate. QED.&lt;/p&gt; &lt;p&gt;The reason we trust any non-root certificate is that we trust the issuer to choose to sign only those certificates whose identity can be validated according to their policy.&lt;/p&gt; &lt;p&gt;So, if we can&amp;#39;t trust these trusted roots because of who they&amp;#39;re signed by, why should we trust them?&lt;/p&gt; &lt;p&gt;The reason we trust self-signed certificates is that we have a reason to trust them - and that reason is outside of the certificate and its signature. The majority (perhaps all) of the certificates in your Trusted Root Certificate Store come from Microsoft - they didn&amp;#39;t originate there, but they were distributed by Microsoft along with the operating system, and updates to the operating system.&lt;/p&gt; &lt;p&gt;You trusted the operating system&amp;#39;s original install disks implicitly, and that trust is where the trust for the Trusted Root certificates is rooted. That&amp;#39;s a trust outside of the certificate chains themselves.&lt;/p&gt; &lt;p&gt;So, based on that logic, you can trust the self-signed certificates that EFS issues in the absence of a CA, only if there is something outside of the certificate itself that you trust.&lt;/p&gt; &lt;p&gt;What could that be?&lt;/p&gt; &lt;p&gt;For me, it&amp;#39;s simple - I trust the operating system to generate the certificate, and I trust my operational processes that keep the private key associated with the EFS certificate secure.&lt;/p&gt; &lt;p&gt;There are other reasons to be concerned about using the self-signed EFS certificates that are generated in the absence of a CA, though, and I&amp;#39;ll address those in the next post on this topic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1618962" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Why+is+PKI+so+hard_3F00_/default.aspx">Why is PKI so hard?</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/EFS/default.aspx">EFS</category></item></channel></rss>