WinZip 8.0 - Messageboxby Ignatz of stoicForce Introduction
Hi, Needful things
Winzip 8.0 Looking for information
First of all we want to know as much as possible about our target. therefor we start the filemonitor and check what interesting registry entries we find. we soon come across these two: :00407AA3 lea eax, dword ptr [ebp+FFFFFEC0] ~serial stored here :00407AA9 push esi ~means easy sniff :00407AAA push eax :00407AAB call 004692D0 ~checking call :00407AB0 add esp, 00000010 :00407AB3 neg eax :00407AB5 sbb eax, eax :00407AB7 inc eax :00407AB8 mov dword ptr [00489FDC], eax :00407ABD jne 00407B27 ~deciding jump :00407AC0 lea eax, dword ptr [ebp+FFFFFEC0] ~will be replaced by a call you will soon find out that this jump has to be taken in order to avoid the nag and look like regged. to patch this program you´d just have to make sure that the call is always taken (or just enter the serial) . but i don´t want to show you how to patch it this way, rather how to make a nice messagebox improvement using some free space in the program itself to display the correct serial. the nice thing about it is that we don´t have to write our own keygen. Messagbox enhancement
As you can see you always get a messagebox at the end of a unsuccessful registration try. we could now use this box for displaying the serial but i want you to learn more like adding apicalls and stuff into an existing exefile. this will sure be useful if you want to write your own unpack-routine for a packed program or other stuff. Messagebox addon
The free space is easy to find. just scroll down a long way and you will find a section with all zeros. i decided to take this place for my message.
:00407AB8 mov dword ptr [00489FDC], eax :00407ABD jne 00407B27 ~deciding jump :00407ABF lea eax, dword ptr [ebp+FFFFFEC0] ~code to replace
i made it a call to the new code and ret back to the program, but you can also make two jumps instead. one to the new code and one back to the program. now let´s have a look what the code would look like in high lvel language:
Messagebox(0, Key, 'Your serial: ', MB_OK);
for asm we will first have a look at the API reference:
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);
this means the following to us. we have to push 4 values, the messagebox parameters, on the stack in the following order: uType first, then lCaption, lpText, and hWnd at last. MB_OK is 0 so we push a zero first. the hWnd is not interesting for us therefor we also push a zero at the end. the address of the serial is [ebp+FFFFFEC0] and the lpCaption will be provided by ourselves. we just have to write it into the file lets say at position 52C001. so it would now look like this in asm:
push 0 ; uType = MB_OK push 52C001 ; Caption sub ebp, 140 ; ebp+FFFFFEC0=ebp-140 push ebp ; serial add ebp, 140 ; restore value push 0 ; hWnd the last thing we now have to worry about is to execute the commands we repaced by making the call to our codesection. and do a ret. this will be all we have to do. take a look at the rest.
lea eax, [ebp+FFFFFEC0] ret done thats all so lets fire up hiew and do the neccessary adjustments. Finishing
Lets get going. go to the position at 52C001 (120001) and enter a string for the caption of the messagebox. like "here´s your serial". be sure to end the caption with 00 which marks the end of the string. now go to this position: 0052BFDE (11FFDE) here we will put our new code. all we still need is to know where the messagbox resides. therfor goto win32dasm and search for the string messagebox. you will soon find something like this
* Reference To: USER32.MessageBoxA, Ord:01BEh
|
:0040D54F FF1510744700 Call dword ptr [00477410]
now we also know how to call the messagebox. so lets enter the code in hiew.
you can take a look at my stuff from my hiew. that looks quite good already all now left to do is to change the lea after the jne to a call to our routine so the thing is not ignored. we can do this easily Last words
Thats it. this method will work very often if you are able to sniff the serial. memorize it since now your really doing some changes to the program not just a simple nop-out or stuff. | |
|
© 1999-2010 by the stoicForce | |