home *** CD-ROM | disk | FTP | other *** search
- SOLUTION FOR WIN32CM2.EXE
- by the_dux (8th July 2001)
-
- The Solution
- ============
-
- Well, fire up the program, this time we'll learn sth i've never
- heard to be used as a protection scheme.
- Let's fire up also our preferred disassembler and play with
- the executable.
- Now we can start to search the protection scheme. If you simply
- run the program you'll see a nice dialog box with an edit control
- with the string 'Unregistered' in it.
- Now we can look at the dead listing and search for a function that
- open a key file or sth similar but we soon fall into the section
- where strings 'I Am Registered' and 'Registered' are pushed to be
- used.
- Without going on with the code, i can say the protection is like
- this:
-
- -) the crackme register a new code for a new and reserved windows
- message (with a call to RegisterWindowMessage, see the msdn for
- further details).
-
- -) after this the crackme go to sleep and wait you for the message
- with that ID and with the parameter (wParam) pointing to a ATOM
- ID created with GlobalAddAtom that contain the string 'I Am
- Registered'.
-
- -) if the program receive the message ID it call GlobalGetAtomName
- to retrieve the atom pointed by wParam and compare it (with a
- simple call to lstrcmpiA) with the above string ('I Am Registered').
-
- -) if it match it will push to the edit box the string 'Registered'.
-
- Nice protection...
- Now, how to send the message to the window?
- Nothing more easy. Compile and run this little baby:
-
- ; ------------------- CUT HERE ----------------------
- ; call it sendmsg.asm or whatever you want
- ; this is to send a specific message to our crackme
- ; (not only to it as you can see below)
- ; compile with:
- ; tasm32 /ml sendmsg.asm
- ; tlink32 -Tpe -aa sendmsg,,,import32
-
- .386p
- .model flat, stdcall
-
- ; This is because i don't want to include a .inc file...
- extrn FindWindowA: PROC
- extrn SendMessageA: PROC
- extrn ExitProcess: PROC
- extrn GlobalAddAtomA: PROC
- extrn GlobalDeleteAtom: PROC
-
- NULL equ 0
- HWND_BROADCAST equ -1
-
- .data
- RegMsg db 'I Am Registered',0 ; the string to be sent
- AtomRef dd 0 ; atom ID to be sent
-
- .code
- start:
- push offset RegMsg
- call GlobalAddAtomA
- mov AtomRef, eax
-
- push NULL
- push eax
- ; here we push the ID of the new message registered by the
- ; crackme. This is the one seen on my machine, maybe yours
- ; will be different. To catch it simply put a breakpoint
- ; on RegisterWindowMessage and see the result in eax. That
- ; is the value to push here.
- ; If you want you could also code a DLL or even a VxD to
- ; let our program know the value for each system.
- push 0C903
- push HWND_BROADCAST ; with this we send the msg
- ; to all the opened windows
- ; even the minimized and
- ; hided ones.
- call SendMessage ; could be also call PostMessage
-
- push AtomRef
- call GlobalDeleteAtom ; just to free 15 bytes of mem
-
- push NULL
- call ExitProcess ; work done...
- end start
-
- ; ------------------- CUT HERE ----------------------
-
- Now you have seen a nice protection scheme. This could be a
- really interesting protection if improved...
-
- the_dux (the_dux[AT]bigfoot[DOT]com )
-