RicknMorty
Rick has been captured by the council of ricks and in this dimension Morty has to save him, the chamber holding Rick needs a key . Can you help him find the key?
Analysis
First, let's see what running the program does.

There's nothing particularly clear here, so let's disassemble it in GHidra.
It looks very complicated, but we can ignore the bulk of it. What we need to focus on is the random number generation and what happens to it.
Two random numbers are generated. They are passed into function1, then we +3 to the result and pass it through function2. The result of that is then compared with the number we input. If they are not the same, the check is set to 0.
At the end, if it's not 1 (and if takes under 30 seconds) the flag is read. So clearly we have to receive the numbers, work out what it does and then return the values (repeatedly) to get the flag.
Let's check what the two functions do.
function1
We have a counter that loops until it is greater than a number; if both numbers are divisible by the counter the answer gets set to counter - this is clearly some sort of highest common factor function.
function2
This looks like a weird function, but if you write it in, say, python, it's much clearer what it does:
This is a factorial function.
Now we know what it does, the flow is simple:
And we can write a script that does this for us.
Solution
Flag: csictf{h3_7u2n3d_h1m531f_1n70_4_p1ck13}
Last updated
Was this helpful?