Skip to content

False positive feedback on Computing 101 / Output and Input / Hardcoding the Filename #274

Description

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions