Competition: Crackme!

For everything that's not in any way related to PureBasic. General chat etc...
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

thefool wrote:@trond: No i wouldnt be able to crack it. But is that the question? :D
But it CAN be cracked.
Hehe. Well, thanks for entertaining other people still. But now I have to surf to www.gotobed.com. :wink:
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

nice place! i think in a few mins ill go there too.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

I once made a crack for Liberty BASIC Workshop
I think the method still work with the newest version.
But i'm never going to release it, I did it just for fun!
Used PE Explorer and HIEW, and it was quite easy...
I like logic, hence I dislike humans but love computers.
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

I've patched TheFool's CrackMe 5. This was the method, and bear in mind this is the first time i've ever tried this so the explanation/method might suck ;-):

Begin by having a look around - You can open the crackme in OllyDbg (there are no anti-debug tricks in this one) and you can see it has been UPXed (not sure with which version but it doesn't matter).

Set a breakpoint at the JMP at the end of that (just after the POPAD) and run the program and step-into it. It takes you to the original entry point of the (now uncompressed) code which was at 401000.

Have a scroll down and some of the code looks like gibberish, so take a guess that this is TheFools self-modifying code. Further down it looks like some code displays the "Crackme!", "Password ->", "Correct!" and "Wrong password!" messages but if you set breakpoints here the code is not reached. Just above that are a couple of odd looking strings are referenced.

Step-over the start of the code and see what happens. By the time the PUSHs are reached (40701A) you can see the code is now looking more normal, with OllyDbg highlighting the changes in red. Have a look through and there are more references to strings are revealed. Set breakpoints at them and you can see it is these strings that actually display the messages and not the strings we saw earlier. OllyDbg shows us what the registers contain and we can see the plain-text strings, including "nice one", the password.

There is a JE at 4010ED that jumps to code that displays the "Wrong password!" message so if we want to patch the exe we can NOP it and pass to the code we want. At least now, with it decompressed and unprotected, we can NOP it but the patch will affect the original compressed and protected app so NOPing it in that state will not work. Instead we can create an inline patch that will NOP it once it is unprotected in memory. But we cannot just insert code to do this because the whole thing is compressed. So instead i inserted an inline patch that creates an inline patch... :roll:

Patch the code at the end of the UPX decompression routine so that once the code is decompressed it will JMP back to our code (that's inline patch 1). Then, when our code is reached again it overwrites the JE with a couple of NOPs (inline patch 2). I didn't write down exactly what code i used but i overwrote the JMP 401000 at the end of the UPX decompression with something like this:

Code: Select all

MOV PTR [40107A], 0xhexcodetojumptocodebelow ; Start of inline patch 1, runs when code is decompressed - Overwrite PUSH code with a jump back to our code. I think this was 5 bytes
JMP 401000 ; Original last line of UPX decompression code, jump to OEP
PUSH EBX ; Start of inline patch 2, runs when code is unprotected
PUSH ECX ... ; whatever code we overwrote at 40107A still needs to run so move it here
MOV WORD PTR [4010ED], 9090 ; Overwrite the JMP with our NOPs
JMP 401084 ; Jump back to TheFools code
So that is all the patch contains. Maybe this code should have been stuck somewhere better, but it worked ok :)
Mat
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Nice!

now i guess you are all ready for me to make the 6th one?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

so, mrmat. The next one, shall it be just a little harder using more trics, or should it be much harder?
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

If it was up to me then just a little harder! The last one was already tough!
Mat
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

a little harder it is.. damn i was preparing for something with dll decrypting and loading from memory then injecting various procedures too it.. Well that will be sometime later :D

but ill make it just slight harder. Maybe some anti debugging things :)
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

I was already impressed by the methods used to achieve the 5th one lol and that was beyond me! Jesus, I think I should just sit back and watch real pro's at work lol :)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

hehe :D
well we are not pro's we are newbies having fun :P
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

well, I understand the methods... but I just haven't had the practice under windows lol :) but all the same, it is damn interesting ;) I think I already said I was impressed just by pushing stuff outside of the exe's memory... and stuff like that is almost the holy grail to me lol. Protected memory is a new thing for an ex amiga dude like me lol
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

hehe.. well its deprotected at runtime, and i made the error there. If you put a breakpoint after you run the exe, then you can see the real code.
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Post by LuCiFeR[SD] »

I knew what had to be done... I guess even how.... but my trouble is getting used to thinking about how I would do the same on the Amiga (where I could look where the hell I like) and the PC... where disassemblers fear to tread (outside of the box) lol. I will attempt number 6, same as I did with number 5... failure or success, I will have a go, just to redeem myself :)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

hehe :D
lets see. It wont be _much_ harder, but ill try to make it a little though..

Oh: Should it be a Patchme or keygenme
MrMat
Enthusiast
Enthusiast
Posts: 762
Joined: Sun Sep 05, 2004 6:27 am
Location: England

Post by MrMat »

hehe either will be difficult!
Mat
Post Reply