Reversing.kr Easy Crackme Writeup
23 Dec 2018Environment
- Host OS: Kali linux 2018.4
- Guest OS: Windows 7 Service Pack 1
- Virtualization: Virtualbox 5.2.22
- Debugger: IDA Pro Free 5.0
Explanation
Reversing.kr is a website which has some of reverse engineering challenges. This is a write-up of Easy Crackme on that website.
Solution
1. Running the app
When we run the app, we have a small dialogue and textbox. As we put a rundom string and put the button, we have a message “Incorrect Password”. This is likely we have to identify what is the “Password” by reverse engineering.
2. Opening with IDA Pro
To analyze this application, we can open the app with IDA Pro. Since we can see this application retrieves the input data in the textarea, we can assume that “GetDlgItemText” Windows API is used. We can find it in a subprocess”sub_401080”.
3. Getting password
According to the manual of GetDlgItemText, we can find where is the memory location the input data was stored.
In this case, the value of lpString is esp+0x08
After calling the GetDlgItemTextA, we can express the address is esp+0x04 since each argument of GetDlgItemTextA is 1 byte. We can find 1st cmp instruction in the next line.
The address of input chars is esp+0x04 so this is comparing 2nd character of password and Ascii Character “a”. Under the 1st comparison, we can find 2nd one. At first, there is a instruction
This time, the address of input chars changes to esp+0x08.
This means, this strncmp is comparing “5y” and 3rd, 4th chars of input. Next, we can see this section.
After these 2 of push instruction, the address of input chars changes to exp+0x0C.
In eax, there is an address of 5th chars of input. Then, comparing [eax] and [esi] with dl and bl. After that, there 2 pop instructions Then, address of input chars goes to [esp+0x04]. Finally we can see there instructions.
We can figure out 1st character of the input should be Ascii Character “E”. According to these information, we can figure out the password is