我有一个 .NET 应用程序
和一个 .NET Windows 服务
。如何在两者之间建立安全通信通道?
Internet 上的大多数人建议使用 命名管道。但这似乎可能会在系统中造成一个很大的安全漏洞。如果有人对我的应用程序进行逆向工程,他就会知道我使用的管道名称和协议,这允许他连接到我的服务并做任何他想做的事情。
示例:我的客户端安装我的应用程序并授予其安装服务的完全权限。然后他下载了一些其他软件,并且没有授予其完全权限。但该软件找到了我的服务并利用管道名称和逆向工程协议来利用它。
那么如何设计安全的通信通道呢?该服务能否以某种方式访问刚刚连接到其管道的程序(以便我可以比较其哈希值,前提是该服务已安装到安全位置)?或者也许使用不同的IPC? Microsoft 如何确保自己的服务免受此安全漏洞的影响?
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?
发布评论
评论(2)
您只需为命名管道设置一个安全描述符,以便只有您的客户端代码可以访问它。
详细信息位于:
http://msdn.microsoft。 com/en-us/library/windows/desktop/aa365600%28v=vs.85%29.aspx
You just need to set up a security descriptor for your named pipe, so that only your client-side code can access it.
Details are here:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365600%28v=vs.85%29.aspx
我会看一下加密协议,例如 RSA 加密算法。您使用什么传输协议(管道、TCP/IP、消息等)并不重要。其中任何一个都可以以某种方式“阅读”。
在你的情况下,我会使用一些网络协议(TCP/IP、UDP)来免费获得将来的可扩展性功能。以这种方式,客户端和服务器端可以位于不同的PC/平台上。但很多事情取决于要求。为什么你实际上需要保护这些东西,应该保护哪些数据(可能存在更简单的方法来为其他人检索它),数据量,其他?
I'd take a look at encrypting protocol with e.g. RSA encryption algo. And it doesn't matter what transfer protocol you are using (pipes, TCP/IP, messages, etc.). Any of them could be "read" in some way.
In your case I'd use some network protocol (TCP/IP, UDP) to have scalability feature for free in future. Client and server side could be on different PCs/platform in such way. But a lot of things depends on requirements. Why do you actually need to secure this things, what data should be secured (probably it is easier ways to retrieve it for others exists), amount of data, others?