How To Hack WCF - New Technology, Old Hacking Tricks

First of I'd like to thank Guy for his excellent screencast - very convenient, so thanks.

Specifically I liked introductory screencast for WCF which can be found here: http://blogs.microsoft.co.il/blogs/bursteg/pages/WCF-Introduction-Demo-_2800_ScreenCast_2900_.aspx

It is dubbed in Hebrew, but the screens are flipping in so logical way so that one who does not understand Hebrew will be fine - go for it - recommended a lot for WCF newbies like me.

My interest was to understand the pipeline that the WCF Message goes through before it is put on the transport. The idea was to inject some custom modules (Inspectors) in the pipeline. Why? Is not it clear? To mess around with the message - tamper it in it raw format before it goes down to the transport signed and protected. Why? To show that it DOES NOT matter what communication technology you use - HTTP, Remoting, MSMQ, WCF, RMI, CORBA, DCOM, MQ, <<fill in your own here>> - the basic principle of VALIDATING INPUT ON THE SERVER SIDE is immutable.

Here I showed it for Web Services App Architecture with Security in mind - Video, Part I (that was easy - Fiddler is of much help here)

Then remoting came along - same result, here App Architecture with Security in mind - Video, Part II

Now it is mighty WCF.

I used excellent demo from Madhu here http://blogs.msdn.com/madhuponduru/archive/2006/07/19/671922.aspx that explained how to build IClientMessageInspector (NOTE - demo that works!)

So here is the service contract:

and the implementation:

and the client side validation:

here is the client rejects the input:

and here is the result of server processing for good input:

after adding the custom message inspector, I am offered to tamper the massage before it is sent to the service and the resulting reply from the service is in red at the bottom:

Conclusion

Does that mean that the communication technologies are bad? - NO, it is the way WE use it.

Here is an basic example for input validation in Web Services Web Service Input Validation - it has link to regex usage that you can use on the server side for input validation.

Enjoy

Published 04 March 07 08:11 by alikl

Comments

# Will’s Blog - LiveWriter needs fixing said on March 4, 2007 6:18 PM:

PingBack from http://will.hughesfamily.net.au/20070305/livewriter-needs-fixing/

# alik levin's said on April 18, 2007 1:47 PM:

Imagine if security was cool like Silverlight .... But security is not that cool, so the biggest challenge

# Ferry Mulyono said on April 27, 2007 12:15 AM:

I&#39;ve been playing around a little with WCF, and will play it a lot next month (for my thesis). I&#39;ve

# alik levin's said on May 18, 2007 6:57 AM:

My favorite design patterns is Provider design pattern (abstract factory – GoF definition) . I like it

# alik levin's said on May 31, 2007 3:08 PM:

I just finished building another security workshop that covers authentication and identity technologies

# alik levin's said on September 2, 2007 3:55 PM:

This session discusses common coding anti-patterns which usually lead to security vulnerabilities. Come

# Noticias externas said on September 2, 2007 4:15 PM:

This session discusses common coding anti-patterns which usually lead to security vulnerabilities. Come

# alik levin's said on October 3, 2007 8:29 AM:

“As to methods there may be a million and then some, but principles are few. The man who grasps principles

# alik levin's said on December 26, 2007 5:09 PM:

This post to describe basic steps to write HttpModule and how it rescued mission critical application

# alik levin's said on January 14, 2008 10:50 AM:

The pattern is also called Intercepting Filter, Pipeline, AOP, and may be few more&#8230; I am confused

# alik levin's said on April 20, 2008 12:28 AM:

This is a digest of WCF Security resources I was collecting for some time. Drop me a comment in case

# Alik Levin's said on May 25, 2008 7:17 AM:

Input and Data Validation is one of the core security principles . WCF is no exception . To get most

New Comments to this post are disabled

Search

This Blog

. My Personal Blog .

.Net Performance How To's

.Net Security How To's

Design Patterns

Impactful

Lifecycle Phases

Popular

Tools

Syndication

Page view tracker