I'm reverse engineering the CrackMe which is written on Managed C++/C#. Arguments are "string" (email in this case) and "serial". Serial is somehow depends on string and I need to understand how.
I used dnSpy to disassemble the program and found onClick function which begins the process of checking if the serial was right: button2_onClick
In the end of this function we can see a boolean function Check() which returns true
if the serial was right: Check()
As I'm new to reverse engineering (and especially to RE of .NET apps) so I need some explanations about the decompiled code we can see in these two functions:
1) What exactly does
md = <Module>.std.basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>.{ctor}(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>4, ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>2);
mean on line 25 of button2_onClick
? I understand that this is some type of assignment, but no more.
2) What these lines (14, 15 lines and so on, of Check()
) do?
*(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>2 + 16) = 0;
*(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>2 + 20) = 0;
3) What do the numbers (5, 6, 7 near the end of lines) mean?
<Module>.std.basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>._Tidy(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>5, true, 0u);
basic_string<char,std::char_traits<char>,std::allocator<char>\u0020> basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>6;
basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>* right2 = <Module>.md5(&basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>7, str);
4) Is it just a comparison of two strings in disguised form?
result =(<Module>.std.basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>.compare(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020>, 0u, (uint)(*(ref basic_string<char,std::char_traits<char>,std::allocator<char>\u0020> + 16)), ptr, count) == 0);
5)Maybe there's a easier way which I don't know to solve this crackme? I firstly tried to use IDA as always, but that wasn't really helpful in this case.