home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / +Sandman / NetZip65025.txt < prev    next >
Text File  |  2000-05-25  |  13KB  |  275 lines

  1. Hi,
  2.  
  3.  I have got NetZip Deluxe 6.5.  The URL is
  4.  ftp://ftp.download.com/pub/win95/utilities/NetZIP.exe
  5.  
  6.  The author of this software plays a funny trick.
  7.  I will try to explain this trick.This essay is quite long.Please forgive me
  8. for my poor English.
  9.  You know that your serial number should be 8 chars long. Here is the check(in
  10. Evalware.dll):
  11. (I have removed some stupid comments made by W32Dasm)
  12.  
  13. :100017B0 8B542404                mov edx, dword ptr [esp+04]
  14. :100017B4 53                      push ebx
  15. :100017B5 8BD9                    mov ebx, ecx
  16. :100017B7 57                      push edi
  17. :100017B8 8BFA                    mov edi, edx
  18. :100017BA 83C9FF                  or ecx, FFFFFFFF
  19. :100017BD 33C0                    xor eax, eax
  20. :100017BF F2                      repnz
  21. :100017C0 AE                      scasb
  22. :100017C1 F7D1                    not ecx
  23. :100017C3 49                      dec ecx
  24. :100017C4 83F908                  cmp ecx, 00000008;Check the length
  25. :100017C7 7405                    je 100017CE
  26. :100017C9 5F                      pop edi
  27. :100017CA 5B                      pop ebx
  28. :100017CB C20400                  ret 0004
  29. :100017CE 8BFA                    mov edi, edx
  30. :100017D0 83C9FF                  or ecx, FFFFFFFF
  31. :100017D3 33C0                    xor eax, eax
  32. :100017D5 56                      push esi
  33. :100017D6 F2                      repnz
  34. :100017D7 AE                      scasb
  35. :100017D8 F7D1                    not ecx
  36. :100017DA 2BF9                    sub edi, ecx
  37. :100017DC 8BC1                    mov eax, ecx
  38. :100017DE 8BF7                    mov esi, edi
  39. :100017E0 8BFB                    mov edi, ebx
  40. :100017E2 C1E902                  shr ecx, 02
  41. :100017E5 F3                      repz        
  42. :100017E6 A5                      movsd
  43. :100017E7 8BC8                    mov ecx, eax
  44. :100017E9 83E103                  and ecx, 00000003
  45. :100017EC F3                      repz
  46. :100017ED A4                      movsb
  47. :100017EE 8BCB                    mov ecx, ebx
  48. :100017F0 E83B010000              call 10001930  ; SubroutineA
  49.  
  50. After checking the length of you serial,it calls a subroutine at 10001930 to
  51. process your serial(Let's call this subroutine SubroutineA).I use "19740907" 
  52. as my fake serial number.The output of SubroutineA is a 8-byte array.
  53. For me this array is:
  54.  
  55.   char OutputArray[8]={ 0x39,0x31,0x3F,0x3C,0x38,0x31,0x38,0x07};
  56.  
  57. Then it will check OutputArray[2]:
  58.  
  59. :100017F5 8A4B0B                  mov cl, byte ptr [ebx+0B]
  60. :100017F8 33C0                    xor eax, eax
  61. :100017FA 80E10F                  and cl, 0F
  62. :100017FD 5E                      pop esi
  63. :100017FE 80F90A                  cmp cl, 0A
  64. :10001801 5F                      pop edi
  65. :10001802 0F94C0                  sete al         ;Good guy if  cl==0A
  66. :10001805 5B                      pop ebx
  67. :10001806 C20400                  ret 0004
  68.  
  69.   In order to let it return 1,I have to change my serial from "19740907" to
  70. "19T40908".This time the array is { 0x36,0x3E,0x2A,0x33,0x37,0x3E,0x37,0x08}.
  71.  
  72.   The body of SubroutineA is here(Easy to understand):
  73.  
  74. :10001930 51                      push ecx
  75. :10001931 53                      push ebx
  76. :10001932 8A5C2407                mov bl, byte ptr [esp+07];
  77. :10001936 BA07000000              mov edx, 00000007        ;index of array
  78. :1000193B 8A040A                  mov al, byte ptr [edx+ecx];get a char
  79. :1000193E 3C60                    cmp al, 60
  80. :10001940 7604                    jbe 10001946
  81. :10001942 04C3                    add al, C3
  82. :10001944 EB26                    jmp 1000196C
  83. :10001946 3C40                    cmp al, 40
  84. :10001948 7608                    jbe 10001952
  85. :1000194A 3C5B                    cmp al, 5B
  86. :1000194C 7304                    jnb 10001952
  87. :1000194E 04C9                    add al, C9
  88. :10001950 EB1A                    jmp 1000196C
  89. :10001952 3C2F                    cmp al, 2F
  90. :10001954 7608                    jbe 1000195E
  91. :10001956 3C3A                    cmp al, 3A
  92. :10001958 7304                    jnb 1000195E
  93. :1000195A 04D0                    add al, D0
  94. :1000195C EB0E                    jmp 1000196C
  95. :1000195E 3C2B                    cmp al, 2B
  96. :10001960 7504                    jne 10001966
  97. :10001962 B03E                    mov al, 3E
  98. :10001964 EB06                    jmp 1000196C
  99. :10001966 3C2D                    cmp al, 2D
  100. :10001968 7524                    jne 1000198E
  101. :1000196A B03F                    mov al, 3F
  102. :1000196C 83FA07                  cmp edx, 00000007  ;The last char ?
  103. :1000196F 7509                    jne 1000197A
  104. :10001971 8AD8                    mov bl, al
  105. :10001973 F6D3                    not bl
  106. :10001975 80E33F                  and bl, 3F
  107. :10001978 EB02                    jmp 1000197C
  108. :1000197A 32C3                    xor al, bl
  109. :1000197C 88440A09                mov byte ptr [edx+ecx+09], al ;Save the result
  110. :10001980 4A                      dec edx
  111. :10001981 83FAFF                  cmp edx, FFFFFFFF
  112. :10001984 7FB5                    jg 1000193B             ;continue the loop
  113. :10001986 B801000000              mov eax, 00000001
  114. :1000198B 5B                      pop ebx
  115. :1000198C 59                      pop ecx
  116. :1000198D C3                      ret
  117. :1000198E 33C0                    xor eax, eax
  118. :10001990 5B                      pop ebx
  119. :10001991 59                      pop ecx
  120. :10001992 C3                      ret
  121.  
  122.   Then it will save your fake serial to windows registry. But the names of keys 
  123. in windows registry are determined by OutputArray[0]. This is very important !
  124. Here is the code:
  125.  
  126. :10001B5E 8A4609                  mov al, byte ptr [esi+09] ;get OutputArray[0]
  127. :10001B61 8D4C2410                lea ecx, dword ptr [esp+10]
  128. :10001B65 83E03F                  and eax, 0000003F ; OutputArray[0] & 0x3F
  129. :10001B68 C644242001              mov [esp+20], 01
  130. :10001B6D 50                      push eax
  131.  
  132. * Possible StringData Ref from Data Obj ->"%ddata"  ;generate key name
  133.                                   |
  134. :10001B6E 68ACF00110              push 1001F0AC
  135. :10001B73 51                      push ecx
  136. :10001B74 E82FB70000              call 1000D2A8
  137. :10001B79 8A5609                  mov dl, byte ptr [esi+09] ;OutputArray[0]
  138. :10001B7C 83C40C                  add esp, 0000000C
  139. :10001B7F 83E23F                  and edx, 0000003F  ;OutputArray[0] & 0x3F
  140. :10001B82 8D44240C                lea eax, dword ptr [esp+0C]
  141. :10001B86 52                      push edx
  142.  
  143. * Possible StringData Ref from Data Obj ->"%durl"  ;generate key name
  144.                                   |
  145. :10001B87 68A4F00110              push 1001F0A4
  146. :10001B8C 50                      push eax
  147. :10001B8D E816B70000              call 1000D2A8
  148. :10001B92 83C40C                  add esp, 0000000C
  149. :10001B95 8BCE                    mov ecx, esi
  150. :10001B97 E834FDFFFF              call 100018D0
  151. :10001B9C 8D4C2414                lea ecx, dword ptr [esp+14]
  152. :10001BA0 8D542408                lea edx, dword ptr [esp+08]
  153. :10001BA4 51                      push ecx
  154. :10001BA5 52                      push edx
  155. :10001BA6 6A00                    push 00000000
  156. :10001BA8 683F000F00              push 000F003F
  157. :10001BAD 6A00                    push 00000000
  158.  
  159. * Possible StringData Ref from Data Obj ->"Application Global Data"
  160.                                   |
  161. :10001BAF 68B4F00110              push 1001F0B4
  162. :10001BB4 6A00                    push 00000000
  163.  
  164. * Possible StringData Ref from Data Obj ->"sbi"
  165.                                   |
  166. :10001BB6 68A0F00110              push 1001F0A0
  167. :10001BBB 6800000080              push 80000000
  168.  
  169. * Reference To: ADVAPI32.RegCreateKeyExA, Ord:011Bh
  170.                                   |
  171. :10001BC0 FF1534750210            Call dword ptr [10027534]
  172. :10001BC6 8B442410                mov eax, dword ptr [esp+10]
  173. :10001BCA 8B4C2408                mov ecx, dword ptr [esp+08]
  174.  
  175. * Reference To: ADVAPI32.RegSetValueExA, Ord:0141h
  176.                                   |
  177. :10001BCE 8B3D38750210            mov edi, dword ptr [10027538]
  178. :10001BD4 6A08                    push 00000008
  179. :10001BD6 56                      push esi
  180. :10001BD7 6A01                    push 00000001
  181. :10001BD9 6A00                    push 00000000
  182. :10001BDB 50                      push eax
  183. :10001BDC 51                      push ecx
  184. :10001BDD FFD7                    call edi
  185. :10001BDF 8B7614                  mov esi, dword ptr [esi+14]
  186. :10001BE2 8B44240C                mov eax, dword ptr [esp+0C]
  187. :10001BE6 8B4C2408                mov ecx, dword ptr [esp+08]
  188. :10001BEA 8B56F8                  mov edx, dword ptr [esi-08]
  189. :10001BED 52                      push edx
  190. :10001BEE 56                      push esi
  191. :10001BEF 6A01                    push 00000001
  192. :10001BF1 6A00                    push 00000000
  193. :10001BF3 50                      push eax
  194. :10001BF4 51                      push ecx
  195. :10001BF5 FFD7                    call edi
  196. :10001BF7 8B542408                mov edx, dword ptr [esp+08]
  197. :10001BFB 52                      push edx
  198.  
  199. * Reference To: ADVAPI32.RegCloseKey, Ord:0117h
  200.                                   |
  201. :10001BFC FF1530750210            Call dword ptr [10027530] 
  202.  
  203.   For my fake serial,OutputArray[0] is 0x36.
  204.             0x36 & 0x3F = 0x36 (54 in decimal format)
  205. So the keys in windows registry are:
  206.            \HKEY_CLASSES_ROOT\sbi\54data  (my fake serial)
  207.            \HKEY_CLASSES_ROOT\sbi\54url   (empty )
  208. This puzzled me. How does it read my serial when it starts ? It doesn't know
  209. the registry key name because the registry key name is determined by my fake
  210. serial !
  211.     I use Regmon to see what registry keys it reads when it starts.I find that
  212. it always uses 
  213.            \HKEY_CLASSES_ROOT\sbi\11data     and
  214.            \HKEY_CLASSES_ROOT\sbi\11url.
  215.     That means 54 should be 11 !  This is the trick !!!
  216.     In other words,the following requirement should be met:
  217.              OutputArray[0] & 0x3F = 11
  218.  
  219.     I have used
  220.         bpx RegQueryValueExA if *(esp->8)=='11da' do "db esp+14" 
  221. as a breakpoint,and traced my fake serial,but nothing new found(If you find
  222. something useful,please let me know. My mail is happynetguy@163.net).
  223.     So far we can figure out the correct serial.
  224.     I have found another subroutine which can produces the  serial providing 
  225. that its input is OutputArray[ ]. Let's call it SubroutineB.
  226.  
  227.     serial number  ----> SubroutineA   ----->  OutputArray[ ]
  228.     OutputArray[ ] ----> SubRoutineB   ----->serial number
  229.  
  230.     OK, with SubroutineB we can write a key maker now.
  231.  
  232.     Here is the body of SubroutineB:
  233.  
  234. :100018D0 56                      push esi
  235. :100018D1 8BF1                    mov esi, ecx
  236. :100018D3 BA07000000              mov edx, 00000007
  237. :100018D8 8A4E10                  mov cl, byte ptr [esi+10]
  238. :100018DB F6D1                    not cl
  239. :100018DD 80E13F                  and cl, 3F
  240. :100018E0 8A443209                mov al, byte ptr [edx+esi+09]
  241. :100018E4 83FA07                  cmp edx, 00000007
  242. :100018E7 7402                    je 100018EB
  243. :100018E9 32C1                    xor al, cl
  244. :100018EB 3C0A                    cmp al, 0A
  245. :100018ED 7304                    jnb 100018F3
  246. :100018EF 0430                    add al, 30
  247. :100018F1 EB26                    jmp 10001919
  248. :100018F3 3C09                    cmp al, 09
  249. :100018F5 7608                    jbe 100018FF
  250. :100018F7 3C24                    cmp al, 24
  251. :100018F9 7304                    jnb 100018FF
  252. :100018FB 0437                    add al, 37
  253. :100018FD EB1A                    jmp 10001919
  254. :100018FF 3C23                    cmp al, 23
  255. :10001901 7608                    jbe 1000190B
  256. :10001903 3C3E                    cmp al, 3E
  257. :10001905 7306                    jnb 1000190D
  258. :10001907 043D                    add al, 3D
  259. :10001909 EB0E                    jmp 10001919
  260. :1000190B 3C3E                    cmp al, 3E
  261. :1000190D 7504                    jne 10001913
  262. :1000190F B02B                    mov al, 2B
  263. :10001911 EB06                    jmp 10001919
  264. :10001913 3C3F                    cmp al, 3F
  265. :10001915 7502                    jne 10001919
  266. :10001917 B02D                    mov al, 2D
  267. :10001919 880432                  mov byte ptr [edx+esi], al
  268. :1000191C 4A                      dec edx
  269. :1000191D 83FAFF                  cmp edx, FFFFFFFF
  270. :10001920 7FBE                    jg 100018E0
  271. :10001922 5E                      pop esi
  272. :10001923 C3                      ret
  273.  
  274. That's all.Thank you.
  275.