PicoCTF 2018 – Reverse Engineering - assembly 0
Objective:
What does asm0(0xb6,0xc6) return? Submit the flag as a
hexadecimal value (starting with '0x'). NOTE: Your submission for this question
will NOT be in the normal flag format. Source [1] located in the directory at /problems/assembly-0_0_5a220faedfaf4fbf26e6771960d4a359.
Hints:
(1)
basical assembly tutorial [2] (2) assembly registers [3]
Source:
.intel_syntax noprefix
.bits 32
.global asm0
asm0:
push ebp
mov ebp,esp
mov eax,DWORD PTR [ebp+0x8]
mov ebx,DWORD PTR [ebp+0xc]
mov eax,ebx
mov esp,ebp
pop ebp
ret
Solution:
So I spent about an
hour watching youtube videos to try and understand assembly language to get his
one.
Here is what I learned
This part
push ebp
mov ebp,esp
has to do with the stack pointers getting setup for the program
and really don’t mean a whole lot other than the stack is being created an this
is where the pointers are set.
The parts that actually matter to this solution are
mov ebx,DWORD PTR [ebp+0xc] – This is putting the 2nd variable in
to EBX which is 0xc6
mov eax,ebx -
this overwrites eax with ebx so now EAX is 0xc6
the next part of the assembly just kind of tears the program
down and this particular assembly will always return what is in EAX
so it should return 0xc6
Here is a great little youtube video that help break it down
that John Hammond already made
Comments
Post a Comment