[ORION Trial 2001 - Hard ]
par Amenesia
Analyse du code:

Un breakpoint sur GetDlgItemTextA...

_text:00401BF5                 push    22h             ; nombre de lettre max
_text:00401BF7                 push    eax 
_text:00401BF8                 push    3F1h 
_text:00401BFD                 push    ecx 
_text:00401BFE                 mov     esi, ds:GetDlgItemTextA
_text:00401C04                 call    esi ; GetDlgItemTextA

_text:00401C06                 mov     eax, hWnd
_text:00401C0B                 lea     edx, [ebp+Serial]
_text:00401C11                 push    2Ch             ; nombre de lettre max
_text:00401C13                 push    edx 
_text:00401C14                 push    3EDh 
_text:00401C19                 push    eax 
_text:00401C1A                 call    esi ; GetDlgItemTextA

_text:00401C1C                 lea     edi, [ebp+Nom]
_text:00401C1F                 or      ecx, 0FFFFFFFFh
_text:00401C22                 xor     eax, eax
_text:00401C24                 repne scasb
_text:00401C26                 not     ecx
_text:00401C28                 dec     ecx
_text:00401C29                 cmp     ecx, 1
_text:00401C2C                 jb      ErreurNom

_text:00401C32                 lea     edi, [ebp+Nom]
_text:00401C35                 or      ecx, 0FFFFFFFFh
_text:00401C38                 repne scasb
_text:00401C3A                 not     ecx
_text:00401C3C                 dec     ecx
_text:00401C3D                 cmp     ecx, 1Eh
_text:00401C40                 ja      ErreurNom

_text:00401C46                 lea     edi, [ebp+Serial]
_text:00401C4C                 or      ecx, 0FFFFFFFFh
_text:00401C4F                 repne scasb
_text:00401C51                 not     ecx
_text:00401C53                 dec     ecx
_text:00401C54                 cmp     ecx, 28h 
_text:00401C57                 jnz     BadBoy
 

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


Le nom est ensuite utilisé pour créer 4 valeurs....

_text:00401C8B                 xor     eax, eax
_text:00401C8D                 xor     ebx, ebx
_text:00401C8F                 xor     ecx, ecx
_text:00401C91                 mov     ebx, [ebp+TailleNom]
_text:00401C94                 movzx   eax, [ebp+ecx+Nom]
_text:00401C9C 
_text:00401C9C LoopClef:  
_text:00401C9C                 imul    eax, 11001100h
_text:00401CA2                 rol     ax, cl
_text:00401CA5                 imul    eax, ebx
_text:00401CA8                 xor     eax, 110011h
_text:00401CAD                 add     eax, 58392831h
_text:00401CB2                 rcl     eax, cl
_text:00401CB4                 and     eax, 5666AAA5h
_text:00401CB9                 xor     [Clef1], eax
_text:00401CBC                 imul    eax, 0F34526CAh
_text:00401CC2                 rol     ax, cl
_text:00401CC5                 imul    eax, ebx
_text:00401CC8                 xor     eax, 652324h
_text:00401CCD                 add     eax, 98542312h
_text:00401CD2                 rcl     eax, cl
_text:00401CD4                 and     eax, 5666AAA5h
_text:00401CD9                 xor     [Clef2], eax
_text:00401CDC                 imul    eax, 22553355h
_text:00401CE2                 rol     ax, cl
_text:00401CE5                 imul    eax, ebx
_text:00401CE8                 xor     eax, 22BB44h
_text:00401CED                 add     eax, 23476CACh
_text:00401CF2                 rcl     eax, cl
_text:00401CF4                 and     eax, 5666AAA5h
_text:00401CF9                 xor     [Clef3], eax
_text:00401CFC                 imul    eax, 0AEBCA011h
_text:00401D02                 rol     ax, cl
_text:00401D05                 imul    eax, ebx
_text:00401D08                 xor     eax, 0E475AFh
_text:00401D0D                 add     eax, 54BEA1CAh
_text:00401D12                 rcl     eax, cl
_text:00401D14                 and     eax, 5666AAA5h
_text:00401D19                 xor     [Clef4], eax
_text:00401D1C                 imul    eax, 8F3A3B3Ch
_text:00401D22                 rol     ax, cl
_text:00401D25                 imul    eax, ebx
_text:00401D28                 xor     eax, 0BA3212h
_text:00401D2D                 add     eax, 0CAFECAFEh
_text:00401D32                 rcl     eax, cl
_text:00401D34                 and     eax, 5666AAA5h
_text:00401D39                 xor     [Clef5], eax
_text:00401D3C                 inc     ecx
_text:00401D3D                 movzx   eax, [ebp+ecx+Nom]
_text:00401D45                 cmp     eax, 0
_text:00401D48                 jnz     LoopClef
_text:00401D4E                 xor     ebx, ebx



Ces valeurs numerique sont ensuite convertit en une chaine hexadecimal...

_text:00401D50 convertClef1: 
_text:00401D50                 xor     edx, edx
_text:00401D52                 lea     eax, [ebp+xChaine]
_text:00401D55                 mov     dl, byte ptr [ebp+ebx+Clef1]
_text:00401D59                 push    edx
_text:00401D5A                 push    offset a_2x     ; "%.2X"
_text:00401D5F                 push    eax
_text:00401D60                 call    _sprintf
_text:00401D65                 lea     edi, [ebp+xChaine]
_text:00401D68                 or      ecx, 0FFFFFFFFh
_text:00401D6B                 xor     eax, eax
_text:00401D6D                 add     esp, 0Ch
_text:00401D70                 repne scasb
_text:00401D72                 not     ecx
_text:00401D74                 sub     edi, ecx
_text:00401D76                 lea     edx, [ebp+var_194]
_text:00401D7C                 mov     esi, edi
_text:00401D7E                 mov     edi, edx
_text:00401D80                 mov     edx, ecx
_text:00401D82                 or      ecx, 0FFFFFFFFh
_text:00401D85                 repne scasb
_text:00401D87                 mov     ecx, edx
_text:00401D89                 dec     edi
_text:00401D8A                 shr     ecx, 2
_text:00401D8D                 repe movsd
_text:00401D8F                 mov     ecx, edx
_text:00401D91                 and     ecx, 3
_text:00401D94                 inc     ebx
_text:00401D95                 cmp     ebx, 14h
_text:00401D98                 repe movsb
_text:00401D9A                 jl      short convertClef1



Puis trois big sont initialisés:

_text:00401E6D                 push    eax  ; E8A1276B2AB94FEA3BF1410603600B43E2010A99
_text:00401E6E                 push    edi
_text:00401E6F                 call    cinstr

_text:00401E7A                 push    ecx             ; 10001h
_text:00401E7B                 push    ebx
_text:00401E7C                 call    cinstr

_text:00401E8A                 push    edx             ; Serial
_text:00401E8B                 push    esi
_text:00401E8C                 call    cinstr



La presence de la valeur 10001h permet de supposer que RSA va etre utilisé... et effectivement on 
reconnait quelques lignes plus bas une fonction dont la signature ressemble à celle de powmod ( cf doc de la librairie Miracl ) 

_text:00401E91                 push    esi
_text:00401E92                 push    edi     ; E8A1276B2AB94FEA3BF1410603600B43E2010A99
_text:00401E93                 push    ebx     ; 10001
_text:00401E94                 push    esi     ; serial
_text:00401E95                 call    powmod


Le resultat de l'operation est ensuite convertit en une chaine qui est comparé a celle créee precedement:...

_text:00401EA0                 push    eax
_text:00401EA1                 push    esi
_text:00401EA2                 call    sub_0_406110 



Keygen

Pour trouver un serial valide il faut donc trouver la clef privée:

   RSA-Tool donne D = : C54FA32297BB5458257BEEA22442F8A320963FAD

Puis crypter (RSA) la chaine construite a partir du nom à l'aide de cette clef... 
 

Nom Amenesia
Serial 5A9FD7DDDD9C29532D4714B3CA4C1B89B97CE8CE

 

Bonne continuation ;)