I have a .NET application
and a .NET Windows Service
. How can I establish a secure communication channel between these two?
Most folks on the Internet recommend communicating with Windows Services using Named Pipes. But it seems this might create a big security hole in the system. If some dude reverse engineers my application, he will know the pipe name and the protocol I use, and that allows him to connect to my service and do whatever he wants.
Example: My client installs my application and gives it full privileges to install the service. Then he downloads some other software and does not give it full privileges. But that software finds my service and exploits it, using the pipe name and reverse engineered protocol.
So how to design a secure communication channel? Can the service somehow access the program that just connected to its pipe (so that I can compare its hash, provided the service has been installed to a secure location)? Or maybe use a different IPC? How does Microsoft secure his own services against this security hole?