ReverseMe2 by Lena
This reverseme is written by Lena and is one of the classic reverseme’s used to learn reversing. Use this in conjunction with xAnalyzer plugin for x64dbg to practice serial key fishing.
Link: https://crackinglessons.com/reverseme2-by-lena/
Software
The software was only showing Evaluation Period is Out of Date message.
Detect It Easy (die)
Using DIE software I found the entry point.
EntryPoint = ImageBase + AddressOfEntryPoint --> 0x00401000
x32dbg
After opening x32dbg, I searched the string and found the address.
Before these commands, It was executing CreateFile command which was set to open only existing files and the file name was Keyfile.dat.
So I created that file.
However this time the app was showing another error Keyfile is not valid.
So I debugged it and found the part where it reads the file contents.
So code can be seen below:
push 0 | LPOVERLAPPED lpOverlapped = NULL
push reverseme2-by-lena.402173 | LPDWORD lpNumberOfBytesRead = 402173
push 46 | DWORD nNumberOfBytesToRead = 46
push reverseme2-by-lena.40211A | LPVOID lpBuffer = 40211A
push eax | HANDLE hFile
call <JMP.&ReadFile> | ReadFile
test eax,eax |
jne reverseme2-by-lena.4010B4 |
jmp reverseme2-by-lena.4010F7 |
xor ebx,ebx |
xor esi,esi |
cmp dword ptr ds:[402173],10 |
jl reverseme2-by-lena.4010F7 |
mov al,byte ptr ds:[ebx+40211A] |
cmp al,0 |
je reverseme2-by-lena.4010D3 |
cmp al,47 | 47:'G'
jne reverseme2-by-lena.4010D0 |
inc esi |
inc ebx |
jmp reverseme2-by-lena.4010C1 |
cmp esi,8 |
jl reverseme2-by-lena.4010F7 |
jmp reverseme2-by-lena.401205 |
This code simply does below things sequentially:
- it reads the file to a 46 byte buffer.
cmp dword ptr ds:[402173],10is used to check if the file includes a string longer then 16 character and if not it jumps to a place where wrong message is shown.
cmp al,0is used to check if file is empty and if it is it jumps.cmp al,47is used to check if file includesGcharacter and it counts them byinc esicommand.- When the loop finished (all characters are checked), it checks if there was more than 8 G using
cmp esi,8command. If there is, we simply jump to a good end.
So to sum the things up, I created a pseudo code for this part:
file = "Keyfile.dat"
if file not exists:
exit
content = read file
if content.length < 16:
exit
i = 0
g = 0
while (i < content.length):
if content[i] = null:
exit
if content[i] = 'G':
g++
i++
if g > 8:
good ending
So I updated Keyfile.dat to include 9 G characters.
And that was it.