I've been working on the exploit-exercises.com "protostar" distro. I'm currently baffled, as I'm getting a really weird error working on stack5.
I have verified that I successfully transfer control to my shellcode by using '\xcc' (SIGTRAP) opcodes at the beginning of my shellcode and testing it in GDB (I have now removed them).
To make it as simple as possible, the goal of my shellcode is to get the program to exit with a status of 1.
When I run it in GDB, it successfully triggers the exploit and exits with a code of 1. Yay!
...
But for some reason, when I quit GDB and try to run it in the shell, It gives me an 'Illegal instruction' interrupt and exits with a code of 132.
The shellcode that I'm using is: http://repo.shell-storm.org/shellcode/files/shellcode-470.php with the minor adjustment of zeroing out %eax and %ebx at the beginning to ensure that they are the proper value for the 0x80 syscall.
The command that I'm using to create my exploit file is:
perl -e 'print "A"x76 . "\x3a\xfd\xff\xbf" . "\x90"x20 . "\x33\xdb\x33\xc0\x40\x43\xcd\x80"' > stack5_exploit
Does anyone have an idea as to why running it inside GDB would result in different output?
I'm guessing it might have something to do with how the 0x80 interrupt is handled, but I have much more experience with Windows internals than Linux.