I have a victim program (with a buffer overrun vulnerability): it uses gets() to write into a fixed-sized buffer.
Suppose I put shellcode into a file SC. Then I run
$ ./victim < SC Input your data: $
The reason the shellcode does not seem to work is this: SC is redirected to the victim, injects the shellcode, causes a shell to spawn, but the spawned shell finds its stdin is closed, so immediately exits.
expect for the injection, but
expect bombs after the shell spawns.
It seems like the only practical way is to get the shellcode into my mouse's paste buffer so I can inject it while retaining the keyboard as the input device. But I have no idea how to get binary data into my paste buffer.
Any ideas on how to get around this issue?