Ok, so there are multiple strings defined, 'sex', 'secr', 'et', 'god', 'love'. The binary than prints the password prompt and saves the user's input into [s1] as can be seen on the instruction mov byte [s1] al. It then pushes s1 and s2 on the stack and calls strcmp on those two strings. If they match (aka. text eax, eax sets the zero flag) than a shell is spawned. And between all the strings in the start, the one pushed to [s2] s2 is sex, nice. (ougahZi8Ta)
.text
main:
add esp, 0x10
test eax, eax
je 0x80485a8
sub esp, 0xc
push str.You_cant_have_that_file... ; 0x80486b9 ; "You cant have that file..." ; const char *s
call sym.imp.puts ; int puts(const char *s)
add esp, 0x10
mov eax, 1
jmp 0x80485fa
mov eax, dword [ebx + 4]
add eax, 4
mov eax, dword [eax]
push eax
push str.bin_cat__s ; 0x80486d4 ; "/bin/cat %s" ; const char *format
push 0x1ff ; 511 ; size_t size
lea eax, [string]
pop ebx
pop ebp
lea esp, [ecx - 4]
ret
The program asks the user for the input of a filename and then runs /bin/cat %s using the system function call. We can inject any command we want by separating the filename with ; . We can simply create a file with the name '; sh' and run printfile. Bada Bing Bada Boom, we have a shell.(Ahdiemoo1j)