<?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>HD DVD / Randomness... : VSTO</title><link>http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx</link><description>Tags: VSTO</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Back to VBA</title><link>http://blogs.msdn.com/ptorr/archive/2005/01/20/357021.aspx</link><pubDate>Thu, 20 Jan 2005 14:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:357021</guid><dc:creator>ptorr</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/357021.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=357021</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=357021</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;Today I needed to write a fairly simple piece of code to manipulate some Excel documents, and I chose to do it in VBA. That might sound like heresy for someone who used to work on Visual Studio Tools for Office, but since I switched teams I feel no obligation to use that stuff any more ;-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Just kidding, but I chose to use VBA for a few reasons:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;My main machine has the Whidbey CLR but only the Everett Visual Studio, which makes debugging a pain&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;I wanted to deploy this to a small set of users without worrying about them having the CLR or updating policy correctly (yes, the security guy didn't want to worry about security)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;I was hacking this code as I went (ie, there was no design!) so in order to ease development I wanted to take advantage of Edit and Continue, "unfrozen host" debugging, etc.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;It was a quick-and-dirty solution and I didn't want to spend a lot of time messing around with a "heavy-weight" tool like VSTO&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;I'm actually pleased to say that whilst the first two reasons (infrastructure / logistics) were valid, the second two (developer productivity) weren't -- I would have been much better off using VSTO.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Using the VBA editor is painful. The IntelliSense is primitive, the mouse scroll wheel doesn't work, the forms designer is sooooo 20th century, the Forms&lt;span style="vertical-align:super;"&gt;&lt;span style="font-size:smaller;"&gt;3&lt;/span&gt;&lt;/span&gt; controls don't make much sense, and so on. I had to deal with silly VB6-isms like the &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Set&lt;/span&gt; statement and the lack of a &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Return&lt;/span&gt; statement. When I was debugging, I never actually got to use EnC -- all the edits I needed to make ended up being "rude" edits that forced a project re-set. And my code turned out to have very limited interaction with the Excel OM itself, so being able to access the "unfrozen host" wasn't a killer feature.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So all in all a big thumbs up for using VSTO; you just can't beat all the cool productivity features in Visual Studio :-). Deployment is an issue with VSTO, so it's good to know that VBA is still around for the times when you need it.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;One day I'll re-write the tool "properly" in managed code and take advantage of all the cool new Whidbey features... in my copious spare time!&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=357021" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category></item><item><title>Dr. Strongname, or: How I Learned to Stop Worrying and Love the URL</title><link>http://blogs.msdn.com/ptorr/archive/2004/11/06/253442.aspx</link><pubDate>Sun, 07 Nov 2004 06:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:253442</guid><dc:creator>ptorr</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/253442.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=253442</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=253442</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;One of the problems with the Trustworthy Computing initiative is that many of our products have become harder to use as a result, either due to configuration changes or documentation changes. For example, Windows Server 2003 now ships with pretty much everything turned off by default, but customers that just want to "plug it in and go" get frustrated because now they have to configure everything that used to just be turned on automatically.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;For VSTO, the problem is more to do with the way we document / blog about / evangelise the product to customers. Whereas in the past the documentation might have told customers the easiest way to accomplish something and left the more secure method to a side note or appendix, nowadays we focus on the &lt;a style="text-decoration:none;" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconCodeSecuritySigningInComponents.asp"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;more secure methods&lt;/span&gt;&lt;/a&gt; first and this can also be frustrating for customers who are willing to make the usability / security trade-off in favour of usability.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So, customers hear about VSTO, they hear about its strict security requirements, and they hear about this thing called "strong naming" and conclude that they need to strongname their code in order for it to work. It doesn't help that every time someone asks a question about VSTO security, we usually say "Well, you &lt;span style="font-weight:bold;"&gt;could&lt;/span&gt; just trust the folder, but that's not really recommended - you &lt;span style="font-weight:bold;"&gt;should&lt;/span&gt; use a strongname to be more secure!" But that's pretty much the responsibility we have with Trustworthy Computing; we need to tell people the "better" way of doing things rather than the "easier" way.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Anyway, the problem with strongnames is that they weren't really designed to be used as security principals -- they were designed to uniquely identify assemblies and to detect tampering or spoofing attacks against assemblies. In order to ensure that two assemblies with the same name get different identities, strongnames use the same kind of public-key digital signature technology that Authenticode signing does. This means that, &lt;span style="font-style:italic;"&gt;cryptographically speaking&lt;/span&gt;, the kinds of guarantees that the system can make about an assembly are the same for both strongnames and Authenticode signatures. Couple this with the fact that anyone can generate a strongname keypair for free with &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;sn -k mykey.snk&lt;/span&gt; (versus setting up a certificate server or dropping cold hard cash to Verisign or another 3rd party CA) you can see why strongnames are a popular way to trust assemblies.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But strongnames are first and foremost are about guaranteeing the identity of an assembly, and one of the properties of an assembly's identity is its version number. When one assembly &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; is dependent on a strongnamed assembly &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;, the information baked into &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget&lt;/span&gt;'s manifest includes the version number of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper&lt;/span&gt; as part of the reference information. If, at runtime, the CLR cannot find the &lt;span style="font-weight:bold;"&gt;exact&lt;/span&gt; version of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper&lt;/span&gt; that &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget&lt;/span&gt; was originally compiled against, it will fail to load the assembly and probably cause the application to die horribly as a result. (Publishers can supply &lt;a style="text-decoration:none;" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfBindingRedirect.asp"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;version-redirection information&lt;/span&gt;&lt;/a&gt; with their assemblies to modify this behaviour, but that's another complication I don't want to get into right now).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So let's say that you build an Excel-based VSTO solution with &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt; version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt; and &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt;, you put them both on a share, and people start using them. Someone reports a bug in the application, and you track it down to a problem in &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;, which you re-build as &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt; version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.1.0.0&lt;/span&gt; and upload it to the share, over-writing the old version. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But now you get calls from people saying that the solution is broken, so you run the app in the debugger and determine that it is because &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; is looking for version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt; of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;, but only version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.1.0.0&lt;/span&gt; is available. Since you probably didn't know about &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;&amp;lt;bindingRedirect&amp;gt;&lt;/span&gt; and/or you don't have time to investigate further, you take the easy way out -- just change the version of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; back to &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt;, re-build it, and ship out the "new" version of the assembly to the share again. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Ah-ha, but now something else goes wrong. You get calls from a different set of users who claim that you haven't fixed the bug at all -- it is still happening on their machines. You double-check to make sure that the "right" version of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt; is on the share, and sure enough it is. You fire up the VSTO solution on your desktop and verify that, sure enough, the fixed version of the assembly is loading. Just to be sure, you make some additional changes to the code (like, say, putting &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;MessageBox.Show("This is the fixed version!")&lt;/span&gt; in the constructor), re-build it, copy it to the share, and run the solution again.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Hmmm, that's weird -- the message box never popped up. You do a bit more poking around and add the following line to the assembly:&lt;br clear="all"&gt;&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P" style="margin-top:12pt;margin-top:0pt;"&gt;
            &lt;span&gt;&amp;nbsp;&amp;nbsp;MessageBox&lt;span style="color:#008080;"&gt;.&lt;/span&gt;Show&lt;span style="color:#008080;"&gt;(&lt;/span&gt;&lt;span style="color:#800000;"&gt;this&lt;/span&gt;&lt;span style="color:#008080;"&gt;.&lt;/span&gt;GetType&lt;span style="color:#008080;"&gt;().&lt;/span&gt;Assembly&lt;span style="color:#008080;"&gt;.&lt;/span&gt;Location&lt;span style="color:#008080;"&gt;);&lt;/span&gt;&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;span&gt;Now when you run the solution, you see that the assembly is running from some seemingly random location in your profile folder -- not from the network share where you would expect it to be loading from:&lt;br clear="all"&gt;&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P" style="margin-top:12pt;margin-top:0pt;"&gt;
            &lt;span&gt;c:\documents and settings\joe_user\local settings\application data\assembly\dl2\a7dn830f.ad2\aofhwldc.vc0\72d679a8\8368c70e_93af78bc\helper.dll&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;span&gt;What's happening? Well, when you open the project, the CLR loads &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Budget.dll&lt;/span&gt; and sooner or later it tries to use a type defined in &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;. Fusion is asked to load the assembly, and since it has a strong name with the version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt;, Fusion looks in the local download cache to see if it already has that assembly -- why download it again over a slow network link when you can load it right off the local disk (and Windows may already have it mapped into memory, too)? Of course Fusion sees that it &lt;span style="font-weight:bold;"&gt;does&lt;/span&gt; already have a local copy of version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt; of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;, so it loads that without going out over the network to download the other copy -- after all, you strongnamed the assembly so it's &lt;span style="font-weight:bold;"&gt;guaranteed&lt;/span&gt; to be the right one. If it had been changed, the digital signature wouldn't match.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But of course it's the "wrong" copy of version &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;1.0.0.0&lt;/span&gt;, because you made changes to it but didn't update the version number. &lt;span style="font-style:italic;"&gt;You're lying to Fusion about the version of an assembly, and then you're wondering why the system isn't working as expected&lt;/span&gt;. (As an aside, the first set of users who complained about getting assembly load failures due to the wrong version number would have been the ones who had never previously downloaded the buggy version of &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Helper.dll&lt;/span&gt;, so Fusion didn't have a copy in the cache).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So now you're really in a bind:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;You have to use strongnames, because you need to be secure&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;But if you use strongnames, you have to keep updating the version numbers to play by Fusion's rules&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;And if you update the version numbers, your applications break&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;But the only way to bypass Fusion's cache lookup is not to use strongnames&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:italic;font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;span style="font-style:italic;"&gt;And you have to use strongnames!&lt;/span&gt;
        &lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;font-style:italic;font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;Argh! &lt;span style="font-weight:bold;font-style:italic;"&gt;What's a poor developer to do?!?&lt;/span&gt;&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Well, take a step back; as I noted in a &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2004/10/29/249366.aspx"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;recent post&lt;/span&gt;&lt;/a&gt;, security is all about managing risk. If your efforts to be secure cause more problems than they solve, it may be time to re-think your strategy.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;We recommend that users rely on some form of cryptographic evidence such as a strongname or Authenticode signature because it provides a high degree of assurance that the assembly you are running really is the one you think you are running -- even if a malicious user can gain write-access to the location of your assembly, they can't modify its contents or replace it with an entirely different assembly without breaking the signature and thereby causing the CLR to reject any requests to load the assembly. Only if the malicious user has access to your private key (ooops!) &lt;span style="font-weight:bold;"&gt;and&lt;/span&gt; they have write access to the assembly's location can they cause damage in this scenario.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But if you have good controls over access to the assemblies' location (ie, you ensure that only trusted parties can upload or modify files on the server) then you may be comfortable with just using URL-based evidence for your VSTO solutions. Besides, in a typical scenario there are likely to be other things on that server that a bad guy could take advantage of if they gained write-access to it, so you're really no less secure than you were before by relying only on URLs. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So, if you're running a controlled environment inside the firewall, maybe you can drop the strongnames (and the versioning issues that come with them) and just rely on publishing your assemblies to a trusted server location. For information on how to set up policy based on URLs, you can consult &lt;a style="text-decoration:none;" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskgrantingpermissionstofoldersassemblies.asp"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;the VSTO documentation&lt;/span&gt;&lt;/a&gt;. &lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=253442" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category></item><item><title>Show me the money!</title><link>http://blogs.msdn.com/ptorr/archive/2004/10/29/249366.aspx</link><pubDate>Fri, 29 Oct 2004 08:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:249366</guid><dc:creator>ptorr</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/249366.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=249366</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=249366</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;A member of the VSTO team just came to my office and asked, "Is it bad to trust all Office documents on the Local Intranet?"&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;That's a good question, and after answering it for him I thought it was also worth blogging about (plus I'm hanging around the office waiting until I have to leave to take a friend to the airport ;-) ).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;From a pure technical standpoint, yes it is bad. You are increasing the risk to your systems and your network by allowing operations that were not previously allowed. If there is ever a vulnerability discovered in VSTO that allows a malicious Office document to take unauthorised actions on a user's PC then being susceptible to documents hosted anywhere on the local network (versus just documents on the local machine) is A Bad Thing.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But the world is not that black-and-white.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;And just as an aside, the "absolute" risk involved in &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2003/09/25/56217.aspx"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;trusting Office documents to run VSTO solutions&lt;/span&gt;&lt;/a&gt; is actually fairly low; without an already-trusted assembly to somehow exploit through malformed document content, there isn't much a malicious document could do save spin up the runtime and create an AppDomain with no user-supplied code inside it, or possibly take advantage of some parsing errors in the VSTO loader or the CLR loader (both of which, fingers crossed, are robust against such attacks). So what we're talking about here is actually a fairly low-risk activity to begin with.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But back to the story at hand.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The purpose of security is not to &lt;span style="font-weight:bold;"&gt;avoid&lt;/span&gt; risk, but to &lt;span style="font-weight:bold;"&gt;manage&lt;/span&gt; it. A computer that is unplugged, sealed in concrete and glass, and then dumped at the bottom of the ocean has very little risk of being infiltrated by a hacker, but it also has very little value to the owner. We want to enjoy the benefits of putting the computer on a desk, turning it on, and jacking it in to the internet, but at the same time we want to do what we can to avoid attacks whilst not unreasonably cramping our style.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;More importantly, &lt;span style="font-weight:bold;font-style:italic;"&gt;if I expect to make more money with a computer turned on and plugged into the internet than I expect to lose due to malicious attacks, common sense says that I should plug it in&lt;/span&gt;. This is the way business works.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So, is it a bad idea to trust all the documents on the local intranet? I can't answer that for any given person, because their specific scenarios and their attitudes towards risk and their cost structures and so many other things can come into play, but I can help someone make a decision that is right for them.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The real question though is &lt;span style="font-style:italic;"&gt;"Why would someone want to trust &lt;/span&gt;&lt;span style="font-weight:bold;font-style:italic;"&gt;the entire network&lt;/span&gt;&lt;span style="font-style:italic;"&gt; -- every single machine behind the firewall, possibly including random laptops from vendors, contractors, customers, etc. -- instead of just a small set of well-managed and secure servers?"&lt;/span&gt;&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;It comes down to cost. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Let's say that you decide to only trust documents from the server &lt;a style="text-decoration:none;" href="http://officedocs/"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://officedocs/&lt;/span&gt;&lt;/a&gt; and you roll out policy to your organisation for that purpose. Things are going well, but after a few weeks everyone realises how cool your VSTO solutions are and they want to put them up on &lt;a style="text-decoration:none;" href="http://anotherserver/"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://anotherserver/&lt;/span&gt;&lt;/a&gt;. So you update policy to include the new server, and roll that out. A week later it's &lt;a style="text-decoration:none;" href="http://finance/"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://finance/&lt;/span&gt;&lt;/a&gt;, then it's &lt;a style="text-decoration:none;" href="http://marketing/public/docs/"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://marketing/public/docs/&lt;/span&gt;&lt;/a&gt;, then it's &lt;a style="text-decoration:none;" href="\\randomserver\"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;\\randomserver\&lt;/span&gt;&lt;/a&gt; and pretty soon you're getting a new request every week. How much is this costing you (and your business)?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;Lost productivity from end users who are unable to do their work until the servers are trusted&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;Lost time due to management approval process to get a formal request through&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;Time spent evaluating the request, updating policy, and testing it&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;Time taken to actually deploy the policy and get all users (including remote / offline users) updated&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;The risk of making a mistake with the new policy either opening up a security hole or breaking existing applications&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:13.5pt;"&gt;&lt;/span&gt;&lt;/span&gt;And so on&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;When you look at the potential costs involved trusting documents on a server-by-server basis in a large organisation, it might start to approach (or even exceed) the potential costs involved in their being a successful attack launched from some rogue laptop.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;For example, let's say you estimate the cost of adding each additional server to policy to be $1,000 (an imaginary figure, of course -- it would probably be at least an order of magnitude higher in real life!). And you estimate (with 80% probability) that over the next few years there are going to be about 10 sites that you expect to want to host documents. So the expected cost of this approach is:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;$1,000 x 10 x 80% = $8,000&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Now, let's also assume that you estimate the cost of a successful VSTO document-based exploit document is $100,000 (again, a completely arbitrary number) but that there is only a 1% chance of it happening inside the intranet. This gives an expected cost of trusting the whole intranet as:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;$100,000 x 1% = $1,000&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Which would you go for? &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Even if you factor in a "risk multiplier" of 5 (ie, you're risk averse and want to up the numbers a bit "just in case") it's still $3,000 "cheaper" to trust the entire intranet than it is to deal with each server on a case-by-case basis. Obviously these numbers are completely made up and you'd have to do the math on your own for your particular organisation, but the point is that just because something increases risk, it doesn't necessarily make it a bad thing.&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=249366" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category></item><item><title>It's OK to tell people what they already know</title><link>http://blogs.msdn.com/ptorr/archive/2004/09/03/225129.aspx</link><pubDate>Fri, 03 Sep 2004 14:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:225129</guid><dc:creator>ptorr</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/225129.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=225129</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=225129</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;I like it when people send me e-mail with security questions. I like it because it implies two things:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;1)&lt;span style="padding-left:9pt;"&gt;&lt;/span&gt; The person is thinking about the security implications of their code, and has recognised a possible problem; and&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;2)&lt;span style="padding-left:9pt;"&gt;&lt;/span&gt; The person realises that they need to seek help to get the right answer, rather than just saying "Oh we'll use &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;$MAGIC_SECURITY_FEATURE$&lt;/span&gt; here and it won't be a problem."&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Anyway, recently I got the following (paraphrased) question from someone:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;In &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/michael_howard/"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;Michael Howard’s&lt;/span&gt;&lt;/a&gt; book &lt;a style="text-decoration:none;" href="http://www.microsoft.com/MSPress/books/5957.asp"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;Writing Secure Code&lt;/span&gt;&lt;/a&gt; it says that you shouldn’t tell the attacker too much when you fail and gives the specific example of showing an exception stack trace to the user when there is a failure. When our application fails to load an assembly, it shows the user a dialog box with a stack trace in it to help the user track down the problem. I can see why this makes sense in debug mode, but is it a security problem in release modes? Aren't we giving away sensitive information by doing this?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Glad you asked! :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The specific advice in question applies when &lt;span style="font-weight:bold;"&gt;the attacker doesn't have direct access to the code&lt;/span&gt;. For example, in an ASP .NET application, the attacker is sitting across the world looking at their web browser and can't read the DLLs off your web server's hard disc. In this scenario, handing out information in a stack trace on an error page is bad because you might leak path names, source code, or other tidbits of information that the attacker can use to stage their attack. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Two other examples of this are a SQL Server application giving out detailed error information to an application running on a separate machine (or in a separate security context), or even a script on a web page talking to an installed ActiveX control and getting an error message back with too much information. In all these cases, you are giving the attacker access to information they couldn't get in any other way since they don't have direct access to the code on their machines.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But in the case of an application displaying an error dialog to the user, the "user" already has access complete access to the code (they're running it on their machine!) so they can already attach a debugger to it, disassembly it, poke it with a sharp stick, etc. if they really want to. No information is being leaked in this case (although you might not want to scare users with a full stack dump by default!).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;A while ago, another person asked me a different question:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;We're building an Excel solution with &lt;a style="text-decoration:none;" href="http://blogs.msdn.com/vsto2/archive/2004/06/30/170315.aspx"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;VSTO 2005&lt;/span&gt;&lt;/a&gt; and using the new &lt;a style="text-decoration:none;" href="http://blogs.msdn.com/vsto2/archive/2004/06/30/170315.aspx"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;Task Pane functionality&lt;/span&gt;&lt;/a&gt; &lt;span style="font-style:italic;"&gt;[&lt;/span&gt;&lt;span style="font-style:italic;"&gt;ed&lt;/span&gt;&lt;span style="font-style:italic;"&gt;: cool!]&lt;/span&gt;. Our solution talks to a secured web service to download sensitive information into the spreadsheet. We're worried about what happens when the user saves the spreadsheet -- should we blank the data out of the spreadsheet every time it is saved so that we don't "leak" sensitive information? We automatically refresh the data the next time the workbook is opened so legitimate users will still have access to it.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Glad you asked! :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;First thing to do -- as always -- is to consider the threats you are trying to mitigate. The threat which appears to be most salient here is one of information disclosure. For example:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          
            
              Alice
            
           creates a spreadsheet using the VSTO solution and uses it to download some sensitive information into a worksheet. She intends to e-mail the spreadsheet to her co-worker Bob, but accidentally e-mails it to a competitor with the same name. Obviously Competitor Bob doesn't have access to the sensitive information hosted by the web service, but now he can read the persisted data out of the spreadsheet and use it for his own nefarious purposes.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;In this case, the person realised that their solution was an "enabling technology" that could allow sensitive data to leak to unauthorised people, and they wanted to take some responsibility to help stop any potential security breaches. That's a great attitude to have, but in this case the suggested solution attempts to protect the user from themselves, and in the process throws the baby out with the bathwater so to speak. It's also very fragile.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Using code to blank out values on save is unreliable -- what if the code crashes during the &lt;span class="InlineCode-H" style="font-family:Lucida Console;"&gt;Save&lt;/span&gt; event handler and the code never completes its task, or if a bad COM Add-In crashes Excel and saves an auto-recovered version of the file with the data still in it? Additionally, whilst you may know to blank out cells A1 to C20 because that's where your code puts the data, you have no idea if the user has manually copy-and-pasted it to some other area of the workbook, so you can't guarantee you'll always blank out every cell that contains the sensitive data.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Even if you could technically perform this action, blanking out cells it may actually defeat the purpose of the solution. You have to ask yourself "Why are we building this solution on Excel?" One of the &lt;span style="font-weight:bold;"&gt;benefits&lt;/span&gt; of doing so is that you get local access to off-line data, and you can easily move it around. Is it an &lt;span style="font-weight:bold;"&gt;intended feature&lt;/span&gt; of the solution that people who are authorised to see the data can download it to a spreadsheet and forward it to people who are not authorised to see the data? What if two authorised people see different views of the data and they share a spreadsheet; what happens to the data in that case? Is it intended that User B can see User A's data (since it was cached in the spreadsheet), or are they supposed to re-run the queries and download their own data every time? (But remember that User B can always disable the code if they don't want the queries to auto-refresh and thus leave behind the original data)? If the desired functionality is that the data always auto-refreshes, how does Alice show Bob a snapshot of &lt;span style="font-weight:bold;"&gt;her&lt;/span&gt; data without having Bob physically come over to her desk and look at her monitor?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Really this one comes down to user education. Whenever the user opens / creates the spreadsheet, you could initially have the task pane show some descriptive text describing what the application did and require the user to click a "Download sensitive information" button before you contact the web service (this would also help prevent &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2004/09/03/225121.aspx"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;repurposing attacks&lt;/span&gt;&lt;/a&gt;). Now the user knows the spreadsheet contains sensitive information, and you have two possibilities:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;1)&lt;span style="padding-left:9pt;"&gt;&lt;/span&gt; If they are "good" people then they should be careful not to forward the document to the wrong person, just as they should be careful not to forward their &lt;a style="text-decoration:none;" href="http://www.microsoft.com/money/default.asp"&gt;&lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;Microsoft Money&lt;/span&gt;&lt;/a&gt; data file or their last Review document. Suggesting to the user that they can use IRM to protect the document might help here.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;2)&lt;span style="padding-left:9pt;"&gt;&lt;/span&gt; If the user is "bad" and intentionally wants to leak the data to other "bad" people, you can't stop them doing it anyway. They could just copy &amp;amp; paste the data, take a photo of the screen, print it out, etc. Depending on how determined the bad guy is, IRM may not be appropriate here because it is not strictly a security technology.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Moral of the story: Threat models are your friend :-)&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=225129" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category></item><item><title>Code Repurposing and Untrustworthy Data</title><link>http://blogs.msdn.com/ptorr/archive/2004/09/03/225121.aspx</link><pubDate>Fri, 03 Sep 2004 14:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:225121</guid><dc:creator>ptorr</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/225121.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=225121</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=225121</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;This is just a generic launching place for four other blog entries, since I seem to send them to people on a regular basis and sending one URL is easier than four :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p class="Heading3-P" style="margin-top:12pt;margin-bottom:3pt;page-break-after:avoid;"&gt;
        &lt;span class="Heading3-H"&gt;Code repurposing&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:9.75pt;"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2003/10/16/56270.aspx"&gt;
            &lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://weblogs.asp.net/ptorr/archive/2003/10/16/56270.aspx&lt;/span&gt;
          &lt;/a&gt;
        &lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:9.75pt;"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2003/10/21/56296.aspx"&gt;
            &lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://weblogs.asp.net/ptorr/archive/2003/10/21/56296.aspx&lt;/span&gt;
          &lt;/a&gt;
        &lt;/span&gt;
      &lt;/p&gt;
      &lt;p class="Heading3-P" style="margin-top:12pt;margin-bottom:3pt;page-break-after:avoid;"&gt;
        &lt;span class="Heading3-H"&gt;Untrustworthy data&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:9.75pt;"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2004/04/12/111342.aspx"&gt;
            &lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://weblogs.asp.net/ptorr/archive/2004/04/12/111342.aspx&lt;/span&gt;
          &lt;/a&gt;
        &lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-family:Symbol;font-style:normal;text-decoration:none;font-weight:normal;"&gt;·&lt;span style="padding-left:9.75pt;"&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;a style="text-decoration:none;" href="http://weblogs.asp.net/ptorr/archive/2004/04/13/112404.aspx"&gt;
            &lt;span class="Hyperlink-H" style="text-decoration:none underline;"&gt;http://weblogs.asp.net/ptorr/archive/2004/04/13/112404.aspx&lt;/span&gt;
          &lt;/a&gt;
        &lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=225121" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>When is the Local Intranet not the Local Intranet?</title><link>http://blogs.msdn.com/ptorr/archive/2004/07/16/184723.aspx</link><pubDate>Fri, 16 Jul 2004 10:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:184723</guid><dc:creator>ptorr</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/184723.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=184723</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=184723</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;When it's in another zone, of course.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;One of the recommendations we give for setting policy on VSTO projects is to sign your assembly (either with an Authenticode certificate or a strongname) and then trust that key only for a specific computer (eg, your deployment server) or for a specific Zone (typically My Computer or Local Intranet). So people go ahead and they do this, and sometimes it works and sometimes it doesn't. They scratch their head for a while, and then they e-mail me and ask what's up :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Almost always, the problem is that although the person thinks the computer is in the Local Intranet zone, IE has a different opinion on the matter for one of two reasons:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;1)&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;You have previously added the web site to the "Trusted Zone" for some particular reason&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;2)&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;You are using a dotted IP address (&lt;span style="font-family:Lucida Console;"&gt;\\192.168.1.1&lt;/span&gt;) or a FQDN (&lt;span style="font-family:Lucida Console;"&gt;\\computername.company.com&lt;/span&gt;) name instead of a NETBIOS name (&lt;span style="font-family:Lucida Console;"&gt;\\computername&lt;/span&gt;)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The first one fails for obvious reasons -- you moved the site from the Local Intranet Zone to the Trusted Sites Zone, and the CLR is simply obeying your command. Fixing it is as easy as moving the site back to Local Intranet (if that makes sense for you) or changing your policy to trust the key inside the Trusted Sites Zone instead.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The second one is a bit less obvious. Basically (and I'm by no means a network protocol expert, so feel free correct me if I get the details wrong) IE knows that NETBIOS names (names without dots in them) can't be routed across the internet, so if it sees a name without a dot it knows it is a local name. If IE sees a name with dots in it (whether numeric or DNS) then it assumes it is coming from across the internet, and so it falls into the Internet Zone. One tricky thing here is that since an IP address is really just four bytes, you can represent an IP address as a single 32-bit number such as &lt;span style="font-family:Lucida Console;"&gt;\\12345678&lt;/span&gt;, and this could indeed come from across the internet. So there is a special check to see if it is this kind of address in addition to the simple "does it have dots in it" check.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Fixing this is also quite easy; just add the computer's address to your Local Intranet Zone by going to &lt;span style="font-weight:bold;"&gt;Tools&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Internet Options&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Security&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Local Intranet Zone&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Sites&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Advanced&lt;/span&gt; and typing it in. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Note that the cause of this problem (but not the solution) is easily deducible by following my &lt;a href="http://weblogs.asp.net/ptorr/archive/2003/10/06/56250.aspx"&gt;previous debugging tip&lt;/a&gt; to find out how the CLR is resolving your policy rules. &lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=184723" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category></item><item><title>A useful regfile for VSTO</title><link>http://blogs.msdn.com/ptorr/archive/2004/07/16/184716.aspx</link><pubDate>Fri, 16 Jul 2004 10:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:184716</guid><dc:creator>ptorr</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/184716.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=184716</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=184716</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;Here's a quick post with a regfile you can use to help you test your VSTO projects.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Cut and paste the text below into a text file (be careful of line wrapping) and save it with a &lt;span style="font-weight:bold;"&gt;reg&lt;/span&gt; extension. Then open up &lt;span style="font-weight:bold;"&gt;regedit&lt;/span&gt; (as a member of the &lt;span style="font-weight:bold;"&gt;Administrators&lt;/span&gt; group) and select &lt;span style="font-weight:bold;"&gt;File&lt;/span&gt; -&amp;gt; &lt;span style="font-weight:bold;"&gt;Import...&lt;/span&gt; from the menu and navigate to the file you just saved (you could also just double-click on the &lt;span style="font-weight:bold;"&gt;reg&lt;/span&gt; file in Windows Explorer).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;This will give you two new context menu items on DLLs, EXEs, and Folders. The first one will add a URL membership condition to user-level policy to fully-trust the file (or folder), and the second one will remove that entry from policy. Note that these shortcuts are pretty dumb, they won't actually "untrust" the file or folder (they just remove the "explicit" entry required by VSTO), they could completely destroy your computer and the surrounding countryside, they should be used at your own risk, etc. etc. etc.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;&amp;nbsp;&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;Windows Registry Editor Version 5.00&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\dllfile\shell\FullTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Trust assembly"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\dllfile\shell\FullTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -ag 1 -url \"%1\" FullTrust -n \"%1\""&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\dllfile\shell\UnTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Remove assembly trust"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\dllfile\shell\UnTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -rg \"%1\""&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\exefile\shell\FullTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Trust assembly"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\exefile\shell\FullTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -ag 1 -url \"%1\" FullTrust -n \"%1\""&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\exefile\shell\UnTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Remove assembly trust"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\exefile\shell\UnTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -rg \"%1\""&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\Folder\shell\FullTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Trust folder"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\Folder\shell\FullTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -ag 1 -url \"%1\"\\* FullTrust -n \"%1\""&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\Folder\shell\UnTrust]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="Remove folder trust"&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[HKEY_CLASSES_ROOT\Folder\shell\UnTrust\command]&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;@="C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\caspol.exe -q -u -rg \"%1\""&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=184716" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>Why does Outlook have an OM?</title><link>http://blogs.msdn.com/ptorr/archive/2004/04/16/115029.aspx</link><pubDate>Sat, 17 Apr 2004 06:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:115029</guid><dc:creator>ptorr</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/115029.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=115029</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=115029</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;This one could be controversial ;-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;In a recent comment, &lt;a href="http://eddjames.net/"&gt;Edd James&lt;/a&gt; (note to Edd: that link gives a 403) asks why Outlook and Excel "&lt;a href="http://weblogs.asp.net/ptorr/archive/2004/03/20/93334.aspx#95208"&gt;need this ability to run scripts/macros&lt;/a&gt;[?]"&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;First I want to clear up a common misconception about Outlook: Despite what the endless ill-informed posters on &lt;a href="http://www.slashdot.org/"&gt;Slashdot&lt;/a&gt; might claim, &lt;span style="font-weight:bold;font-style:italic;"&gt;no recent version of Outlook (or recent update to an old version of Outlook) is designed to run code out of e-mail messages in the default configuration.&lt;/span&gt; Every once in a while someone finds a bug in the IE rendering engine or in Outlook that enables such execution, and that bug is fixed. Customers who &lt;span style="font-weight:bold;"&gt;want&lt;/span&gt; "dynamic" e-mails can still enable the feature through the Outlook security settings, but it is not the default and is not at all recommended.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;But moving on, let's turn the question around: why &lt;span style="font-weight:bold;"&gt;shouldn't&lt;/span&gt; Outlook have a rich object model? I challenge you to give me a sound answer to that question based on &lt;span style="font-style:italic;"&gt;security&lt;/span&gt; concerns (I can understand why you might not want the feature for "code bloat" reasons, etc.)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The obvious answer is that &lt;span style="font-weight:bold;"&gt;having an object model in Outlook makes all those mass-mailing viruses &lt;/span&gt;&lt;span style="font-weight:bold;font-style:italic;"&gt;possible&lt;/span&gt;. Apparently anyone who uses that argument hasn't heard of the recent viruses going around; that latest "virus technology" doesn't rely on Outlook to do its dirty work. It scans files on your hard-disc to scavenge e-mail addresses, and then it uses a built-in SMTP mailer to send out the mails. If you are running Lotus Notes or Pine or Eudora or Mozilla Mail or any other e-mail client and you execute a MyDoom-like virus program, you are in trouble. (At this point, someone may point out that their e-mail program of choice is not susceptible to the virus de jour because the virus only understands the Outlook address book file format. True, but that has nothing to do with whether or not Outlook exposes an object model, and everything to do with the size of the installed user base).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The next answer is that &lt;span style="font-weight:bold;"&gt;having an object model in Outlook makes all those mass-mailing viruses &lt;/span&gt;&lt;span style="font-weight:bold;font-style:italic;"&gt;easier to write&lt;/span&gt;. It is too easy for a "script kiddie" to cobble together some VBScript code and take over the world, so the argument goes. But the term "script kiddie" doesn't necessarily literally refer to "kids" writing "scripts." It refers to relatively unskilled people (of all ages) downloading sophisticated attack tools (written by the "real hackers") and then using them in some possibly-automated fashion. I doubt the average "script kiddie" has enough m4d c0ding 5ki11z to even write "Hello World" in VBScript, let alone craft something sophisticated like MyDoom. What the kiddies &lt;span style="font-weight:bold;"&gt;can&lt;/span&gt; do is surf around on #hacker IRC channels, download pre-canned exploit code from hackers, double-click on the icon on their desktop, and then brag to all their other 1337 friends. Basically, the really bad people (the criminals) who write real viruses don't need the Outlook OM to do their dirty work; sure if it is there they might choose use it, but they don't need it. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Of course the other point is that having an OM makes it easy for legitimate developers to write applications that better meet their customers' needs, and that is A Good Thing. We don't want to make it arbitrarily hard for "the good guys" to build solutions using our technologies, and in the end it won't really buy us anything since the bad guys are more determined than the good guys and so they will persevere with writing their malware whether we "help" them or not. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;In fact, by making it hard for ISVs to write against the Outlook OM, you can argue that the world has gotten worse because customers now typically install 3rd party applications such as &lt;a href="http://www.express-soft.com/mailmate/clickyes.html"&gt;ClickYes&lt;/a&gt; or &lt;a href="http://www.dimastr.com/redemption/"&gt;Redemption&lt;/a&gt; to re-enable access to Outlook... and those programs may have security bugs of their own!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;The next answer (and a slightly better one) is that &lt;span style="font-weight:bold;"&gt;many people don't need the object model, so in order to reduce the attack surface of Outlook it should not be installed&lt;/span&gt;. The same argument has been used for WSH (Windows Script Host) as well, and you could make it for all sorts of other features, too; installing anything on your system (even &lt;a href="http://www.security-forums.com/forum/viewtopic.php?p=83245"&gt;security software&lt;/a&gt;) increases the attack surface of your system in one way or another. But the fact is though that these kinds of features don't actually present a very compelling "attack surface" as we usually define it. The person making this particular argument is probably &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/03/06/85266.aspx"&gt;missing the point&lt;/a&gt;. Once the malicious code is running on your system, it's &lt;a href="http://www.imdb.com/title/tt0090605/"&gt;game over man, GAME OVER!&lt;/a&gt; &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;I think this calls for an analogy :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;One day a burglar breaks into your house. You surprise them in the kitchen, so they grab a sharp knife out of the drawer and stab you with it before running away. In an attempt to prevent this from happening in the future, you banish all knives from your house when you return from hospital. Sure, it might be hard to cut your steak from now on, but that's the price you pay for security. (Thanks to &lt;a href="http://www.amazon.com/exec/obidos/ASIN/0735612730"&gt;Randy&lt;/a&gt; for pointing out that "cheese" was not a good choice of words here for an American audience... :-) )&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;A few weeks later, the burglar breaks into your house a second time, and you surprise them in the kitchen again. This time they grab a big saucepan from the drawer and hit you over the head with it before running away. After returning from the hospital, you remove all saucepans and frying pans from your kitchen to improve the security of your house. No cheese and no fried food might be good for your waistline, after all!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;A week or two goes by, and the burglar strikes again. This time you catch them in the bedroom, and bereft of cooking implements they pick up a shoe that is lying on the floor and &lt;a href="http://www.imdb.com/title/tt0118655/"&gt;throw it at you&lt;/a&gt;. One trip to the hospital later, you have no choice but to ban shoes from your house as well. Hmmm, this could make going out for a walk a bit tricky, but hey, you have to protect yourself, right?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;What's the point of this analogy? Well, you have failed to perform a &lt;span style="font-weight:bold;"&gt;root cause analysis&lt;/span&gt; of the problem. The problem isn't that you have knives or saucepans or shoes in your house; it's that &lt;span style="font-weight:bold;"&gt;the burglar keeps getting inside&lt;/span&gt;! If only you'd invested in a good-quality front-door lock (and possibly a guard dog or an alarm) none of this would have happened. And to appease the "attack surface reduction" argument, removing knives and saucepans isn't a very effective technique because the burglar will just start packing their own weapons or perhaps they'll come in at night when you're fast asleep. A good attack surface reduction technique in this scenario would be to permanently seal the back door (so there's only one main entrance to the house) and to place bars on all the windows (so there's less room to crawl through).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;In the same way, removing WSH or Outlook or any other piece of "end user" code on Windows doesn't really help with attack surface reduction, and won't improve the &lt;span style="font-weight:bold;"&gt;real&lt;/span&gt; security of your machine one bit (it simply makes you less vulnerable to the more "popular" attacks, which is cold comfort indeed). Now don't get me wrong -- attack surface reduction is a great thing and we should be doing more of it. But a better example of attack surface reduction is the disabling of unneeded services, or the blocking of dangerous attachments in e-mail messages (the thing most responsible for the drop in e-mail viruses, until ZIP files became the infection vector), because both of these represent possible &lt;span style="font-weight:bold;"&gt;attack vectors&lt;/span&gt; for malicious code. Once malicious FullTrust (native) code is running on your system, it doesn't need any help from installed applications. As an extreme example, imagine that Outlook completely dropped its object model in the next version, and imagine further that nobody else in the world knew how to write a program to send e-mail. Mass-mailing viruses would still be possible; they'd simply bundle an old copy of Outlook '97 into their virus payload and use that to do their dirty work!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;This is where threat modelling comes into play. If you yourself are writing some software and are worried about exposing features to COM or .NET clients because of the security implications, then think of it this way. If your threat is:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Symbol;"&gt;·&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;User downloads malicious full-trust code that uses your application's OM to do harm&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Then you also have the threats:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Symbol;"&gt;·&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;User downloads malicious full-trust code that sends windows messages to your application to do harm&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Symbol;"&gt;·&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;User downloads malicious full-trust code that patches the binary (or in-memory image) of your application to expose an OM and then uses it to do harm&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:28.35pt;text-indent:-14.15pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Symbol;"&gt;·&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;User downloads malicious full-trust code that duplicates the functionality of your application to do harm&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;What is the root cause here? It is &lt;span style="font-weight:bold;font-style:italic;"&gt;User downloads malicious full-trust code&lt;/span&gt; and that is the thing that you (or rather we :-) ) should be trying to address with things like firewalls, proxies, virus scanners, attachment blocking, &lt;a href="http://weblogs.asp.net/ptorr/archive/2003/09/21/56188.aspx"&gt;Software Restriction Policies&lt;/a&gt;, and so on. We put a better lock on the front door so that you don't have to throw out all your kitchen knives. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Obviously this simple threat model doesn't apply if you have an ActiveX component marked "Safe for Scripting," or if you develop managed code that allows partially-trusted callers, or if you accept any kind of untrusted communications from other machines across the network. In those cases you have much more complicated threat models and you do have to start worrying about what happens when someone with restricted permissions talks to your application's OM, and it would be great for you to look at how you can reduce your attack surface. But for a rich-client full-trust-only application like Office 2003, these kinds of threats simply don't apply.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Finally, if you're still not convinced, then think of it this way: Outlook is nothing special. Sure, it's a great e-mail client and I spend most of my day using it, but at the end of the day it's just a piece of software. Whenever a destructive virus comes around, you don't see the whole world demanding that Microsoft remove the &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/deletefile.asp"&gt;DeleteFile&lt;/a&gt; API from Windows because it makes it easy to write file deletion viruses; that would be ludicrous. It's the same with viruses like Blaster or Slammer -- nobody asked Microsoft to pull networking from Windows just because there were viruses that propagated across the network (although some people have asked for "raw sockets" to be pulled, even though they are a standard part of most modern operating systems).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Another angle: A recent InfoWorld article shows the &lt;a href="http://www.infoworld.com/article/04/04/15/HNearthspyware_1.html"&gt;prevalence of spyware and adware on users' machines&lt;/a&gt;; a lot of that stuff is "willingly" installed by the user as part of some other application (typically file-sharing software), although a lot of it is also "accidentally" installed by users who do not read the (very poorly designed) IE download dialogs (which will thankfully be &lt;a href="http://weblogs.asp.net/jeffdav/archive/2004/03/22/94080.aspx"&gt;fixed in SP 2&lt;/a&gt;). These programs are probably more "destructive" to the average user than any e-mail virus, since they completely violate your privacy (monitoring web surfing, stealing passwords and credit card numbers, etc.), can include "backdoors" to allow later access and complete compromise of the system, and often cause &lt;a href="http://weblogs.asp.net/oldnewthing/archive/2003/12/19/44644.aspx"&gt;instability of the OS&lt;/a&gt;. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;And none of this has anything to do with Outlook, or, indeed, any kind of e-mail program. It has to do with the users' basic right to &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/04/13/111969.aspx"&gt;install software on their own computer and make bad trust decisions in the process&lt;/a&gt;. &lt;span style="font-weight:bold;"&gt;This&lt;/span&gt; is the problem that we need to fix long-term; &lt;span style="font-weight:bold;"&gt;not&lt;/span&gt; the ability of software to expose powerful, flexible object models that can be freely and productively used by suitably-trusted clients to build great customer-focused solutions. And of course, since &lt;a href="http://weblogs.asp.net/ptorr/archive/2003/10/16/56270.aspx"&gt;trust is inherently a social problem, not a technological one&lt;/a&gt;, so the best we can do is educate users and guide them into making good decisions; we cannot make decisions for them.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;There is no silver bullet.&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=115029" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>Top 5 List</title><link>http://blogs.msdn.com/ptorr/archive/2004/04/16/114298.aspx</link><pubDate>Fri, 16 Apr 2004 07:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:114298</guid><dc:creator>ptorr</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/114298.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=114298</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=114298</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;
          Julie is looking for input on a &lt;a href="http://www.kremerfamily.com/AOD/archives/000688.html"&gt;Top 5 Good / Bad Things about VSTO&lt;/a&gt; list over on her blog. If you have any others to add, surf on over and help her out ;-)&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=114298" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category></item><item><title>Follow up to "Don't trust that data"</title><link>http://blogs.msdn.com/ptorr/archive/2004/04/13/112404.aspx</link><pubDate>Tue, 13 Apr 2004 23:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:112404</guid><dc:creator>ptorr</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/112404.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=112404</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=112404</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;a href="http://blogs.msdn.com/eric_carter/"&gt;Eric&lt;/a&gt; makes some &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/04/12/111342.aspx#112056"&gt;good points&lt;/a&gt; in a comment to my &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/04/12/111342.aspx"&gt;last post&lt;/a&gt;. Nevertheless, the &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/04/05/107802.aspx"&gt;forces of evil within me&lt;/a&gt; compel me to respond anyway. (You should have blogged it, Eric ;-) ).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          Eric's main point is that the employee doesn't need to use formulas in order to fool the expense report system -- he can simply redirect the &lt;span style="font-weight:bold;"&gt;TotalExpense&lt;/span&gt; named range to point to some arbitrary location that his boss will never look at. That would be correct in an automated system, but the supposition in the first example was that there was &lt;span style="font-weight:bold;"&gt;no&lt;/span&gt; code involved in the scenario; it was all based on people looking at the expense report and following a manual process. Hiding the column or re-directing the named range doesn't make much sense, because the payroll clerk will see the same column that the manager sees ($100).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Hiding / moving a named range (or any other kind of UI spoofing attack) will typically only work when a &lt;span style="font-weight:bold;"&gt;human&lt;/span&gt; makes a decision that a &lt;span style="font-weight:bold;"&gt;computer&lt;/span&gt; then acts upon (because the computer "sees" a different value to the human). You must understand your threats (or your opportunities... mwhahahahahahaaaa) in order to successfully protect (or exploit) a system.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          Eric also points out that hacking the cached data blob is probably the hardest attack of all to mount, &lt;span style="font-weight:bold;font-style:italic;"&gt;but that just means developers will be least likely to deal with it!&lt;/span&gt; &lt;a href="http://www.imdb.com/title/tt0063929/maindetails"&gt;Nobody expects the Spanish Inquisition&lt;/a&gt;! If I know you are passing the data to some unmanaged component, for example, maybe I can trigger a buffer overflow by fiddling with the bits. Or perhaps I can just break some of your other assumptions in the code by inserting too many (or too few) rows of data, etc. I just don't want developers to fall into the trap of believing (incorrectly) that the data cache &lt;span style="font-weight:bold;"&gt;always&lt;/span&gt; holds what they are expecting it to hold. We've seen far too many web developers fall into that trap and get themselves (and their customers) into all manner of nasty problems.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;
          &lt;/span&gt;
          &lt;span style="font-weight:bold;"&gt;You cannot trust anything that was under the control of the attacker&lt;/span&gt;.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Using protected documents might help somewhat against a causal attacker, but you need a whole lot of infrastructure to set up IRM, and the other kinds of protection are trivially broken. Also it should be noted that &lt;span style="font-weight:bold;"&gt;IRM&lt;/span&gt;&lt;span style="font-weight:bold;"&gt; is not a security technology&lt;/span&gt;! It is not a foolproof way of thwarting all attacks by well-skilled evil doers; it is a technological measure to encourage users to adhere to existing corporate policies (such as "don't forward confidential e-mails outside the company").&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Obviously these kinds of threats will not exist in the vast majority of cases -- most employees are not going to spend time hacking into your Excel based solutions in order to cheat on their expense reports; they're just going to try and get their jobs done. But you should be aware of such possibilities so that you can weigh up the costs of adding in additional protection (in terms of increased development time, reduced productivity / usability, more help desk calls, etc.) against the risks / likelihood of employees rorting the system (if you are a large bank or a secret government agency, the risks might be pretty high).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Oh and this is nothing unique to Office -- if you built a custom WinForm application (or even a Java application!) and used it to connect to a server, I would be giving you the same advice; you would be asking for serious trouble if you blindly accepted all data coming from those clients and acted upon it without first doing some kind of verification. Just as the employee can dork with the spreadsheet in order to send you fudged data, so too could they dork with the client application (or just write their own!) and use it to connect to your server and send you bogus data.&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=112404" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>Don't trust that data!</title><link>http://blogs.msdn.com/ptorr/archive/2004/04/12/111342.aspx</link><pubDate>Mon, 12 Apr 2004 07:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:111342</guid><dc:creator>ptorr</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/111342.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=111342</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=111342</wfw:comment><description>&lt;DIV class=Section1&gt;
&lt;P&gt;&lt;SPAN&gt;A while ago I wrote a couple of blog entries on &lt;A href="http://weblogs.asp.net/ptorr/archive/2003/10/16/56270.aspx"&gt;code repurposing&lt;/A&gt; and some &lt;A href="http://weblogs.asp.net/ptorr/archive/2003/10/21/56296.aspx"&gt;mitigations&lt;/A&gt;, and one of the main causes of that problem is that developers inherently trust data. The text box caption says &lt;SPAN style="FONT-WEIGHT: bold"&gt;Name&lt;/SPAN&gt;, so it's always gonna contain the user's name, right? Nobody is ever going to put a SQL query or a JScript statement in that field... are they?&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But I want to talk a bit today about &lt;SPAN style="FONT-WEIGHT: bold"&gt;users&lt;/SPAN&gt; inherently trusting data, and how it's just as bad. I'll eventually talk about Excel and some of the cool new stuff we're doing with VSTO 2.0, but let's start a bit smaller than that. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And a bit less techy.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Imagine you're a caveman (or woman) and you've just discovered how to cultivate crops. You have two fields of corn ready for the winter, and one day your neighbouring caveman comes by and says "Ugh, me see sabre-toothed tiger nearby. Ugh. You hide in cave, ugh, and me go fight tiger. Ugh-ugh?" Being very afraid of sabre-toothed tigers, you are more than happy to let your neighbour go off and fight it while you roll a big rock over the entrance to your cave and hide away in fear. The next day you roll back the stone and emerge, only to find that all your crops have been pillaged and your neighbour is no-where in site. Congratulations! You just fell for the world's first &lt;A href="http://www.imdb.com/title/tt0325805/"&gt;matchstick man&lt;/A&gt;!&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Fast-forward to the (very) late the 20th century. You're sitting at work looking through your e-mail, when the subject line "HOT STOCK TIP!" catches your eye. You've always wanted to make a killing on the stock market (and quit your crappy job) so this could be the answer to your prayers! You read the message and jump onto your &lt;A href="https://www.etrade.com/"&gt;E*Trade&lt;/A&gt; account to buy up as much of the stock as you can. Three days later the stock is unlisted and you're left penniless on the street. Oops!&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There could be an infinite number of examples here -- the basic problem is that you are acting on information furnished to you by people whom you should not trust. I gave these examples (and will give a few more) mostly to placate any fears that what I am about to describe is a new problem that we are introducing with VSTO 2. Nothing could be further from the truth; it is just that VSTO 2 will provide many amazingly cool features that, like all features, can be used for good as well as for evil. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You have been warned :-)&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Let's talk about using Excel to implement an expense report (a common scenario we use here at Microsoft) and how that can be abused by untrustworthy employees. We'll start off with an expense report that doesn't use any kind of code (VSTO, VBA, whatever) although it does use formulas. The expense reporting process is as follows:&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The employee fills out an expense report and e-mails it to their manager&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The manager approves the expense report and e-mails it to the payroll department (obviously they could also choose to reject it)&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The payroll department receives the report and reimburses the employee with their next pay cheque&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note that in these scenarios I will only focus on the employee trying to abuse the system to get more money than they should; in a real system you would also think about all the players that could be trying to abuse the system -- the manager, the payroll employees, the vendor who wrote the payroll system, etc. -- and all the things they might try to do -- steal money, block legitimate payments, and so on.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The problem in this case is that the manager accepts an expense report from the employee and approves it or denies it simply by looking at the values in the cells. &lt;SPAN style="FONT-WEIGHT: bold"&gt;But those cells were under the control of the attacker (the employee)!&lt;/SPAN&gt; Let's say the employee recently took a client out to lunch and is claiming a fairly reasonable $100 for it. This sounds good to the manager, so she approves the request and sends it on to the payroll team. Unbeknownst to her, the $100 in the expense report was not a static value added by the employee, but rather a formula that would change to the fraudulent amount of $1,000 when viewed by the payroll employees. The payroll guys see the value for $1,000, verify that it was approved by the manager, and promptly over-pay the employee to the tune of $900.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note that using digital signatures or other "security" technologies wouldn't have helped here; the manager would just have signed the spreadsheet containing the formula. In fact it may have increased her liability because she can no longer claim that someone spoofed her e-mail account and sent the dummy report -- after all, it was signed with her private key!&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;About the only thing the manager could do in this case (short of performing a full audit on the spreadsheet) would be to take a new, known-trustworthy expense report template and manually re-key the employee's data into the spreadsheet so as to ensure no trickery was underway. This of course is a colossal waste of time, so nobody is going to do it. Of course they could also copy the entire spreadsheet and paste it back on top of itself with the "values only" option, but then it might break other parts of the spreadsheet (like the &lt;SPAN style="FONT-WEIGHT: bold"&gt;=SUM()&lt;/SPAN&gt; field at the bottom). Basically, it's a big hassle.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(Oh, and in case you think this is a problem with using Excel and it's auto-magic formulas, imagine that the expense report is a plain text file written in Notepad. The manager gets an expense report from her employee and sees the single line item "Lunch with client: $100" and sends it on to payroll. Unbeknownst to her, the employee simply added fifty blank lines after the first item and added "Ticket to the Caribbean: $5,000" to the end, knowing full-well that the payroll system will not be fooled by blank lines and will pay out for both line items).&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The reason I brought up VSTO 2 earlier on was that &lt;A href="http://blogs.msdn.com/EricLippert/"&gt;Eric&lt;/A&gt; and &lt;A href="http://weblogs.asp.net/eric_carter/"&gt;Eric&lt;/A&gt; (and the rest of the team) have been making data-binding and data-centric programming and server-side access to data so easy and powerful in Excel that I fear people will throw themselves into this cool new technology head-first and never stop to realise all the horribly bad assumptions they are making. Does the cached data your server-side component "see" have anything to do with the spreadsheet itself, or did the user hack it with a binary editor before e-mailing it to you? Does the &lt;SPAN style="FONT-WEIGHT: bold"&gt;TotalAmount&lt;/SPAN&gt; named range still refer to &lt;SPAN style="FONT-WEIGHT: bold"&gt;$C$10&lt;/SPAN&gt;, or did some nefarious employee move it to point to &lt;SPAN style="FONT-WEIGHT: bold"&gt;$D$20&lt;/SPAN&gt; instead? Has the user filled the "real" worksheet with bad data, hidden it, and then replaced it with a spoofed (look-alike) worksheet with benign data intended to fool other users? Did the user open your spreadsheet without the managed code executing, thereby bypassing any client-side validation functions you used to vet data before submitting it to a server system?&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The solution to the problem is, of course, to ensure that the only thing the employee is in control of is the data, not the way it is presented or the behaviour of the program. And thankfully the great work being done on VSTO 2 helps you out here; you just have to know how to use the tools effectively. There are two fairly obvious solutions to this problem of the employee being in control of the cells in the spreadsheet:&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;Utilise a trusted third party (often a server) to perform the "copy and paste" operation noted above&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;Utilise a trusted UI (not under the control of the attacker) for displaying and confirming the values in the spreadsheet&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can probably think of other ways, too. (Note that here we assume the attacker does not have any control over the code you are executing on your machine; they only have control over the spreadsheet).&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The first solution is (to me) the coolest, and it uses the VSTO 2 technology quite well. Instead of the 3-step process above, we build a more complicated (but less prone to abuse) process that uses a web site to help "cleanse" data:&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The employee fills out an expense report and submits it to the server&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The server strips out the data from the expense report, stores it in a database, and sends a notification to the manager&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The manager clicks on a link to the server, which extracts the data from the database, shoves it into a brand new expense report template, and serves it up to the manager&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The manager approves the expense report and submits it back to the server&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;5.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;Repeat steps 2-4 for the payroll people&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this scenario, the manager (and the payroll people) are guaranteed to see exactly the same data that the back-end processing system will see, because the Excel spreadsheet (which in the past may have held nasty formulas, hidden sheets, re-directed named ranges, etc) is never propagated from one user to another. The employee can dork with the expense report all they like, but they will not be able to get away with the same attack; when they submit the report to the server, they will get an error if they have placed formulas where numbers are supposed to be, and no matter how much they try and spoof the UI of the spreadsheet to make it look like it is for $100 when it is really for $1,000, the manager will see the true value of $1,000 and not approve the report (and hopefully fire the employee). You might realise that this is the way most web sites work, and you'd be perfectly correct; we're simply using the power of the Excel client to make the data entry and data viewing experiences better. It breaks down if you don't have a trusted server, or you need off-line support, or if for whatever reason your current process inherently relies on people e-mailing stuff to each other.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The second solution can help here. At its heart, this solution leverages the rich Excel user interface for the data entry portion (the employee), but completely bypasses it for the validation / approval portion (the manager / payroll clerk). The process is modified thusly:&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The employee fills out an expense report and e-mails it to their manager&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The manager opens the expense report, reviews the data inside a custom-built dialog box, approves the expense report and e-mails it to the payroll department (obviously they could also choose to reject it)&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt"&gt;&lt;SPAN&gt;&lt;SPAN style="FONT-WEIGHT: normal; BACKGROUND: none transparent scroll repeat 0% 0%; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; TEXT-DECORATION: none"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'; TEXT-DECORATION: none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; &lt;/SPAN&gt;The payroll department receives the report and reimburses the employee with their next pay cheque&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this scenario, when the manager indicates their desire to approve the expense (by clicking a button, etc.) the solution gathers up the data from the spreadsheet (the same way that the server would do in the previous example) and shows it to the manager in a "trusted" user interface such as a data grid inside a modal dialog, or (dare I say it?) inside the "Document Actions" pane. The manager then ignores what is in the Excel cells and makes their decision based on the numbers inside the trusted UI. (They will most likely look at the original expense report anyway, just to see what the expenses were for, but they need to make their decision on the value shown in the dialog, not the one shown on the spreadsheet). Just to make doubly-sure there is no deception going on, you could require the manager manually insert the total amount into a "Verify amount" field on the spreadsheet before submitting it. &lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P class=Heading3-P&gt;&lt;SPAN class=Heading3-H&gt;&lt;FONT color=#ffa500 size=4&gt;&lt;STRONG&gt;Update 12-04-04&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P style="MARGIN-TOP: 12pt; MARGIN-LEFT: 36pt"&gt;&lt;SPAN&gt;Having a policy such as "No direct manager can approve expenses over $500" would also help here, because even though the manager would see an expense for $100, the system would see $1,000 and flag it as a policy violation. Now of course the manager would then complain about the stupid computer system messing up again, but hopefully someone would track down the discrepancy, ferret out the fraudulent employee, and fix the system so that the same kind of thing didn't happen again.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What this shows is that technology is not a panacea to solving security issues. Technology has no concept of morality and can be used for good as well as for evil. Having solid designs for your solutions and building quality threat model for them will help you way more than throwing random technology buzzwords at a solution. User education and having good policies &amp;amp; procedures goes a long way, too.&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Oh, and hiring trustworthy employees (and keeping them trustworthy by treating them well) is also incredibly important.&lt;/SPAN&gt; &lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=111342" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>Another VSTO Blogger</title><link>http://blogs.msdn.com/ptorr/archive/2004/04/05/107802.aspx</link><pubDate>Mon, 05 Apr 2004 22:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:107802</guid><dc:creator>ptorr</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/107802.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=107802</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=107802</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;a href="http://blogs.msdn.com/eric_carter/"&gt;Eric Carter&lt;/a&gt; has started blogging! That makes &lt;a href="http://blogs.msdn.com/EricLippert/"&gt;two&lt;/a&gt; out of our three Erics on the VSTO team blogging.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          
            Eric Carter works on building the next-generation programming model for VSTO 2 and doing an amazing array of other really cool things. And if you happen to spill salsa all over your sweatshirt at a Mexican restaurant and then try to wash it off in the bathroom, he'll even hang it out to dry for you in the sun. What a guy!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          Eric and I famously disagree on just about everything we talk about internally. He even sends me random web links throughout the day to distract me from coming up with any more crazy ideas about the next version of our tools :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;OK, OK, I disagree with just about everyone on the team except &lt;a href="http://weblogs.asp.net/andrewclinick/"&gt;Andrew&lt;/a&gt;. And sometimes John (who should probably be blogging but isn't). Maybe it's me?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Anyway, let's see if this whole blogging thing is big enough for the both of us ;-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Oh and I should have some more &lt;span style="font-weight:bold;"&gt;real&lt;/span&gt; content up here soon... I've been battling my &lt;a href="http://www.tifaq.com/"&gt;RSI&lt;/a&gt; lately so I've been trying to avoid too much typing. :-( &lt;a href="http://www.kremerfamily.com/AOD/"&gt;Julie&lt;/a&gt; and &lt;a href="http://weblogs.asp.net/ptorr/archive/2004/01/28/63763.aspx#63869"&gt;Jennifer&lt;/a&gt; both recommend &lt;a href="http://www.ashtanga.com/"&gt;Ashtanga Yoga&lt;/a&gt;, which I will have to try. Anyone recommend a good place on the East Side (Redmond / Kirkland / Bellevue / etc) to do it?&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=107802" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Randomness/default.aspx">Randomness</category></item><item><title>Evidence is important, even if it grants no permissions</title><link>http://blogs.msdn.com/ptorr/archive/2004/03/21/93561.aspx</link><pubDate>Mon, 22 Mar 2004 03:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:93561</guid><dc:creator>ptorr</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/93561.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=93561</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=93561</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;In &lt;a href="http://weblogs.asp.net/ptorr/archive/2003/11/03/56304.aspx#87829"&gt;a comment&lt;/a&gt; to my old VSTO security blog entry, &lt;a href="http://www.sabbasoft.com/myblog"&gt;Enrico Sabbadin&lt;/a&gt; asks why we can't just remove the Zone evidence from an assembly before creating the AppDomain. Good question, and Siew Moi bugged me about blogging this a long time ago as well, so I guess now is as good a time as any (it's a blogging kind of weekend...)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Let's start with an analogy (oh boy do us geeks like our analogies):&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Say Microsoft designed cars, and.... no wait, wrong analogy.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Say that in order to get a driver's license, you have to be at least sixteen years old and have good eyesight. (Replace "sixteen" with whatever makes sense in your neck of the woods). It is hopefully pretty clear that you must meet both requirements to get a driver's license -- we don't hand out licenses to twenty-year-old blind people, and we don't hand them out to six-year-olds with 20/20 vision, either.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Aside&lt;/span&gt;: I've always wondered whether it was "&lt;span style="font-weight:bold;"&gt;driver's&lt;/span&gt; license" (a license belonging to the specific driver), a "&lt;span style="font-weight:bold;"&gt;drivers'&lt;/span&gt; license" (a kind of license applying to all drivers) or just "&lt;span style="font-weight:bold;"&gt;drivers&lt;/span&gt; license" (a generic term with no connotation of ownership). The &lt;a href="http://www.dol.wa.gov/ds/faq.htm"&gt;Washington DOL&lt;/a&gt; simply refers to it as a "&lt;span style="font-weight:bold;"&gt;driver&lt;/span&gt; license" -- perhaps they couldn't figure it out either?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Let's say you're the clerk filling out license forms at the licensing office, and the form looks something like this:&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[ ] Applicant is at least sixteen years old&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;[ ] Applicant has good vision&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;span&gt;Now some &lt;a href="http://www.faqs.org/docs/jargon/P/PFY.html"&gt;PFY&lt;/a&gt; comes into the office to get a license and you start to fill out the form. The youth hands you their birth certificate and their latest medical report from the optometrist (their &lt;span style="font-weight:bold;"&gt;evidence&lt;/span&gt;) and you have to fill out the form. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Question&lt;/span&gt;: Since being sixteen isn't (by itself) a good enough reason to get a license, should you as the license-application-filler-outerer ignore the youth's birth certificate? Surely since the &lt;span style="font-weight:bold;"&gt;evidence&lt;/span&gt; grants no &lt;span style="font-weight:bold;"&gt;permissions&lt;/span&gt;, it is unnecessary? Right?&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;
          &lt;/span&gt;
          &lt;span style="font-weight:bold;"&gt;Wrong.&lt;/span&gt;
        &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;font-style:italic;"&gt;Evidence is critically important!&lt;/span&gt; You should never throw away any evidence, even if in and of itself it doesn't appear to buy you anything. If you've ever watched any movies or TV shows involving police investigations, you should know this :-)&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Just to make it painfully clear why this is unacceptable, let's say you've been working at the license office long enough to figure out a time-saving optimisation: As soon as you fail to check &lt;span style="font-weight:bold;"&gt;any&lt;/span&gt; check box in the form, you know that the applicant will not be eligible to get a license and so you terminate the application without asking any more questions. So if you ignore the birth certificate, you won't check the "Applicant is at least sixteen years old" check box and will send the youth back home without a license even though they also had the optometrist's report. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;And they you'll get sued &amp;lt;g&amp;gt;&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;It's the same in the CLR. Let's say that instead of the application form with the two checkboxes, you have policy like this (look familiar? :-) ):&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;LocalIntranet Zone: Nothing&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&amp;nbsp;ACME Corporate Key: FullTrust&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;span&gt;Now VSTO tries to load an assembly from &lt;a href="http://appserver/"&gt;http://appserver/&lt;/a&gt; that is signed by ACME Corp's key.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;As is hopefully clear from the above discussion, we can't throw away the LocalIntranet zone evidence -- even though it grants no permissions -- because if we do we'll never evaluate the ACME Corporate key and thus fail to load the assembly. &lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=93561" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category></item><item><title>Balancing Security and Usability</title><link>http://blogs.msdn.com/ptorr/archive/2004/03/20/93334.aspx</link><pubDate>Sun, 21 Mar 2004 05:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:93334</guid><dc:creator>ptorr</dc:creator><slash:comments>14</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/93334.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=93334</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=93334</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;I'm often tempted to write about viruses and what I think the next "innovation" might be, but then I get scared that I might get put in jail (or deported) should any of my ideas ever see the light of day. (Not that I think the virus writers need any help coming up with new ideas, but you know what I mean). Anyway, one thing I have been meaning to talk about is how I approach this problem for VSTO solutions, and since &lt;a href="http://weblogs.asp.net/oldnewthing/archive/2004/03/16/90449.aspx"&gt;Raymond just blogged about some new shenanigans in this area&lt;/a&gt; I thought I'd do it now.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Aside: &lt;/span&gt;I say "how &lt;span style="font-weight:bold;"&gt;I&lt;/span&gt; approach this problem for VSTO," but it's not as if I am the only person thinking about this problem at Microsoft. Many smart people are thinking about it both from the security and the usability side of things, and we have spent (and will continue to spend) &lt;span style="font-style:italic;"&gt;a&lt;/span&gt; &lt;span style="font-style:italic;"&gt;metric boatload of time&lt;/span&gt; going over many different ideas and designs for the secure sharing and deployment of Office solutions. Hopefully, together we will come up with something that strikes the right balance between security and usability and lets the good people get their work done while keeping out the bad people. But this is my blog and I don't want to speak for any other people. I know what my motivations / goals / guiding principles are, and I'll try to share them with you.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;I have a very simple set of metrics for deciding if a method of code installation meets my personal "it's secure enough" bar -- it has to be &lt;span style="font-weight:bold;"&gt;harder&lt;/span&gt; than double-clicking on an e-mail attachment, and &lt;span style="font-weight:bold;"&gt;easier&lt;/span&gt; than copying and pasting the source code into a new VBA project. (I'll probably intermingle references to VSTO and VBA here because whilst I work on VSTO, it is not an end-user accessible technology whereas VBA is).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Let's look at the current "state of the art" in viruses. Most new e-mail viruses like &lt;a href="http://www.microsoft.com/security/antivirus/mydoom.asp"&gt;MyDoom&lt;/a&gt; rely on user interaction to spread (although they are often incorrectly termed "worms" -- true worms like &lt;a href="http://www.microsoft.com/security/incident/blast.asp"&gt;Blaster&lt;/a&gt; require &lt;span style="font-weight:bold;"&gt;NO&lt;/span&gt; user interaction). Running MyDoom "apparently" (I've never done it ;-) ) takes about three atomic actions:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;1.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Open the attachment&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;2.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Accept the security warning&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;3.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Open the EXE inside the attachment&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;(You could say that the first two are one and the same, and I'll argue for that case below, so really there are only two user actions).&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Clearly requiring only three (or two) basic user actions to go from "clean machine" to "virus infected spam bot zombie" is a little too easy. Now let's look at the typical "Linux virus" approach as applied to VBA: you get an e-mail message with some source code in it, and instructions similar to the following:&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;1.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Open Microsoft Word&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;2.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Hit Alt+F11&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;3.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Copy the code below into the clipboard&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;4.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Paste the code into the VBA editor&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;text-indent:-18pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-style:normal;text-decoration:none;font-weight:normal;background:transparent;font-family:Times New Roman;"&gt;5.&lt;span style="font: 7pt 'Times New Roman';text-decoration:none;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt;Hit F5&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Now five user actions isn't a huge step up from three, but to most users all but the first step is unfamiliar, and it is &lt;span style="font-weight:bold;"&gt;very&lt;/span&gt; easy to mess up step #3 if you copy too much or too little from the e-mail into the VBA editor. The point being though that &lt;span style="font-style:italic;"&gt;any security mechanisms we put in place that require more than five user steps are a waste of time&lt;/span&gt; -- the hackers will just go with the copy-the-source-code route, which will still be easier for the end user than installing "legitimate" software through the imaginary 10-step "secure" process.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So we want a process that is harder than two trivial actions, but easier than five non-trivial actions. Time to focus our energies!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;One important thing to note is that there are two entities involved in software distribution -- the publisher (developer) and the installer (end user). In an ideal world we would want to make the distribution experience as seamless and easy as possible for both parties, but in a hostile, broadly-connected world that doesn't cut it any more. Nevertheless, we can still try and simplify things &lt;span style="font-style:italic;"&gt;for the developer&lt;/span&gt;; there's no point in making it really hard to &lt;span style="font-weight:bold;"&gt;develop&lt;/span&gt; solutions while keeping the barrier for &lt;span style="font-weight:bold;"&gt;installing&lt;/span&gt; them very low -- the bad guys don't mind doing hard work to write their viruses, and the good guys will give up and go do something else if it's too hard (and thereby not &lt;a href="http://www.microsoft.com/mscorp/mission/"&gt;reach their full potential&lt;/a&gt;). And the end users will happily click on the attachments until the cows come home.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Instead, we want to make it &lt;span style="font-weight:bold;"&gt;as simple as possible to develop solutions, as simple as possible to install solutions from the "right" people, and virtually impossible to install solutions from the "wrong" people&lt;/span&gt;. Unfortunately, figuring out who is good and who is bad is the one thing in this equation that software alone can't do. Once you know who's naughty and who's nice, it's a Simple Matter of Programming:&lt;/span&gt;
      &lt;/p&gt;
      &lt;div style="border-top:solid 1pt #99CCFF;padding-top:1pt;border-bottom:solid 1pt #99CCFF;padding-bottom:1pt;border-right:solid 1pt #99CCFF;padding-right:4pt;border-left:solid 1pt #99CCFF;padding-left:4pt"&gt;
        &lt;div style=""&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;
              &lt;span style="color:#800000;"&gt;if&lt;/span&gt; &lt;span style="color:#008080;"&gt;(&lt;/span&gt;publisher.Diposition &lt;span style="color:#008080;"&gt;==&lt;/span&gt; Disposition.Good&lt;span style="color:#008080;"&gt;)&lt;/span&gt;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&amp;nbsp;InstallAndRunCode&lt;span style="color:#008080;"&gt;()&lt;/span&gt;&lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;
              &lt;span style="color:#800000;"&gt;
              &lt;/span&gt;
              &lt;span style="color:#800000;"&gt;else&lt;/span&gt;
            &lt;/span&gt;
          &lt;/p&gt;
          &lt;p class="Code-P"&gt;
            &lt;span&gt;&amp;nbsp;&amp;nbsp;CallTheFBI&lt;span style="color:#008080;"&gt;()&lt;/span&gt;&lt;/span&gt;
          &lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;span&gt;But the burden of figuring out who is good and who is bad falls on the user of the computer (or perhaps their administrator). And, as history has shown us, users are less interested about &lt;span style="font-style:italic;"&gt;who sent them the solution&lt;/span&gt; than they are about &lt;span style="font-style:italic;"&gt;what the solution claims to do&lt;/span&gt;. It doesn't matter if an e-mail comes from a random e-mail address with a random subject line and some random text inside it -- if there's an attachment entitled &lt;span style="font-weight:bold;"&gt;BritneySpearsNude&lt;/span&gt; then a significant number of users will open it and disregard any warnings. Even if the attachment is &lt;span style="font-weight:bold;"&gt;DoNotOpenMeBecauseIAmAVirusAndWillDeleteAllYourFiles&lt;/span&gt;, some people will open it just out of curiosity or because they think it is a joke.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Another aside&lt;/span&gt;: Modal warnings are horrible. It's what we use today, but they are truly useless. I open &lt;span style="font-weight:bold;"&gt;BritneySpearsNude&lt;/span&gt; from my inbox. Clearly my intention is &lt;span style="font-style:italic;"&gt;to open the attachment&lt;/span&gt;, but my e-mail program helpfully asks, "Are you sure you want to open this attachment?" &lt;span style="font-weight:bold;"&gt;OF COURSE I WANT TO OPEN IT!&lt;/span&gt; I would not have opened it if I did not want to open it!! Stupid computer!!! Stupid Microsoft!!!! Now where are my pictures of Britney????? And where have all my documents gone?!?!?!?!!!!!! &lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;It also doesn't help that you get redundant dialogs. I open a Word document from Outlook, and it tells me "Hey, y'know this could have a virus in it, don't you?" even though the Word document may not have any macros in it. Then it opens in Word and (depending on my security settings and whether or not the document really has code in it) Word might warn me again. Now there's a good reason for this -- we call it "defence in depth" -- since either of the two mechanisms could fail. Outlook is being ultra-paranoid: maybe you have your Word security settings at "Low," so all macros can run. Maybe there's a problem with the way Word checks for macros (we have issued &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3cb2a7e8-8515-423c-a021-1daac4f4ae79&amp;amp;DisplayLang=en"&gt;at least one patch&lt;/a&gt; for just this problem in the past) and it won't protect you from this particular virus. Maybe there's a buffer overflow in the normal parsing of Word documents that doesn't rely on VBA code to perform the exploit. You get the idea.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;But of course the plain and simple truth is that Outlook is dumb and it just knows that &lt;span style="font-weight:bold;"&gt;.doc&lt;/span&gt; files need to prompt the user before being opened. It doesn't know why, it just follows orders. Now if we could have Outlook, Word, Windows, Windows Update, Office Update, the virus scanner, the virus scanner's update server, the firewall, and maybe a managed PC service provider all working together behind the scenes, maybe we could do away with the prompts altogether (or at least only show &lt;span style="font-weight:bold;"&gt;one&lt;/span&gt; prompt, and only when it was &lt;span style="font-weight:bold;"&gt;really necessary&lt;/span&gt;). But that's a pipe dream right now.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;That's our goal -- run good code and block bad code. But we can't really get there without massive user education and a lot of infrastructure. So our next-best approach is to make it hard for end-users to run solutions. The idea here is that if it's too hard to open the &lt;span style="font-weight:bold;"&gt;BritneySpearsNude&lt;/span&gt; attachment, then most people will give up and get on with their job. At the same time though, if it's too hard to open &lt;span style="font-weight:bold;"&gt;Budget.xls&lt;/span&gt; with some cool &lt;a href="http://www.ozgrid.com/VBA/Functions.htm"&gt;Excel user-defined functions (UDF)&lt;/a&gt; in it, then people won't be able to get on with their job. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Stalemate.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Rant&lt;/span&gt;: I just tried looking for a good hyperlink to &lt;span style="font-weight:bold;"&gt;Microsoft&lt;/span&gt; documentation on UDFs in Excel. Could I find one? I'll leave that as an exercise to the reader (thankyou &lt;a href="http://www.google.com/"&gt;Google&lt;/a&gt;). Anyway, when we did customer research on how people use VBA with Excel, we found that most people don't know half of the things they can do. Workbook events -- what are they? Worksheet functions -- what are they? We have all these cool technologies and nobody knows about them. We suck. We need to do much better in the future, both in terms of increasing discoverability and in terms of documenting this stuff. And people say there's no reason to keep building new versions of Office!&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;So anyway, back to where we left off the conversation... if it's hard to install all solutions, then it's equally as hard to install the good ones as it is the bad ones (remember, we can't tell the difference between them). So the next best thing is to front-load all the pain of installing good code and require some kind of pre-arranged client setup (or, in the case of an enterprise, perhaps some domain-level policy) that will help to ease the installation of good code. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;In this case, maybe we can require more than five non-trivial steps to setup the machine as long as those steps are done out-of-band and in a way that makes it very clear you should not do them as a normal part of your daily computer use. After all, you only need to do it once, and then all the good code runs with little or no fuss. You might note that not only am I a big fan of killing modal dialogs, I'm also a big fan of "out-of-band" activities for security-related actions. Don't let somebody trust a piece of code while they are in the process of trying to run it! Force them to have thought about it before hand. That is what &lt;span style="font-weight:bold;"&gt;policy&lt;/span&gt; is all about -- having a set of well-thought-out, generally applicable rules, and sticking to them. Don't make ad-hoc decisions at &lt;a href="http://kidshealth.org/teen/food_fitness/nutrition/grocery_shopping.html"&gt;the worst possible time&lt;/a&gt;! &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;And I'm going to stop here. Not because I don't have anything more to say -- I have lots to say -- but because this entry is already quite long, and after all, I only ever said I'd tell you how &lt;span style="font-weight:bold;"&gt;I approach&lt;/span&gt; the problem, not how &lt;span style="font-weight:bold;"&gt;we solve&lt;/span&gt; it. We're a long way from having a good solution to this problem at this point in time, although we're all full of ideas.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p style="margin-top:12pt;margin-left:36pt;"&gt;
        &lt;span&gt;
          &lt;span style="font-weight:bold;"&gt;Final aside&lt;/span&gt;: Regular readers will know I'm a huge fan of the &lt;a href="http://www.petshopboys.co.uk/"&gt;Pet Shop Boys&lt;/a&gt;, but I'm also a big fan of &lt;a href="http://www.howardjones.com/"&gt;Howard Jones&lt;/a&gt;. I think his song &lt;a href="http://www.content.loudeye.com/scripts/hurl.exe?clipid=033907101040006550&amp;amp;cid=600111"&gt;Someone You Need&lt;/a&gt; from the &lt;a href="http://www.amazon.com/exec/obidos/tg/detail/-/B00005NKJG/"&gt;Perform.01&lt;/a&gt; or &lt;a href="https://sslrelay.com/s82378375.oneandoneshop.co.uk/sess/utn;jsessionid=15405ce7b39275e/shopdata/0027_Howard+Jones/0020_Music/product_details.shopscript?article=0005_The%2BVery%2BBest%2BOf%2BHoward%2BJones%2B%3D28HoJo%2BVBO%3D29"&gt;The Very Best Of&lt;/a&gt; CDs is one of the most romantic songs I've heard in a long while. The lyrics are &lt;a href="http://howardjones.com/HoJo/multimedia/lyrics/perform.htm#Someone%20You%20Need"&gt;very simple&lt;/a&gt;, but it gets to the heart of the matter. Thanks Howard!&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=93334" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ptorr/archive/tags/Office/default.aspx">Office</category></item><item><title>The Amazing Disappearing Templates Act</title><link>http://blogs.msdn.com/ptorr/archive/2004/02/29/81657.aspx</link><pubDate>Sun, 29 Feb 2004 12:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:81657</guid><dc:creator>ptorr</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ptorr/comments/81657.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ptorr/commentrss.aspx?PostID=81657</wfw:commentRss><wfw:comment>http://blogs.msdn.com/ptorr/rsscomments.aspx?PostID=81657</wfw:comment><description>
    &lt;div class="Section1"&gt;
      &lt;p&gt;
        &lt;span&gt;As reported in the VSTO Newsgroup (can't...find...link) and on &lt;a href="http://www.kremerfamily.com/AOD/archives/000616.html"&gt;Julie's blog&lt;/a&gt;, if you try and access &lt;a href="http://msdn.microsoft.com/library/en-us/vbawd10/html/woobjTemplates.asp?frame=true"&gt;ThisApplication.Templates.Count&lt;/a&gt; from VSTO, you end up with only one (Normal.dot) instead of the &lt;span style="font-style:italic;"&gt;n&lt;/span&gt; (where &lt;span style="font-style:italic;"&gt;n&lt;/span&gt; &amp;gt; 1) entries you were expecting.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;I finally got off my lazy body part and did a quick test, and the explanation / solution is pretty simple. It seems that when you boot Word with a document on the command line, it doesn't open any templates in the &lt;span style="font-weight:bold;"&gt;STARTUP&lt;/span&gt; folder. Since this is how VSTO launches your projects for debugging (&lt;span style="font-family:Lucida Console;"&gt;winword.exe c:\path\to\your\document.doc&lt;/span&gt;) you only ever see one template. &lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;Just to prove to the non-believers that it wasn't some voodoo CLR magic that made the templates disappear &amp;lt;g&amp;gt; I also verified this with VBA, and VBA only sees one template in this scenario too.&lt;/span&gt;
      &lt;/p&gt;
      &lt;p&gt;
        &lt;span&gt;If you boot Word normally (from the &lt;span style="font-weight:bold;"&gt;Start&lt;/span&gt; menu) and then manually open the document, everything works fine. You could also modify the Project Properties of your solution to just boot Word when you start debugging, and then manually open the document (which should be in your MRU list, anyways).&lt;/span&gt;
      &lt;/p&gt;
    &lt;/div&gt;
  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=81657" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ptorr/archive/tags/VSTO/default.aspx">VSTO</category></item></channel></rss>