description: We had a flag, but lost it in a mess of alphabet soup! Can you help us find it? Connect to the server via nc c1.easyctf.com 12484.
hint: I love parsing characters!
category: Reverse Engineering
Okay, There is the source code in python:
Okay let’s first deobfuscate this SoupCode:
Alright so the principal method, will take the first 7 digits. Then the method second() will convert it to an int and the method third() will invert all digits (123 -> 321).
The goal is to enter in the if unhexlify(SouP) == attrgetter('encode')('s0up')():
We have:
And we want:
So, reversing it:
Just before we have:
This is only a conversion to hexa, and we want it to be egal to 73307570:
then soup = 1932555632
The program call second() and third() so all we have to do is to reverse this number:
We have Soup = 2365552391
The first line of the method limit our entry to 7 digits:
At this point you can try with the maximum ‘legit’ entry (9999999), u won’t be able to reach 2365552391…
Okay first I commented the code with the values we would like to get:
As u can see in the hint, there is characters that are interpreted as digit. let try to list some of them:
The result is:
0 1 2 3 4 5 6 7 8 9 ² ³ ¹ ٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ ۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ ߀ ߁ ߂ ߃ ߄ ߅ ߆ ߇ ߈ ߉ ० १ २ ३ ४ ५ ६ ७ ८ ९
Now let’s see what is the value for one os this entry:
Alright, as we can see, all numbers added after the special char will be before it after the second() and third() methods.
So we want something like (weird_char + 552391) in entry and that weird_char = 5632
Let’s brute force those values and see if the weird_char = 5632 exists:
Nice ! the ७ should make us win this challenge !
Lets try it directly on the server =)
nc c1.easyctf.com 12484
७552391
oh yay it’s a flag! easyctf{S0up_soup_soUP_sOuP_s0UP_S0up_s000000OOOOOOuuuuuuuuppPPppPPPp}
The flag is easyctf{S0up_soup_soUP_sOuP_s0UP_S0up_s000000OOOOOOuuuuuuuuppPPppPPPp} =)