Reverse Engineering

Challenge
Link

Secure Bank (100 pts)

Here

Phish Market Order Management (100 pts)

Here

TriForce Recon (100 pts)

Here

Funny (449 pts)

Funny (449 pts)

Description

What is this funny file? πŸ€ͺ

Solution

Given .pyc file, at first i tried to decompile using pycdc but it failed. After that i tried to use pycdas to show the opcode of compiled python.

Looking at above code we can see that there is 2 input processed (key and iv) and there is no value check. The check only for the length of IV and KEY, after that there will be check for the decrypted value which is the flag. So lets continue the analysis. Right after above code, there is a

There is key and iv also ciphertext (i_wonder_what_this_decrypts_to) in the code that can we use to do the decryption. It should be called but never printed, so lets construct by ourself.

Now come to the part that need us to guess what is the objective that the author want, by reading above text again by again i understand that we need to reconstruct the original code including the position (row and column). Before i got the objective i tried to do analysis on the variable initialized (a-z) and i found that all the values are 0 and the code only put the variable without doing nothing. Now, lets take a look on the opcode again

The code above that i said it does nothing. During the disassembling process of the pyc file using pycdas, i found there is option --pycode-extra and it will show Line Number Table like below

By trying to do the dis with our own code i found that Line Number table consist information about column and row, which is that all we need to solve this challenge. Below is my flow for solving the challenge.

For the IV just add the following code in the end

Last, just decrypt it.

Flag: INTIGRITI{y0u_7ruly_4r3_7h3_pyc_p4r51n6_m4573r}

Last updated