When compiling the challenge binary using the following incorrect assembly code, the /challenge/check/ mistakenly tells the user their solution is correct, even though the binary never prints the flag.
challenge.s assembly file
mov BYTE PTR [rsp], '/'
mov BYTE PTR [rsp+1], 'f'
mov BYTE PTR [rsp+2], 'l'
mov BYTE PTR [rsp+3], 'a'
mov BYTE PTR [rsp+4], 'g'
mov BYTE PTR [rsp+5], 0
mov rdi, [rsp] # this should be rsp, not [rsp], as open expects a pointer
mov rsi, 0
mov rax, 2
syscall
Output from /challenge/check
ubuntu@hello-hackers~hardcoding-the-filename:~$ as challenge.s -o challenge.o; ld challenge.o -o challenge; /challenge/check challenge
/nix/store/v9zpzmigqkcjrw1jpf0zjc49y47cm55s-binutils-2.44/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000401000
Checking the assembly code...
Your assembly looks correct!
Let's run your program and see if it can read the flag!
hacker@hello-hackers~hardcoding-the-filename:/home/hacker$ challenge
hacker@hello-hackers~hardcoding-the-filename:/home/hacker$ echo $?
42
hacker@hello-hackers~hardcoding-the-filename:/home/hacker$
Your program opened, read, and wrote the flag!
When compiling the challenge binary using the following incorrect assembly code, the
/challenge/check/mistakenly tells the user their solution is correct, even though the binary never prints the flag.challenge.sassembly fileOutput from
/challenge/check