News for hackers. Stuff that matters.
Re:Named Pipes in .NET 6 with Tray Icon and Service by ww520 on Tuesday November 23, 2021 @12:17PM (#29320391)
Good to address the security aspects of named pipe. However none of those describes how to secure the server.

The server needs to call ImpersonateNamedPipeClient() on the incoming client connection to assume the client’s security token, that would lower the server’s privilege to the level of the client. That’s it!

A guest level client can connect to the server. The server’s privilege becomes guest, and cannot access any resources that guest has no permission to access.

[1] https://docs.microsoft.com/en-us/windows/win32/api/namedpipe...

Re:Named Pipes in .NET 6 with Tray Icon and Service by munchler on Tuesday November 23, 2021 @12:21PM (#29320436)
FWIW, the project in the article is explicitly intended to allow privilege elevation: "You have an application which runs in user context, without any administrative rights, and you need to perform some tasks which requires higher privileges."
Re:Named Pipes in .NET 6 with Tray Icon and Service by ww520 on Tuesday November 23, 2021 @01:11PM (#29321072)
The server can do whatever it needs to do in its higher privilege. Just when it interacts with the client connection, it lowers its privilege to the client's level. It gets the incoming data, sanitizes it, and reverts back to higher privilege to do the work. This minimizes the attack surface to the area dealing with client interaction, not the whole server. The server might link in a 3rd party XML library to sanitizes the incoming data and you don't know what the library can do. Running that in the client privilege level ensures that whatever it does only under the client's privilege.
Re:Named Pipes in .NET 6 with Tray Icon and Service by monocasa on Tuesday November 23, 2021 @01:23PM (#29321213)
That thread still has higher privilege write access to it's process's state, including the stacks of other threads that haven't impersonated that client. ImpersonateNamedPipeClient is a very leaky security barrier, and far from the only thing you need to know about when it comes to named pipe security.