in

ASP.NET Weblogs

Keith Pleas Blog

Keith's palimpsest

Security piece finally makes it to MSDN

It took more than a year, but a piece I wrote reviewing "best practices" security principles as applied to the well-known .NET "reference" applications (PetShop, F&M, Duwamish) finally made it onto MSDN last week. As you might imagine, the security aspects of these applications don't stand up well when a strong light is shown on them. And yet...what else is there? How are developers, designers, and architects supposed to deal with security when all they have to look at is simple marketing-oriented demos or 2,000 pages of detailed guidance, with nothing in between?

There are probably a number of ways to locate this article (and MSDN's infrastructure discourages permanent links), but here's one from the Architecture Center portal that might be good for a while:
   http://msdn.microsoft.com/architecture/default.aspx?pull=/library/en-us/dnbda/html/ppsecguide.asp

I'm particularly tickled by the ratings / comments. The overall is currently 6.4998 (about average), but you just have to laugh at the distribution (see the graph at the bottom on the article). And what are the comments that accompany the 1 ratings?

"this page sucked"

"This article is full of shit..."

But here's the most recent comment (clearly, from an intelligent and perceptive reader <grin>):

"Told it like it is! The author has created has genuinely useful document that should be required reading for anyone writing secure apps."

Published Jan 24 2005, 11:07 AM by keithpleas
Filed under: ,

Comments

 

Nicole Calinoiu said:

It's wonderful to see this sort of critique finally emerging from within Microsoft, and I very much hope that you're right about the quality of future sample applications.

That said, there are a couple of potential errors/omissions in your article that might merit a second look. The more obvious of the two is the last sentence of the CAS section, which essentially states that link demands for SNIP (StrongNameIdentityPermission) can't be bypassed even by fully trusted code. Unfortunately, that's simply not true. All identity permission verifications can be bypassed or spoofed by code with an adequate set of CAS permissions (which are, of course, granted by full trust), so SNIP use alone is not a strong protection against calls from "foreign" code. This certainly doesn't make your recommendation to use SNIP (or other identity permissions) any less relevant, but it simply doesn't offer the level of protection that you suggest. In addition, if plans discussed in the MSDN feeback centre for version 2 of the .NET Framework make it to production, fully trusted code will pass all identity permission verifications, thereby making even the "accidentally" part of your statement incorrect in future versions.

The second issue is a little less obvious but, since it's also one of the more glaring omissions in the documentation and samples you analyzed, it might be worth a bit of discussion. Basically, when examining the authentication-authorization process for web applications, you mention the use of IPrincipal implementations without addressing the potential for substitution of the principal object (e.g.: http://msdn.microsoft.com/library/en-us/cpguide/html/cpconreplacingprincipalobject.asp). Since you do cover other concerns related to shared hosting with potentially highly privileged code, this one is probably worth at least a bit of consideration too.
January 25, 2005 10:22 AM
 

TrackBack said:

January 25, 2005 11:00 AM
 

Matt Phillips said:

I thought your article on MSDN was good, and well overdue.

Why MS people are allowed the ability to disclaim any samples with 'I was lazy and took short cuts so this sample is of course useless for any real-world application' is beyond me. It saves them 5 minutes and wastes the rest of us days and days.

The fact that it's like that seems to highlight the fact that none of the security techniques are, to me, entirely satisfactory.

In our team we've asked various MS people the same basic question and got back different, less than satisfactory answers. The question: I don't want ASP.Net (pool identity) allowed direct access to SQL. I don't like the idea of connection strings in files or registry (encrypted or no). I don't want to host .Net components in COM+ purely to swicth identity. Whazt do I do?

Matt
February 2, 2005 8:28 AM
 

TrackBack said:

^_^,Pretty Good!
April 10, 2005 8:07 AM

Leave a Comment

(required)  
(optional)
(required)  
Add