[PGC OFFiCiAL KEYGENME ]
par Amenesia
Un breakpoint sur GetWindowTextA...

_text:00401A11                 push    11h             ; nMaxCount
_text:00401A13                 push    offset Name     ; lpString
_text:00401A18                 push    hWnd            ; hWnd
_text:00401A1E                 call    GetWindowTextA
_text:00401A23                 cmp     eax, 1
_text:00401A26                 jl      InvalidName

_text:00401A2C                 mov     SizeName, eax
_text:00401A31                 push    22h             ; nMaxCount
_text:00401A33                 push    offset Serial   ; lpString
_text:00401A38                 push    hWndNewOwner    ; hWnd
_text:00401A3E                 call    GetWindowTextA
_text:00401A43                 cmp     eax, 1
_text:00401A46                 jl      InvalidSerial

Donc le serial est composé de 1 à 34 caracteres et le nom de 1 à 17...



 

Puis le programme initialise des big (cf la doc de Miracl) et convertit le serial en big:

_text:00401A51                 push    0
_text:00401A53                 call    mirvar
_text:00401A58                 mov     BigNum1, eax

_text:00401A5D                 mov     eax, SizeSerial
_text:00401A62                 push    BigNum1
_text:00401A68                 push    offset Serial
_text:00401A6D                 call    cinstr
 


La chaine [PGCTRiAL/2oo2] est ajoutée à la fin du nom :

_text:00401A72                 push    offset aPgctrial2oo2 
_text:00401A77                 push    offset Name 
_text:00401A7C                 call    lstrcatA


Puis la chaine est hashée ( MD5 )

_text:00401A81                 push    offset Name 
_text:00401A86                 call    lstrlenA
_text:00401A8B                 push    offset HashRslt1
_text:00401A90                 push    offset HashRslt2
_text:00401A95                 push    eax
_text:00401A96                 push    offset Name
_text:00401A9B                 call    Hash    ; utilise 67452301h, 0EFCDAB89h ....
 


D'autres big sont alors initialisés...

_text:00401AA0                 push    0
_text:00401AA2                 call    mirvar
_text:00401AA7                 mov     BigNum2, eax

_text:00401AAC                 push    0
_text:00401AAE                 call    mirvar
_text:00401AB3                 mov     BigNum3, eax

_text:00401AB8                 push    0
_text:00401ABA                 call    mirvar
_text:00401ABF                 mov     BigNum4, eax

_text:00401AC4                 push    0
_text:00401AC6                 call    mirvar
_text:00401ACB                 mov     BigNum5, eax
 

_text:00401AD8                 push    BigNum2
_text:00401ADE                 push    offset HashRslt
_text:00401AE3                 call    cinstr

_text:00401AE8                 push    BigNum5
_text:00401AEE                 push    offset a10001 
_text:00401AF3                 call    cinstr

_text:00401AF8                 push    BigNum4
_text:00401AFE                 push    offset a8e701a4c793eb8b739166bb23b49e421 
_text:00401B03                 call    cinstr
 

La valeur 10001 laisse prenser que le programme va faire appel au cryptage RSA...


Effectivement on reconnait juste en dessous la fonction powmod :

Hash ^ 10001 mod 8e701a4c793eb8b739166bb23b49e421

_text:00401B08                 push    BigNum3    ; Resultat du calcul
_text:00401B0E                 push    BigNum4    ; 8e701a4c793eb8b739166bb23b49e421 
_text:00401B14                 push    BigNum5    ; 10001
_text:00401B1A                 push    BigNum2    ; resultat du hash
_text:00401B20                 call    powmod



Et finallement le resultat du calcul precedent et le serial sont comparés...
 

_text:00401B25                 push    BigNum1
_text:00401B2B                 push    BigNum3
_text:00401B31                 call    compare
_text:00401B36                 test    eax, eax
_text:00401B38                 jz      SerialValid


Donc pour realiser un keygen il suffirait de faire afficher le BigNum3, c'est a dire:

MD5(Nom+[PGCTRiAL/2oo2]) ^ 10001 mod 8e701a4c793eb8b739166bb23b49e421



 
 

Nom Amenesia
Serial 4511AE0FB075732B68AF485044000E5B

 

Bonne continuation ;)
 
 




NB:  Quel est l'interet d'avoir utilisé RSA ? A priori aucun... ;) 
Il aurait pu en avoir si a la place de calculer:
Hash ^ 10001 mod 8e701a4c793eb8b739166bb23b49e421
le programme avait calculé
Serial ^ 10001 mod 8e701a4c793eb8b739166bb23b49e421

puis comparé le resultat du calcul au resultat du hash...