A brief write-up of the intended solution of P1ayground challenge from InCTF Internationals 2020
tl;dr
- Challenge is based on function hooking at runtime.
- On reversing you will find 4 functions at the same address but executing different code(basically hooked at runtime).
- Jump inside each function, reverse the algorithms to pass the checks.
- Ignore the FAKE flag check.
Challenge Points: 979
Challenge Solves: 10
Challenge Author: leArner
Challenge description
Initial Analysis
In this challenge, we are given a PE32+ executable for windows. Running the file at first looks like it does nothing.
The first check is of flag format and length of the flag.
On further reversing we will find 4 functions at the same address but executing different code.
- The input is encoded using a square cipher of 8x8 matrix.
- Then the string is xored and this string is converted to one hot encoding using the index value form [a-z]
- The one hot encoding of each character is considered as binary number and converted to integer then compared with a stored array.
- Both the previous checks is validated using a
check
variable.
If the
check
variable is correct then the input is correct.
1 | in_array = [4194304 ,16384 ,2 ,262144 ,8192 ,1 ,2048 ,64 ,65536 ,256 ,524288 ,33554432 ,262144 ,32768 ,65536 ,33554432 ,4096 ,2048 ,512 ,16384 ,32 ,512 ,256 ,16384 ,65536 ,2097152 ,524288 ,262144 ,128 ,8388608 ,2048 ,32768 ,8 ,64 ,8192 ,262144 ,1024 ,512 ,8192 ,32 ,8192 ,65536 ,4194304 ,8 ,16 ,32 ,512 ,65536 ,1 ,33554432 ,16777216 ,32768 ,262144 ,8388608 ,8192 ,2097152] |
Flag
inctf{H3y_w0W_Y0u_Manag3d_t0_Exr4ct_th3_CruX_0f_th1s_Cha1leng3}