Another excuse, I had my wisdom tooth extracted, or I could solve them(rev) all.
WarmUp
Obviously, it’s a C program which was compacted to one line with some #define
.
After formatted, it looks like:
|
It just do some calculate then ouput the flag, but it took lots of time.I found that function l
and function g
, they are basically doing nothing.I deleted the function l
, g
,and local variables int m = 1811939329, N = 1, t[1 << 26] = {2}, a, * p, i, e = 73421233, s, c, U = 1;
,after compilation & execution, the flag popped out immediately.
Baby C
This binary was obfuscated by movfuscator, and it’s my first time to solve such challenge, so that I did not realize that this was obfuscated at first time……
Using gdb
, I found that uses sigaction
to register callback function for SIGSEGV
, SIGILL
, then the binary will try to trigger them by accessing invalid address, so the binary can jump into libc to execute strncmp
to compare that wether the input[3:14]
equals to m0vfu3c4t0r!
or not.
I used demovfuscator to deobfuscate the binary, but there were still so much mov
in binary. I thought the description of challenge, This babyc needed swaddling!,means that it used movfuscator more than one time,but I was wrong….
Since the tool is still in development phase, I only used the function to generate flow chat.
(You can solve this challenge without any deobfuscator, it’s not so hard)
Before every branch, the corresponding char would show up many times. So I got the flag.
Echo
Putting it into IDA, I realized that this is actually a brainfuck interpretor.And I found a flag
string in binary.
Also, I found the brainfuck hard coded in this binary by gdb
:
>>[<+<+>>-]<<[->>+<<]>[>>>>>+<<<<<-]<>>>[<<+<+>>>-]<<<[->>>+<<<]>[>>>>>>+<<<<<<-]<>>>>[<<<+<+>>>>-]<<<<[->>>>+<<<<]>[>>>>>>>+<<<<<<<-]<>>>>>[<<<<+<+>>>>>-]<<<<<[->>>>>+<<<<<]>[>>>>>>>>+<<<<<<<<-]<>>[<+<+>>-]<<[->>+<<]>[>>>>>>>>>+<<<<<<<<<-]<>>>[<<+<+>>>-]<<<[->>>+<<<]>[>>>>>>>>>>+<<<<<<<<<<-]<>>>>[<<<+<+>>>>-]<<<<[->>>>+<<<<]>[>>>>>>>>>>>+<<<<<<<<<<<-]<>>>>>[<<<<+<+>>>>>-]<<<<<[->>>>>+<<<<<]>[>>>>>>>>>>>>+<<<<<<<<<<<<-]<>>[<+<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<<+<+>>>>-]<<<<[->>>>+<<<<]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<-]<>>>>>[<<<<+<+>>>>>-]<<<<<[->>>>>+<<<<<]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]<>>[<+<+>>-]<<[->>+<<]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]<>>>[<<+<+>>>-]<<<[->>>+<<<]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]<>>>>>>>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]><<<<<<<<<<<<<<<<<<<<<<<<<,[.,] |
It’s not so hard to find out that this brainfuck code will decode the flag
in binary, and there is a loop [.,]
to implement echo
in the end.
This part is trap, the brainfuck code [+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]>[+]
is equivalent to:
while( *char ){ |
It set the chars in flag
to 0
, remove it to get the flag.
Density
It just use some rule to expand the original input(with random string), then encoded them with base 64.
Left or Right?
There were so much Rust reverseing challenge recently…
I am still too slow to analyze such program.
They are not so hard ・゜・(PД`q。)・ ゜・
Blame on my wisdom teeth.