Challenge : SimpleMachine
Description :
(fixed-point challenge)
Classic Check Flag Challenge Machine
DOWNLOAD :
http://ctf.codegate.org/099ef54feeff0c4e7c2e4c7dfd7deb6e/116ea16dbeabe08d1fe8891a27d0f16b
point : 333
- Reverse Engineering.
- The basic of code virtualization technique.
- HxD
- IDA 7.0
- gdb-peda
- Notice that
simple_machine
is ELF file andtarget
is data. - Open
simple_machine
with IDA 7.0, analyze, and generate some pseudo-codes.-
- pseudo-code of
main
function. - Usage:
./simple_machine target
- There is a limitation to the length of target.
- It uses code virtualization technique.
- We can assume that
target
is a kind of virtualized code script.
- pseudo-code of
-
- pseudo-code of
vm_func
function. - There is a control function.
- pseudo-code of
-
- pseudo-code of
control_func
function. - Fetch and decode operations from
target
.
- pseudo-code of
-
- Based on
control_func
function, set breakpoint on and debug it.-
- Run
gdb-peda ./simple_machine
andb *0x80017ca
(Entry point ofcontrol_func
). - Debug and understand how the program works.
- Run
-
- First operation is getting input from
stdin
. - 6
ADD-CHECK
chain operations are checking if first 12 characters of input areCODEGATE2020
. - Next 32 operations are generating 12 hashes, calculating XOR with input, and checking if is zero.
- if all check is passed, print
GOOD!
tostdout
. - Last operation is just exiting the program.
- First operation is getting input from
-
- Write and execute python script to get flag.
CODEGATE2020{ezpz_but_1t_1s_pr3t3xt}