cracking using ollydbg

what is cracking?

i would like to introduce you now to a more advanced and professional cracking technique, cracking using a debugger. what is a debugger? in few words, a debugger is a software that will let us look in the asm code before and after the code is executed by the cpu. the debugger will pause the the execution of the code and will allow us to trace it step by step as the cpu executes it. all crackers uses a debugger, even w32dasm has a debugger built in but is not very confortable. the most advanced debugger for cracking used by all crackers is ollydbg, this tool will become your friend, your partner, it will be for you the tool number one!

configurations of your ollydbg:

let's do some configurations, press alt+o to access options and go to the cpu menu. make you settings look like in this picture:

after this go to exceptions menu and make your settings look like in this other picture:

ok, we are done for now. we will use olly for everything, like patching, finding serial keys, unpacking, studing, etc.

we will start our first lesson with olly by finding the serial key of a crackme, during tracing the code it will be very easy to understand where we should patch if needed.

our mission in this lesson is to find a serial key for our entered name.

step 1:

run the crackme and you will see that it needs a name and a serial number, enter some fake info... click on check serial... :? nothing happens lets find a real serial for our name now!
disassemble our target with w32dasm then click on the imports button. see the picture below:

on the dialog box that shows up find this: user32.getdlgitemtexta like in the picture below:

select it like in picture above and double click on it, you will land at the address: 004011df (write down this address), just a bit below this we have an other reference to user32.getdlgitemtexta at the address 004011f0 (write this address down too). close w32dasm, we don't need it anymore.

step 2:
run ollydbg and click on file, open, browse to our crackme and open it. cool, you should see the asm code now. press f9 button from your keyboard then the crackme should show up. enter your name and any serial number but don't click on "check serial" button yet. i will enter mister_x as name and 12345 as serial. return to ollydbg then click on "go to address" button. this button is indicated in the picture below:

on the blank box enter the first address we did found on w32dasm, 4011df then click ok!
you will be here:

push 019h
push 0403096h
push 066h
push dword ptr ss:[ebp+8]
004011df call getdlgitemtexta ;read the entered name
push 01eh
push 0403078h
push 065h
push dword ptr ss:[ebp+8]
004011f0 call getdlgitemtexta ;read the entered serial
cmp eax,4 ; compare entered name with 4
jb @crackme__00401245 ; jump if below (if our entered name is smaller than 4 digits then jump)

getdlgitemtexta is used in asm to retrive the information entered by users in blank boxes!

now, put the selector line on "004011df call getdlgitemtexta" then press the f2 button from your keyboard to set a breakpoint. go to the second address to and set a breakpoint there too by pressing f2. see the picture below to see my breakpoints. the addresses highlighted with white means that there is set a breakpoint.

bring up the crackme from the taskbar and click on "check serial" olly will break on the first breakpoint, now press f9 (run) and olly will break on the other breakpoint we did set. the first breakpoint was for the name we have entered and the second is for the serial number. now trace line by line slowly with f8 button until you are on the address "0040121f"

refering to the picture too, you must be on this line:

0040121f cmp eax, ebx

let's explain what does this mean, cmp means compare, eax register is storing the fake serial we did enter and ebx register is storing the real serial number for the entered name. check this on the top-right of your screen, in the above picture are number 2 and 3. eax has the value 12345 that is the fake serial i did enter and ebx is has the value 2eb. can 2eb be the real serial number for the name mister_x?? yes it is, we did found a real serial number and we can find a serial for any name we enter by following the procedure of this tutorial. enjoy!

as you see, on the address .40121f the protection of the crackme is comparing our fake serial with a real serial for our name.

for free download of the crackme used in this tut:

for free download of olly please go to:
w32dasm: http://www.#/?d=esvvnd8b
i did not write this tut i got it from some other forum cant remember witch :/ but anyway i hope you found this tut as useful as i did, all credits go to the person who originally made this tut

edit: original thread

tools you may need:


debugview v4.77: download

ollydbg v1.10: download

zeta deb v1.3ugger:download

.net decompilers:

dotnet il editor v0.2.6:download

ilide# v3.0.1799.34705:download

red gate's .net reflector v7.4:download

delphi decompiler:
idr (interactive delphi reconstructor) v2.5.3: download

visual basic decompilers:
p32dasm v2.8:download

vb decompiler lite v5.0:download


dotnet il editor (dile) v0.2.4:download

ida pro v5.0:download

hex calculators:

hextool v1.7.0.1:download

reversers' calculator v1.2:download

hex editors:

biew v6.1.0:download

frhed v1.6.0:download

hiew v6.50:download

hxd v1.7.7.0:download

mitec hexadecimal editor v6.0.0:download

memory hacking

memory hacking software v6.1:download

credits go to me for putting this together and the makers of all these programs, enjoy. :)