Let's apply the same approach as we have done with the other try_me
files. If you breakpoint with BPR W you'll get in the interrupt routine
and if you just use BPINT 21 you'll land on Buffered Keyboard Input. Your
input is at DX+02. BPMB the first char of the string you entered and press
CTRL-D. This is what you should see:
__
|
| XOR AX,[SI]
| CMP BYTE PTR [SI+01],00 ; Here is where you land
| JZ 014E
| CMP BYTE PTR [SI+01],0D ; Check if char is carriage return (0D)
| JZ 014E
| INC SI
| JMP 013D ; Run until end of string is reached
|__
014E CMP WORD PTR CS:[0245],00 ; What's this???
JNZ 014E ; A loop! for what???
MOV SI,0241
MOV DX,[SI]
PUSH AX
MOV AX,[SI+02]
MOV DS,AX
MOV AX,251C
INT 21 ; Set vector
If you let the program run, it will show "Wrong password..." and exit
to DOS. So it only reads our input string one time. The
XOR AX,[SI] looks suspicious at first look, it looks like a
encryption instruction. It's the only thing in the first piece of code that
manipulates our string. The next thing that my eyes see is the CMP WORD PTR CS:[0245],00. The CMP is checking the
status at CS:[0245] until it's zero. What's going on at address CS:0245?
and what changes the 01 into 00? Here is where Softice takes us:
DEC WORD PTR CS:[0245] ; Here's the toggle from 01/00
IRET
-----------
INT 1C ; So INT 1C is one that is hooked
CALL 8CFA
INT 1C is the user timer click vector. It runs constantly, just try a
BPINT 1C and you'll see. Now we understand the strange
CMP WORD PTR CS:[0245],00. We now make a guess that the XOR AX,[SI] instruction encrypts our input letters for a
later comparison. Since the encrypted string is stored in AX as a number
and not as a string we have to look for instructions that move AX value to
a place in memory. The PUSH AX stores our
encrypted string on the stack. Step over it and do a D SS:SP and you'll see
that the number that was in AX is now on another address. BPM that address:
BPM SS:FFFA (address could be different in your computer)
Softice will pop here:
XOR [BP+08],BX
JNZ 01B2 ; Evil jump
--------
If you scan up a little in the code you'll see this:
MOV BX,[BP+04]
XOR BX,B816
XOR [BP+08],BX ; BP+08 is our encrypted code
JNZ 01B2
Now we can easily crack this by changing the JNZ
into a JZ. If you wanna know the correct
password you'll have to DECRYPT it. I'll leave that up to
you. Here are some hints if you wanna have a try:
- If you look at the last compare before the evil jump, you'll see what
our encrypted string should be after the encryption loop.
- The hardest part is to figure out how you'll get that result from the
encryption loop.
- Number of chars is very important. You could make a table and put your
results in.
- The fastest way is to use some sort of mathematical function or
equation to calculate the correct password. You could write a small program
to calculate the correct password.
CONCLUSION
When I first tried these try_me files I cracked them flat on three
seconds. Try the different techniques we have studied here. These methods
are basic cracking techniques and by using them you should be able to crack
most of the programs that use the password protection. To crack TEST2.COM
the above steps are not necessary. You could just have single stepped a few
instructions from the encryption routine and you would have landed at the
final comparison.
What we did was to dig out some pieces that we didn't understand at
first, that's called "studying". The difference between cracking a scheme
and studying it is that when studying you put together all the pieces the
protection holds to get a full view. When that is done you have learned
something new (if the protection was new to you). You usually first try to
crack it and if you fail you study it. The purpose of this lesson was to
show you how to approach different schemes of the same BASE
protection, in this case the password protections. There are three
more files left which I'll leave up to you to study on your own.
I know that some people want these solutions published. The reason why
I don't publish my solutions to these three files in this lesson is
because I don't have the time and because I would like you to work on your
own. I'll happily answer all questions that you may have (or get), If you go on and study the last three files. Please write down
your solution and e-mail it to me and I'll publish it here. This
site is dedicated to newbies and the best thing that could happen is that
newbies teach each other on this site. Fravia's Page of Reverse
Engineering is the best cracking site I've ever seen. This page is
meant to be like a preparation for a beginner before he moves on to other
sitez. I'll also welcome all comments about my work, e-mail me.
indian_trail@hotmail.com
(10-Oct-97)

Go to the parent page: Software hacking.