I've been following walkthroughs for various exploit exercises for linux applications. I understand the content of these well enough, however some refer to using cat to keep the pipe open, e.g. here.For example:(python2 exploit.py ; cat) | ./programToExploitWhat does keeping the pipe open actually mean in practice, and how is the pipe being kept open as with the command above?
What is meant by keeping the pipe open?
process;pipe;cat
Did you try it?See the difference betweenecho 'ls' | sh -sand( echo 'ls'; cat ) | sh -sHere, sh -s will start a shell session that reads commands to execute from standard input (-s).In the first example, the shell will simply execute ls and exit (since there's no more input).In the second example, the shell will execute ls and then wait until there's no more input.  The input stream to sh -s was first generated by the echo command, but then cat took over the role.  The cat process will read from the parent shell session and pass commands through the pipe to sh -s.  If you type ls, or any other commands (there will be no prompt to type it at), the shell will execute those commands.This will continue until you terminate the cat process by pressing Ctrl+D on an empty line to signal end of input.I believe that is what you mean by keeping the pipe open.