📄 BrainStuffer
FD Table Simulator
Call open(), pipe(), dup2(), close() and watch the descriptor table update live
Process File Descriptor Table
FDTypePath / DeviceMode
Operation
filename
mode
oldfd
newfd
Creates a unidirectional pipe and assigns the next two free FDs.
fd
Scenarios
strace log

Key insight (pwnable.kr input2):
To supply controlled data to a program's read(0, buf, n) (reading from stdin), create a pipe(), then dup2(pipefd[0], 0) — this makes FD 0 point to the pipe's read end instead of the terminal. Now anything written to pipefd[1] arrives as the process's stdin. Afterwards close() both original pipe FDs to avoid leaking them. The same pattern redirects stdout (dup2(fd, 1)) or stderr (dup2(fd, 2)).

← Back to Interactive Learning