Reverse Engineering

Challenge
Link

WARMUP (244 pts)

OXYGEN (481 pts)

WARMUP (244 pts)

Description

-

Solution

Given PE file, open it using IDA.

We can see on main function most of the function called looks like "stripped". If we take a look on one of those called functions (sub_140004d60) we can see that it looks like statically compiled then stripped.

To recover the function name i did debugging then analyze the input and output. After knowing what the function do i rename the function name to make it easier to understand.

  • Program validate if input has preifx ASCIS and suffix }

  • Split value wrapped by ASCIS by -

    • There must be 6 value after splitted

  • Each index on splitted value will be processed with several operation like xor, add, rc4, and substraction

Because all operation are reversible, we just need to reverse the operation and leak value index by index to get the flag.

  1. Get flag5

  2. Get flag4 because we know flag5

  3. Get flag2 and flag3 because we know flag4 and flag5

  4. Get flag1 because we know flag2

  5. Get flag0 because we know flag3

Here is my solver

Flag: ASCIS{829872-bccd38-3e2960-783f8d-63d824-32bc76}

OXYGEN (481 pts)

Description

-

Solution

Given PE file, open it using IDA. IDA can't detect main function but there is start function.

Analyzing start function i can't find "main" function, so i tried to look at available strings.

Go to address for each reference, we will find out that the main function is sub_7FF61CE8D7A0.

There is something weird on decompiled code (sub_7FF61CE8B8E0).

Through trial and error i found the solution, we can just put change the second call to nop then decompile again.

  • Program will listening at port 1337

  • If there is connection, it will print "gimmy oxygen!"

    • Program will receive our input and call function unk_14002D000

    • if function unk_14002D000 return 1, it will call sub_1400114C9 (RC4)

From above analysis we can conclude that we need to find input that return 1 for function unk_14002D000. At first i tried to disassemble unk_14002D000 and it looks like not a valid assembly.

So lets take a look on cross reference.

Looks like it just basic xor, use idapython to automatically patch the values.

Now it looks like valid assembly, lets decompile the code and rename known variables.

  • v9 = input - target

    • target[v9] == target + input - target

    • target[v9] == input

  • if counter is odd, substract

  • if counter is even, add

Now, lets write the script to bruteforce valid input.

Finally put the generated key to the service.

Flag: ASCIS{W3_g0nn4_m33t_4t_th3_f1naL_r0uND}

Last updated