WCF Named Pipe Security and Multiple User Sessions?

.net, named-pipes, wcf

Solution

Named pipes in WCF are not accessible from the network and no encryption is required to secure them. However, WCF services are not secure against the attack mentioned by romkyns.

I suggest you read this posts:

Exploring the WCF Named Pipe Binding - Part 1

Exploring the WCF Named Pipe Binding - Part 2

Exploring the WCF Named Pipe Binding - Part 3

Exploring the WCF Named Pipe Binding - Part 4

about the security problems involved.

In short WCF allows ANY process to masquerade itself as the service and:

- Either simulate the service OR

- Eavesdrop and tamper data assuming that the rogue process itself connect to the service. However, if the service uses access security to check the identity of the calling user this may not be possible.

Problem

I have setup a WPF application that is single instance using a Mutex, this allows for the application to run within each user account if you are using user switching. The application sets up a WCF named pipe so that I can communicate to the single instance from another process (i.e. when the second process runs before it terminates due to the Mutex). I would like to know if anything should be done (best practices) to secure the named pipe? Also I would like to know if the named pipe messages would reach all running processes within the system or only within current user session. If the named pipe is sent system wide then what would be the best implmentation to restrict the communication to the current users session?

Original source