mostlylucid

scott galloway's personal blog...
posts - 916, comments - 758, trackbacks - 11

My Links

News

Archives

Post Categories

Misc. Coding

Security through Diversity - why I don't like ValidateRequest

I'm aware this is a fairly controversial viewpoint, I should explain some of my own background as a precursor to my dislike of this. In the bad old days, I was a penetration tester; I ran my own little company which provided this service to a number of customers, my job was to essentially crack / in other ways break web sites and 'other' networks. In my time as a pen tester, one of the most annoying things was flaws which could effect a huge number of sites / installations at the same time, classics were Cisco password flaws, Perl and PHP security flaws and, worst of all, backdoors in Web Applications. So, as time has progressed and I moved more into actually writing applications rather than breaking them I've always been aware that application security systems should not be inherently trusted, while less likely to be flawed than some ad-hoc implementation, that flaw can be potentially more serious since is is almost certain to become widely know and exploited within a very short space of time.
That's part of the problem I have with ValidateRequest, it provides a crutch, a shortcut for the lazy developer. OK, it is useful, it blocks any incoming 'html' like request information - and will therefore block many XSS (Cross Site Scripting) attacks which can be pretty serious. Problem is, flaws have already been found in this and the patch is not obvious / easy to find (had you heard of it before?) - so not there's an issue which will effect ALL ASP.NET 1.1 sites which rely on this feature to protect them from XSS attacks. Even worse, how many sites do you think will take additional precautions over and above this to protect their input - do you know if it protects you from SQL Injection attacks, Buffer Overflow attacks and various others (including such gems as simple backdoors, Cookie Hijacking and the like).

My point is, in my view, responsibility for application security should lie with the developer - they should understand and plan for the consequences of choices they make in application design. Read a book like Michael Howard's Writing Secure Code [US] - get to know where the vulnerabilities in your application may lie and compensate for them.
In short, don't rely on things like ValidateRequest as your only line of defence - use it by all means, it will stop many things getting through which you may not want - but learn what it actually does and what it doesn't.

For instance, what will you do when you only want certain tags to get through and not others? You may need to look at something like this (I wrote this a while ago - I'm not claiming it's entirely or even partially foolproof - just proof of a concept).

Anyway, views always welcome - how much application security should you delegate to the framework - has anyone else come up with their own little 'security' toys which they use to validate user input?

UPDATE: Forgot to mention, if you're still on IIS 5.0 be sure to check out IISLockdown - you MUST have this installed, it will help you avoid a huge number of security holes, known / future...if you have IIS 6.0 , it's already there but be sure to check out this to avoid any development problems...

Print | posted on Tuesday, March 02, 2004 3:10 PM | Filed Under [ ASP.NET Security ]

Feedback

Gravatar

# re: Security through Diversity - why I don't like ValidateRequest

I agree with you 100% that the ultimate responsibility lies with the developer (along with the network administrator) to secure their application. But the reality is that not everyone is as skilled in doing this as they should be, so any help that the framework can provide is welcome, IMO.

Beyond that, a layered approach to security is ultimately the best approach, and request validation can provide one of those layers. It should not, as a best practice, be the only layer of protection against malicious input.

The framework provides lots of infrastructure for developers, from built-in functions for encoding HTML input, to helper methods for hashing passwords. I see request validation as another part of this infrastructure, albeit a part that's enabled by default.

3/2/2004 6:16 PM | G. Andrew Duthie

Gravatar

# re: Security through Diversity - why I don't like ValidateRequest

Yes, I do totally go along with the Framework providing functions to assist with security and in that regard tools like the access blocks are invaluable - what I don't go with is the abdication of responsibility for security from developer to framework. As I mentioned - how many developers actually know what the ValidateRequest does and does not do? How many have turned it off at an application level because they did not understand the repercussions of what this feature entailed - fact is it does give a nasty error which can be very off-putting. I'd have far preferred that this was a validation component which could optionally be dropped in a page, so the developer actively chose to secure the application in that manner - and therefore hopefully did a bit of research into what that actually meant.
But then again, I am not trying to say there should be no security features in the framework, what's there has advanced the cause of Web Security more than almost anything else (beyond the introduction of SSL). Just that for evey other feature you must actively enable them - and therefore take responsibility and understand their action.

3/2/2004 8:44 PM | Scott Galloway

Gravatar

# Takes Outs for 2 March 2004

You've been Taken Out. Thanks for the good post.

3/3/2004 12:45 AM | Enjoy Every Sandwich

Gravatar

# re: Security through Diversity - why I don't like ValidateRequest

The validateRequest has all the hallmarks of panic thinking. And panic thinking from somebody who hasn't a clue about programming.

Agreed a feature that you can drop on a page is a really good idea. But something that breaks version 1.0 pages, where there is absolutely zero guaranteed way that developers find out, that does dumb things, that has no fine grained control... NO WAY. MS has betrayed developers with this baby. In the old days they went through hoops to make old code still work. Now they seem not to give a damn.

8/23/2004 10:44 AM | Mike Gale

Gravatar

# re: Security through Diversity - why I don't like ValidateRequest

I don't know that that's fair - the ValidateRequest feature I think was a blip - for instance, I can run all my legacy code under 2.0 without any problems but I can also use the security features *if I want to* - that's important!

8/23/2004 5:47 PM | Scott Galloway

Comments have been closed on this topic.

Powered by: