|
|
|
|
|
|
|
|
|
|
||
|
||
|
|
There is a crack, a crack in everything. That's how the light gets in. |
|
|
Your asked to enter:
Your First,LastName
Company Name,
Address Line 1
Address Line 2
Serial Number
Password
before registration begins.
The actual password is based on the Serial
No, and it's the password that the program looks for each time it is run.
Unlike many programs, once you've registered the program it will store
your User details and the password itself at C:\Windows\wxr95.ini file
instead of in your registry file!.
This program is not compacted or encrypted
in anyway.
|
BPX messageboxA (If this program
runs in 32-bit then trap this 32-bit function)
BPX messagebox
(If this program runs in 16-bit then trap this 16-bit function)
Some people prefer to have Softice break during the actual creation of the target program's registration sequence by having Softice break on one of a number of system functions such as LSTCMP & LSTLEN but I much prefer to break after all of this for the following reasons.
1. It's much easier to visually back-track
the route the program took to arrive at the 'invalid password' message
box.
2. We can be almost certain that the program
has not yet had time to erase the memory location where it stores the 'real'
password it used to compare with our entered fake password.
Now type X to leave Softice and
press the 'OK' button so that Win eXpose can get on with checking the details
we've just typed into it.
Softice breaks at the start of the MessageboxA routine, from here press F11 once then answer 'OK' to the 'Invalid Password, please re-enter again' notice' and once gain, we're back into the target program's code.
We should see the following snippet of
code in Softice.
:004025A3 | CALL [USER32!MessageBoxA] |
:004025A9 | MOV BYTE PTR [EBP-04],00 ;We land here. |
:004025AD | CALL 00402750 |
:004025B2 | MOVE DWORD PTR [EBP-04],FFFFFFFF |
:004025B9 | CALL 00402762 |
:004025BE | MOV EAX,[EBP-0C] |
:004025C1 | POP EDI |
:004025C2 | MOV FS:[00000000],EAX |
:004025C8 | POP ESI |
:004025C9 | POP EBX |
:004025CA | MOV ESP,EBP |
:004025CC | POP EBP |
:004025CD | RET |
TEST ???,???
;test one register or address against another.
JZ or JNZ or JE, JG ????????
;If same,not the same,equals,greater then jump.
OR
CMP ???,???
;Compare one register or address against another.
JZ or JNZ or JE, JG ????????
;If same,not the same,equals,greater then jump.
What the above examples do is to check
two registers against each other then, depending on the outcome tells the
computer which section of the program's code to execute after this check
has been performed.
Right, lets scroll up Softice's Code Window and see if there is something that resembles any of the two examples shown up. Hey this looks interesting:-
:004024F7 | TEST EAX,EAX ;Look, We found a TEST & Condition jump! |
:004024F9 | JZ
004025CE ;If the result from the TEST is the same
;then we've entered the correct password ;so jump to memory location 004025CE ;and save this information to an .ini ;file.
;However, if the password is incorrect then
|
:004024FF | PUSH 0040A1A4 |
:00402504 | MOV ECX,0040A90 |
:00402509 | PUSH 0040A158 |
:0040250E | PUSH 0040A140 |
:00402513 | CALL 00406E40 |
:004025A3 | CALL [USER32!MessageBoxA] |
:004025A9 | MOV BYTE PTR [EBP-04],00 ;Display "Incorrect Password" |
:004025AD | CALL 00402750 |
:004025B2 | MOVE DWORD PTR [EBP-04],FFFFFFFF |
:004025B9 | CALL 00402762 |
:004025BE | MOV EAX,[EBP-0C] |
:004025C1 | POP EDI |
:004025C2 | MOV FS:[00000000],EAX |
:004025C8 | POP ESI |
:004025C9 | POP EBX |
:004025CA | MOV ESP,EBP |
:004025CC | POP EBP |
:004025CD | RET |
Now type:
BD 00
;This disables our previous breakpoint.
BPX 004024F9
;Creates a new Softice breakpoint on the JZ instruction.
X
;Exits Softice
Now press the 'OK' button so we
can once again run Win eXpose's registration process and almost right away
Softice breaks again and as expect it stops on the line that decides wether
or not to jump to a different memory location based on the results from
the TEST instruction.
If, while still within Softice we now press the F4 key we can see that the program has not yet created the 'Invalid Password' messagebox so we're pretty sure that the program has not yet checked our entered (fake) password with the real one it has created somewhere in memory. OK, press the F4 key once more to restore the Softice code screen.
The point where we have made Softice break is where the program is about to make a decision of some kind. Looking again at the code snippet above we can see that if it the program continues on it's course it will hit the CALL [User!messageboxA] routine where we know it will tell us that the password is incorrect. Hmmm, what we want to do it to make the program choose a different direction, one that is the opposite of 'Bad Password', perhaps to 'Good Password'!.
Lets us think a bit more here... Unless we've been extremely lucky, we know for a fact our password is incorrect, and here we have Softice telling us that at THIS POINT in the program that there will be 'NO JUMP', so therefore the program execution will continue on and hit the 'BAD PASSWORD' messagebox, not exactly what we're looking for.. So why not 'tell' Softice to still do this jump regardless of what the outcome of the TEST was.
Type into Softice:-
r eip=004025CE
What we've done is to manually tell Softice
that the next time we press the F10 key it will proceed at memory location
004025CE instead of continuing at the
next line below the JZ instruction.
The value 004025CE
was taken from the JZ instruction below the line with the TEST EAX,EAX.
OK, with that done press the X
key and Softice will let Win eXpose run as normal.
If you have followed the steps given above
Win eXpose should now be fully registered, you can test this out by exiting
Win eXpose completely then running it again. Check out the 'About
Win eXpose' dialog box to see your entered details and the fake Serial
No shown in this message box.
Most of the programs I've so far come
across don't save the 'real' serial number/password to a ini file when
you bypass the 'Beggar off' routine as this program does, instead it normally
saves the 'fake' information you have typed in, but this program automatically
'assumes' that if you get to the 'good guy' routine that
your password is correct and instead of saving the memory location of our
entered password ( in my case the fake password I originally used it saves
the one IT has created!. A cracker's dream crack!!.
If you now go into the C:\Windows directory and load into Notepad 'wxr95.ini' file you should see something like this:-
[Win-eXpose-Registry 95]
Name=The Sandman
Company=#
AddrLine1=#
AddrLine2=#
SerialNumber=7777777 ;My
fake serial number
Key=EXPREF062F05
;The password generated from the
;fake Serial Number I used!
Please don't use my Handle or Password, that's lame, use one of your own please.
For those still not sure of how the password is created let me just say that the program creates passwords based on the 'SERIAL NUMBER' you type in, the other details are there just for cosmetic purposes only.
If you wish to re-enter the Registration screen again so that you can learn more about how the program comes up with the password then you can without having to delete the wxr95.ini file first, the program kindly lets us do this..:)
Job Done.....
|
Using any hex editor loadup the file wxr95.exe then:-
SEARCH FOR:-
85C00F84CF000000 then replace it with:
85C00EBD00000000
|------| <--Change these bytes only.
|
So now each time the program runs, it see the real password and not my fake one because the program had placed it there!
My thanks and gratitude goes to:
Fravia+ for providing possibly the greatest
source of Reverse Engineering
knowledge on the Web.
+ORC for showing me the light at the end
of the tunnel.
|
Next | Return to Essay Index | Previous |