Chris Eargle

Life Student of the Kodefu Arts

WCF 3.5 Security Guidelines

by chris 17. April 2008 08:16

The patterns & practices WCF Security Guidance project has released the the WCF 3.5 Security Guidelines. This is useful if you're trying to follow the best practices for securing your services.

Here are the categories and topics for the initial release of the guidelines. For more in depth information, go to the site.  

Categories

  • Auditing and Logging
  • Authentication
  • Authorization
  • Binding
  • Configuration Management
  • Exception Management
  • Hosting
  • Impersonation and Delegation
  • Input/Data Validation
  • Proxy Considerations
  • Deployment considerations 

Auditing and Logging

  • Use WCF auditing to audit your service
  • If non-repudiation is important, consider setting SuppressAuditFailure property to false
  • Use message logging to log operations on your service
  • Instrument for user management events
  • Instrument for significant business operations
  • Protect log files from unauthorized access
  • Do not log sensitive information

Authentication

  • Know your authentication options
  • Use Windows Authentication when you can
  • If you support non-WCF clients using windows authentication and message security, consider using the Kerberos direct option
  • If your users are in AD, but you can’t use windows authentication, consider using username authentication
  • If your clients have certificates, consider using client certificate authentication
  • If you need to streamline certificate distribution to your clients for message encryption, consider using the negotiate credentials option
  • If your users are in a custom store, consider using username authentication with a custom validator
  • If your users are in a SQL membership store, use the SQL Membership Provider
  • If your partner applications need to be authenticated when calling WCF services, use client certificate authentication.
  • If you are using username authentication, use SQL Server Membership Provider instead of custom authentication
  • If you need to support intermediaries and a variety of transports between client and service, use message security to protect credentials
  • If you are using username authentication, validate user login information
  • Do not store passwords directly in the user store
  • Enforce strong passwords
  • Protect access to your credential store
  • If you are using Windows Forms to connect to WCF, do not cache credentials

Authorization

  • If you use ASP.NET roles, use the ASP.NET Role Provider
  • If you use windows groups for authorization, use ASP.NET Role Provider with AspNetWindowsTokenRoleProvider
  • If you store role information in SQL, consider using the SQL Server Role Provider for roles authorization
  • If you store role information in Windows Groups, consider using the WCF PrincipalPermissionAttribute class for roles authorization
  • If you need to authorize access to WCF operations, use declarative authorization
  • If you need to perform fine-grained authorization based on business logic, use imperative authorization

Binding

  • If you need to support clients over the internet, consider using wsHttpBinding.
  • If you need to expose your WCF service to legacy clients as an ASMX web service, use basicHttpBinding
  • If you need to support remote WCF clients within an intranet, consider using netTcpBinding.
  • If you need to support local WCF clients, consider using netNamedPipeBinding.
  • If you need to support disconnected queued calls, use netMsmqBinding.
  • If you need to support bidirectional communication between WCF Client and WCF service, use wsDualHttpBinding.

Configuration Management

  • Use Replay detection to protect against message replay attacks
  • If you host your service in a Windows service, expose a metadata exchange (mex) binding
  • If you don’t want to expose your WSDL, turn off HttpGetEnabled and metadata exchange (mex)
  • Manage bindings and endpoints in config not code
  • Associate names with the service configuration when you create service behavior, endpoint behavior, and binding configuration
  • Encrypt configuration sections that contain sensitive data

Exception Management

  • Use structured exception handling
  • Do not divulge exception details to clients in production
  • Use a fault contract to return error information to clients
  • Use a global exception handler to catch unhandled exceptions

Hosting

  • If you are hosting your service in a Windows Service, use a least privileged custom domain account
  • If you are hosting your service in IIS, use a least privileged service account
  • Use IIS to host your service unless you need to use a transport that IIS does not support

Impersonation and Delegation

  • Know the impersonation options
  • If you have to flow the original caller, use constrained delegation
  • Consider LogonUser when you need to impersonate but you don’t have trusted delegation
  • Consider S4U when you need a Windows token and you don’t have the original caller’s credentials
  • Use programmatic impersonation to impersonate based on business logic
  • When impersonating programmatically be sure to revert to original context
  • Only impersonate on operations that require it
  • Use OperationBehavior to impersonate declaratively

Input/Data Validation

  • If you need to validate parameters, use parameter inspectors
  • If your service has operations that accept message or data contracts, use schemas to validate your messages
  • If you need to do schema validation, use message inspectors
  • Validate operation parameters for length, range, format and type
  • Validate parameter input on the server
  • Validate service responses on the client
  • Do not rely on client-side validation
  • Avoid user-supplied file name and path input
  • Do not echo untrusted input

Proxy Considerations

  • Publish your metadata over HTTPS to protect your clients from proxy spoofing
  • If you turn off mutual authentication, be aware of service spoofing

Deployment considerations

  • Do not use temporary certificates in production
  • If you are using a custom domain account in the identity pool for your WCF application, create an SPN for Kerberos to authenticate the client.
  • If you are using a custom service account and need to use trusted for delegation, create an SPN
  • If you are hosting your service in a Windows Service, using a custom domain identity, and ASP.NET needs to use constrained trusted for delegation when calling the service, create an SPN
  • Use IIS to host your service unless you need to use a transport that IIS does not support
  • Use a least privileged account to run your WCF service
  • Protect sensitive data in your configuration files

My Related Posts

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

wcf, security, guidelines

Training

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

.NET 3.5 Enhancements Training Kit

by chris 16. April 2008 08:59

Microsoft has released a training kit for .NET Framework 3.5 Enhancements. It includes labs, demos, and Power Point files for the following technologies:

  • ASP.NET MVC
  • ASP.NET Dynamic Data
  • ASP.NET AJAX History
  • ASP.NET Silverlight controls
  • ADO.NET Data Services
  • ADO.NET Entity Framework

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

download, mvc, ajax, entity, silverlight

Training

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

WPF Application Quality Guide

by chris 4. February 2008 13:22

The WPF Team at Microsoft has posted the 0.1 edition of the WPF Application Quality Guide. There's still a lot missing, but it does have good tips on how to set up your WPF application for automated testing.

Here's a list of tools they recommend for performance profiling:

  • Using Performance Profiling Tools for WPF.
  • Event Trace. Use this tool for analyzing events and generating event log files.
  • Perforator. Use this tool for analyzing rendering behavior.
  • ETW Trace Viewer. Use this tool to record, display, and browse Event Tracing for Windows (ETW) log files in a WPF user-interface format.
  • Visual Profiler. Use this tool for profiling the use of WPF services, such as layout and event handling, by elements in the visual tree.
  • Working Set Analyzer. Use this tool for analyzing the working set characteristics of your application.
  • I also feel the need to plug the best visualizer out there, Mole!

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    wpf

    Training

    E-mail | Kick it! | DZone it! | del.icio.us
    Permalink | Comments (0) | Post RSSRSS comment feed

    Developer Highway Code

    by chris 20. December 2007 13:47

    Microsoft has published a revised edition of Developer Highway Code and made it available as a free ebook. Here's the synopsis.

    To build software that meets your security objectives, you must integrate security activities into your software development lifecycle. This handbook captures and summarises the key security engineering activities that should be an integral part of your software development processes.

    These security engineering activities have been developed by Microsoft patterns & practices to build on, refine and extend core lifecycle activities with a set of security-specific activities. These include identifying security objectives, applying design guidelines for security, threat modelling, security architecture and design reviews, security code reviews and security deployment reviews.

    The best part is you get entered into a free drawing to win a copy of Vista Ultimate, just for downloading a free ebook.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    ebook, security

    Training

    E-mail | Kick it! | DZone it! | del.icio.us
    Permalink | Comments (0) | Post RSSRSS comment feed

    Visual Studio 2008 and .NET Framework 3.5 Training Kit

    by chris 15. December 2007 13:38
    By now you've attended an InstallFest and picked up a free copy of Visual Studio 2008 Pro, or perhaps you've just downloaded trial edition. Either way, it's time to get up to speed using the free Visual Studio 2008 and .NET Framework 3.5 Training Kit. It covers many of the new features in LINQ, C# 3.0, AJAX, WCF, WPF, and Silverlight.

    Be the first to rate this post

    • Currently 0/5 Stars.
    • 1
    • 2
    • 3
    • 4
    • 5

    download, vs2008

    Training

    E-mail | Kick it! | DZone it! | del.icio.us
    Permalink | Comments (0) | Post RSSRSS comment feed

    Powered by BlogEngine.NET 1.3.1.0
    Theme by Mads Kristensen

    About the author

    Chris Eargle Chris Eargle
    Enterprise .NET developer in Columbia, SC.

    E-mail me Send mail

    Calendar

    <<  August 2008  >>
    MoTuWeThFrSaSu
    28293031123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    View posts in large calendar

    Pages

      Recent posts

      • Create Vista Icons in VS 2008Comments: 0Rating: 0 / 0
      • String to StreamComments: 0Rating: 0 / 0
      • Hung Database RestoreComments: 0Rating: 0 / 0
      • MSI Compilation ErrorComments: 0Rating: 0 / 0
      • Moving Parts and TimeoutsComments: 0Rating: 0 / 0
      • C# 3.0 PresentationComments: 1Rating: 0 / 0
      • Augusta Meeting TonightComments: 0Rating: 5 / 3
      • WCF 3.5 Security GuidelinesComments: 0Rating: 0 / 0
      • .NET 3.5 Enhancements Training KitComments: 0Rating: 0 / 0
      • Sessions GaloreComments: 1Rating: 0 / 0

      Recent comments

      • C# 3.0 Presentation (1)
        vijay wrote: Good post Thanks, Vijay [More]
      • Format Solution (4)
        Joe wrote: I added a couple of lines to FormatProjectItem() t… [More]
      • Sessions Galore (1)
        Lou wrote: I'll have to get you down here soon - I'll e-mail … [More]
      • Redeemed (3)
        Fred Beiderbecke wrote: It wasn't you, it was some of the others in the ro… [More]
      • South Florida Code Camp (1)
        Jason Meridth wrote: You've mentioned the only latest difference betwee… [More]
      • Redeemed (3)
        Chris Eargle wrote: Hmm, the only thing derisive I remember saying abo… [More]
      • Redeemed (3)
        Fred Beiderbecke wrote: I was in the afternoon session and enjoyed it (exc… [More]
      • Format Solution (4)
        Tony Evans wrote: Just what I was looking for. Thanks! :o) [More]
      • XML Nugget of Joy (2)
        Chris Eargle wrote: How do you retrieve the description, and in what c… [More]
      • XML Nugget of Joy (2)
        Wesley Wilson wrote: That's pretty neat. I've just started using attrib… [More]

      Archive

      • 2008
        • August (3)
        • July (1)
        • June (1)
        • April (4)
        • March (1)
        • February (4)
        • January (5)
      • 2007
        • December (5)
        • November (1)
        • October (6)
        • September (3)
        • August (1)
        • June (1)

      Authors

      • RSS feed for chrischris (36)

      Tags

      • activex
      • addin
      • ado.net data services
      • ajax
      • architecture
      • astoria
      • beta
      • c#
      • code camp
      • com
      • consolas
      • continuous integration
      • ctp
      • database
      • deployment
      • design
      • download
      • ebook
      • entity
      • expression blend
      • font
      • framework
      • gadget
      • grid
      • guidelines
      • icon
      • lamdba
      • linq
      • macro
      • msbuild
      • msi
      • mvc
      • powertoy
      • preview
      • ray ozzie
      • regasm
      • security
      • serialization
      • silverlight
      • source code
      • sql server
      • starter kit
      • stream
      • string
      • trial
      • usability
      • ux
      • vbscript
      • vista
      • visual studio
      • vs2008
      • wcf
      • web
      • winforms
      • wpf
      • xml

      Categories

      • RSS feed for Bleeding EdgeBleeding Edge (3)
      • RSS feed for GeneralGeneral (1)
      • RSS feed for KodefuKodefu (8)
      • RSS feed for Path NotesPath Notes (6)
      • RSS feed for PresentationPresentation (2)
      • RSS feed for TechniquesTechniques (2)
      • RSS feed for TrainingTraining (5)
      • RSS feed for WeaponsWeapons (4)
      • RSS feed for ZenZen (4)

      Archive

      Blogroll

      • RSS feed for Structure Too BigStructure Too Big
        • MSDN Event Thursday in...
        • WorldMaps Update
        • ASP.NET University!
      • RSS feed for Chris CraftChris Craft
        • Pimp My Phone – D...
        • Pimp My Phone – D...
        • Pimp My Phone – D...
      Download OPML file OPML

      Disclaimer

      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2008

      Sign in