Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are pipes considered dangerous to use in Windows/unix/linux?

Why are pipes considered dangerous to use? What can be done to avoid these security issues?

I'm mostly interested in Windows, but if you have other OS information, please provide.

like image 799
Brian R. Bondy Avatar asked Oct 10 '08 15:10

Brian R. Bondy


People also ask

What is the purpose of the pipe in Unix Linux?

Pipe is used to combine two or more commands, and in this, the output of one command acts as input to another command, and this command's output may act as input to the next command and so on. It can also be visualized as a temporary connection between two or more commands/ programs/ processes.

Are Linux pipes secure?

It is the world's most popular server platform, after all. Thanks to the open-source nature of Linux, it is often considered far more secure than most alternatives, as any vulnerabilities usually are patched pretty quickly.

What is the difference of the pipe (|) command in Windows vs Linux?

One difference that I know of, is that named pipes under Linux are actual entries in the filesystem (you'll see it in a directory listing, they have a special type), whereas on Windows they are stored in some magical repository somewhere (they are all accessed via the path "\\. \pipe\".

What is Linux named pipe?

A FIFO, also known as a named pipe, is a special file similar to a pipe but with a name on the filesystem. Multiple processes can access this special file for reading and writing like any ordinary file. Thus, the name works only as a reference point for processes that need to use a name in the filesystem.


1 Answers

(assuming you're talking about Unix named pipes from the mention of 'c' and 'IPC'. Windows named pipes work somewhat differently)

Anyone with permissions can write to a named pipe, so you have to be careful with permissions and locking (see flock()). If an application trusts the input it's getting from the named pipe (which will usually be the case unless you explicitly build input validation into it) then a malicious user can write any desired data into the named pipe if they have permission.

Also, any user with permissions can read from the pipe and intercept data coming out of it if you have not exclusively locked it. The data is then missing from the input stream that the reader is expecting.

like image 147
ConcernedOfTunbridgeWells Avatar answered Sep 22 '22 10:09

ConcernedOfTunbridgeWells