Live data from Hacker News

Named Pipes in .NET 6 with Tray Icon and Service

erikengberg.com

11–20 of 54 posts

Re: Named Pipes in .NET 6 with Tray Icon and Service

#11
post #4
post #2

Named pipes have been in Windows for many years https://docs.microsoft.com/en-us/windows/win32/api/winbase/n...

First thing I do with SQL Server setups - turn off named pipes :)

Is there a reason you do this? Curious, I havent had to setup SQL Server myself in a while so I don't know what a reasonable reason would be.

Re: Named Pipes in .NET 6 with Tray Icon and Service

#13
I think this is the first NamedPipes tutorial in C# that I've ever seen that doesn't do things completely wrong by using a StreamWriter or StreamReader. Of course, that's because it uses another library that wraps all the tricky bits of NamedPipes that everybody always does wrong -> https://github.com/HavenDV/H.Pipes

NamedPipes are sweet for doing same-machine IPC on Windows, that is for sure, but the built-in API is full of footguns.

Re: Named Pipes in .NET 6 with Tray Icon and Service

#16
post #4

Earlier quoted context omitted.

First thing I do with SQL Server setups - turn off named pipes :)

Is there a reason you do this? Curious, I havent had to setup SQL Server myself in a while so I don't know what a reasonable reason would be.

Named pipes are fast when the database is on the same box, but slower than a normal tcp connection when the database is remote. Something to do with PeekNamedPipe calls having to prepend reads.

Re: Named Pipes in .NET 6 with Tray Icon and Service

#17
Good article, but I wish the author would've addressed securing these named pipes.

Consider that if a user-mode application can send messages to a privileged process (like a Windows service).

What prevents any user-mode application from doing that? And if your Windows service is running as "NT_AUTHORITY/SYSTEM" and even executes privileged commands, well you might find you've got a simple privilege escalation vuln.

Remember, secure your named pipes...especially when the named pipe server runs as SYSTEM.

- https://stackoverflow.com/a/59983266

- https://versprite.com/blog/security-research/vulnerable-name...

Re: Named Pipes in .NET 6 with Tray Icon and Service

#18
post #2

Named pipes have been in Windows for many years https://docs.microsoft.com/en-us/windows/win32/api/winbase/n...

Been using them since 1992 but at this point I would naturally turn to sockets, even on the same machine. I can't even really say why though. Named pipes are nice because they are really more like a file but at this point sockets feel more natural because they exist and are supported everywhere.

Re: Named Pipes in .NET 6 with Tray Icon and Service

#19

Earlier quoted context omitted.

Pretty sure there isn't anything you can't do in Jetbrains Rider EAP. Edit: would like to know why I'm being downvoted.

Hot reload in Rider only works in debug mode on Windows (to be clear it also works in nondebug sessions on Windows). On Mac trying to use Hot Reload with Rider on a nondebug session errors out, so it’s not 100% yet.

But the article doesn't require hot reload to achieve the goal right?

Re: Named Pipes in .NET 6 with Tray Icon and Service

#20
post #17

Good article, but I wish the author would've addressed securing these named pipes. Consider that if a user-mode application can send messages to a privileged process (like a Windows service). What prevents any user-mode application from doing that? And if your Windows service is running as "NT_AUTHORITY/SYSTEM" and even executes privileged commands, well you might find you've got a simple privilege escalation vuln. R…

I think the package he used, also has some kind of pipe authorization access control.
Post reply on HN