personmans
February 25th, 2008, 17:33
I have been working on making a keygen for a target (which I know I can't name here)
(See update below for more info)
If anyone has a few minutes to take a look at my target, it is not packed and has no crypto so it should be quick. I would just like to understand how the serials are being generated/used. I can provide the UDD files with my comments and breakpoints if needed. I just want to learn.
Thanks,
Personmans
UPDATE:
Just to update, I traced ~3 calls deep and found how the last 5 characters are generated. From here I could just brute force a serial every time. The Middle 6 digits (must be numbers) seem to just be random... I'm guessing this makes for the ability to have random looking serials, as well as 6 digits being enough to supply many many unique serials. However, like I said, I'm here to learn, so on I go!
Now in the generation scheme there are two large numbers used (Which I don't have right now) but they are undoubtedly based on the first and second part of the serial. I have traced the general area looking for when these numbers appear and they are both created a couple calls before the serial scheme.
Tracing ~5 calls deep into these I found myself very confused.
First, the use of a table in these calls gave me a LOT of greif because each time I encounter it, the thing just seems to be checking for alphanumeric input. (Why would they do it so redundantly? It happens like 4 times.)
Then I spent about 20 minutes understanding the first part of a call (with a loop and a few other things) only to see that it does not generate the serial, but right after there is another call to a function that looks the SAME... where the number is generated...
If anyone cares to see what I'm talking about, I've included just the loop from the last call that I spoke of below:
(See update below for more info)
Code:
Working on it I've got this for the serial scheme:
MTWE60
[XXXXXX]
Version Number String
01
[XX]
Single vs Site license 01 = site 00 = single
(DASH)
0000001
[XXXXXX]
6 digit number, unknown use.
(DASH)
8ZAB5
[XXXXXX]
5 character string, based on the other two parts.
This is a working serial (MTWE601-000001-8ZAB5) with my description of each part.
If anyone has a few minutes to take a look at my target, it is not packed and has no crypto so it should be quick. I would just like to understand how the serials are being generated/used. I can provide the UDD files with my comments and breakpoints if needed. I just want to learn.
Thanks,
Personmans
UPDATE:
Just to update, I traced ~3 calls deep and found how the last 5 characters are generated. From here I could just brute force a serial every time. The Middle 6 digits (must be numbers) seem to just be random... I'm guessing this makes for the ability to have random looking serials, as well as 6 digits being enough to supply many many unique serials. However, like I said, I'm here to learn, so on I go!
Now in the generation scheme there are two large numbers used (Which I don't have right now) but they are undoubtedly based on the first and second part of the serial. I have traced the general area looking for when these numbers appear and they are both created a couple calls before the serial scheme.
Tracing ~5 calls deep into these I found myself very confused.
First, the use of a table in these calls gave me a LOT of greif because each time I encounter it, the thing just seems to be checking for alphanumeric input. (Why would they do it so redundantly? It happens like 4 times.)
Then I spent about 20 minutes understanding the first part of a call (with a loop and a few other things) only to see that it does not generate the serial, but right after there is another call to a function that looks the SAME... where the number is generated...
If anyone cares to see what I'm talking about, I've included just the loop from the last call that I spoke of below:
Code:
004C352A |> /833D D4475100 01 /CMP DWORD PTR DS:[5147D4],1
004C3531 |. |0FB6F3 |MOVZX ESI,BL
004C3534 |. |7E 0C |JLE SHORT MyTarget.004C3542
004C3536 |. |6A 04 |PUSH 4
004C3538 |. |56 |PUSH ESI
004C3539 |. |E8 63410000 |CALL MyTarget.004C76A1
004C353E |. |59 |POP ECX ; 00D89EF8
004C353F |. |59 |POP ECX ; 00D89EF8
004C3540 |. |EB 0B |JMP SHORT MyTarget.004C354D
004C3542 |> |A1 C8455100 |MOV EAX,DWORD PTR DS:[5145C8] ; This is the 'table'
004C3547 |. |8A0470 |MOV AL,BYTE PTR DS:[EAX+ESI*2]
004C354A |. |83E0 04 |AND EAX,4
004C354D |> |85C0 |TEST EAX,EAX
004C354F |. |74 08 |JE SHORT MyTarget.004C3559
004C3551 |. |0FBECB |MOVSX ECX,BL
004C3554 |. |83E9 30 |SUB ECX,30
004C3557 |. |EB 32 |JMP SHORT MyTarget.004C358B
004C3559 |> |833D D4475100 01 |CMP DWORD PTR DS:[5147D4],1
004C3560 |. |7E 0B |JLE SHORT MyTarget.004C356D
004C3562 |. |57 |PUSH EDI
004C3563 |. |56 |PUSH ESI
004C3564 |. |E8 38410000 |CALL MyTarget.004C76A1
004C3569 |. |59 |POP ECX ; 00D89EF8
004C356A |. |59 |POP ECX ; 00D89EF8
004C356B |. |EB 0B |JMP SHORT MyTarget.004C3578
004C356D |> |A1 C8455100 |MOV EAX,DWORD PTR DS:[5145C8]
004C3572 |. |66:8B0470 |MOV AX,WORD PTR DS:[EAX+ESI*2]
004C3576 |. |23C7 |AND EAX,EDI
004C3578 |> |85C0 |TEST EAX,EAX
004C357A |. |74 4A |JE SHORT MyTarget.004C35C6
004C357C |. |0FBEC3 |MOVSX EAX,BL
004C357F |. |50 |PUSH EAX
004C3580 |. |E8 081A0000 |CALL MyTarget.004C4F8D ; A whole other call, just like this one
004C3585 |. |59 |POP ECX ; 00D89EF8
004C3586 |. |8BC8 |MOV ECX,EAX
004C3588 |. |83E9 37 |SUB ECX,37
004C358B |> |3B4D 10 |CMP ECX,[ARG.3]
004C358E |. |73 36 |JNB SHORT MyTarget.004C35C6
004C3590 |. |8B75 F8 |MOV ESI,[LOCAL.2]
004C3593 |. |834D 14 08 |OR [ARG.4],8
004C3597 |. |3B75 F4 |CMP ESI,[LOCAL.3]
004C359A |. |72 14 |JB SHORT MyTarget.004C35B0
004C359C |. |75 0C |JNZ SHORT MyTarget.004C35AA
004C359E |. |83C8 FF |OR EAX,FFFFFFFF
004C35A1 |. |33D2 |XOR EDX,EDX
004C35A3 |. |F775 10 |DIV [ARG.3]
004C35A6 |. |3BCA |CMP ECX,EDX
004C35A8 |. |76 06 |JBE SHORT MyTarget.004C35B0
004C35AA |> |834D 14 04 |OR [ARG.4],4
004C35AE |. |EB 09 |JMP SHORT MyTarget.004C35B9
004C35B0 |> |0FAF75 10 |IMUL ESI,[ARG.3]
004C35B4 |. |03F1 |ADD ESI,ECX
004C35B6 |. |8975 F8 |MOV [LOCAL.2],ESI
004C35B9 |> |8B45 FC |MOV EAX,[LOCAL.1]
004C35BC |. |FF45 FC |INC [LOCAL.1]
004C35BF |. |8A18 |MOV BL,BYTE PTR DS:[EAX]
004C35C1 |.^\E9 64FFFFFF \JMP MyTarget.004C352A