• ±ê Ì⣺Modify the CoDe_InSiDe's 1st ReverseMe
  • ×÷ Õߣºpoppig
  • ʱ ¼ä£º2003Äê11ÔÂ12ÈÕ 07:13
  • Á´ ½Ó£ºhttp://bbs.pediy.com

******************************************************************************
                      Target CoDe_InSiDe ReverseMe #1
******************************************************************************

Author:        CoDe_InSiDe
Protection:   None
Needs:        Hiew,WinHex,Some PE knowledge,Most important is Our Brain
Level:        ( ) Beginner (X) Intermediate ( ) Advanced ( ) Expert

ÏÂÔØ£¨»òµã»÷Êó±êÓÒ¼üÁí´æΪ£©

You Needs:
1.  Make a new Section.
2.  Don't touch the other 2 Sections (offcourse you may touch the
  PE Header ;)
3.  You MUST use the allready Imported ExitProcess to quit this
  program in a clean way :)
4.  Make the Entry Point jump to your Code BUT... after your Code
  make it jump to the Original Entry Point and let it quit
  in a good way with the Imported ExitProcess ;)
5.  In your Code make an Message Box that shows the current Tick
  Count...
6.  And offcourse do it all Manually, no Tools (You may use HIEW
  or something offcourse ;) but no PE Editors or the likes of
  that...
7.  And i think that's all...

  Õâ¾ÍÊÇËüµÄÒªÇó,ÎÒÃÇËùÒª×öµÄ¾ÍÊÇÉÏÃæµÄ7¸ö²¿·Ö,Right.ºÃÁËÎÒÃÇÊ×ÏÈÔö¼ÓÒ»¸öSection.
´ÓÎÒÇ°ÃæдµÄÎÄÕ¿ÉÒÔÖªµÀ,SectionµÄÔö¼Ó·½·¨¾ÍÊÇ,PE+F8,´Ë´¦ÊǵÚÒ»¸öSectionµÄ¿ªÊ¼µØ
·½,ÎÒÃÇ¿ÉÒÔ¿´¿´ÒѾ­Óм¸¸öSectionÁË,ÎÒÃÇ¿ÉÒÔ´ÓPEÍ·Æ«ÒÆ0x6´¦µÃµ½:

00000080   50 45 00 00 4C 01 02 00  00 00 00 00 00 00 00 00   PE..L...........

Now We change to:

00000080   50 45 00 00 4C 01 03 00  00 00 00 00 00 00 00 00   PE..L...........
                             ~~
  ½ÓÏÂÀ´¾ÍÊÇÀ´Ìí¼ÓÎÒÃǵÄSectionÁË,pe+0xF8+0x28+0x28´¦¾ÍÊÇÎÒÃǵÄSectionµÄλÖÃÁË.
0x80+0xF8+0x28+0x28=0x1c8,ÒÔÏÂÊǹ¹ÔìºÃÁ˵ÄSection:

00000170   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
00000180   00 01 00 00 00 20 00 00  00 10 00 00 00 02 00 00   ..... ..........
00000190   00 00 00 00 00 00 00 00  00 00 00 00 20 00 00 E0   ............ ..
000001A0   00 00 00 00 00 00 00 00  00 01 00 00 00 50 00 00   .............P..
000001B0   00 10 00 00 00 03 00 00  00 00 00 00 00 00 00 00   ................
000001C0   00 00 00 00 40 00 00 C0  (*)64 65 6E 67 6B 65 6E 67   ....@..Àdengkeng
000001D0   00 02 00 00 00 60 00 00  00 10 00 00 00 04 00 00   .....`..........
000001E0   00 00 00 00 00 00 00 00  00 00 00 00 20 00 00 E0   ............ ..

  ºÃÁË,ÎÒÃÇÖªµÀÁ˵ÚÒ»¸öSectionµÄ¿ªÊ¼Î»ÖÃ,0x178´¦,ÎÒÃÇ¿ÉÒԵõ½Ò»Ð©ÐÅÏ¢,ÎÒÃǽ«Ìîд
×Ô¼ºµÄSection,(*)ÊÇÎÒÃÇ×Ö½ÚµÄSectionµÄ¿ªÊ¼µØ·½.

+0 8byte Name1 ;¿éÃûdengkeng
+8 dword VirtualSize ;200,That's enough
+C dword VirtualAddress ;0x6000
10 dword SizeOfRawData ;0x1000
14 dword PointerToRawData ;ÎÒÃǵĴÓ0x400¿ªÊ¼
18 dword PointerToRelocations ;Ò»°ãΪ0x00000000
1C dword PointerToLinenumbers ;Ò»°ãΪ0x00000000
20 word NumberOfRelocations ;Ò»°ãΪ0x0000
22 word NumberOfLinenumbers ;Ò»°ãΪ0x0000
24 dword Characteristics -----> ours  is write read execute and code.so it's E0000020

  ÒÔÉϾÍÊÇÎÒÃÇ×Ô¼ºµÄSectionµÄһЩÐÅÏ¢.¾ÍÊÇ'd'Õâ¸ö×Ö½ÚÌî³äµÄÌ«ÄÑ¿´ÁË!ËãÁË!½ÓÏÂÀ´ÎÒÃǾÍ
ҪΪ³ÌÐòÔö¼Ó¿Õ¼ä,À´Ìî³ä×Ô¼ºµÄ¶«Î÷.
  ÎÒÃÇÐèÒªÖØй¹ÔìIID,Ìí¼ÓһЩÎÒÃÇÐèÒªµÄº¯Êý,ÎÒÃÇÐèÒªÔÚUser32.dllÖеÄMessageBoxA,wsprintfA
,ÒÔ¼°ÔÚKernel32.dllÖеÄGetTickCount,ExitProcess.
  ËùÒÔÎÒÃÇÐèÒªÓÐÁ½¸öIID½á¹¹À´´æ·ÅÎÒÃǵÄÐÅÏ¢,ÒÔµÚ3¸öÈ«0µÄIID½á¹¹±íʾ½áÊø.
  ÎÒÃǵĽṹ´Óoffset 0x400¿ªÊ¼,ÒòΪµÚ2¸öSection½áÊøÊÇÔÚ0x300+0x100´¦,ÎÒÃǵÄÊÇÔÚ0x400¿ªÊ¼.

µÚÒ»¸öIID½á¹¹:
+0 OriginalFirstThunk ;0x00000000
+4 TimeDateStamp ;0x00000000
+8 ForwarderChain ;0x00000000
+C Name1 ;0x00006071         ;Õâ¸öµØ·½ÊǸù¾ÝºóÃæÍƳöÀ´µÄ,ÏȲ»¼±
+10 FirstThunk ;0x0000603C   ;Õâ¸öµØ·½ÊǸù¾ÝºóÃæÍƳöÀ´µÄ,ÏȲ»¼±

µÚ¶þ¸öIID½á¹¹:
+0 OriginalFirstThunk ;0x00000000
+4 TimeDateStamp ;0x00000000
+8 ForwarderChain ;0x00000000
+C Name1 ;0x0000609A         ;Õâ¸öµØ·½ÊǸù¾ÝºóÃæÍƳöÀ´µÄ,ÏȲ»¼±
+10 FirstThunk ;0x00006048   ;Õâ¸öµØ·½ÊǸù¾ÝºóÃæÍƳöÀ´µÄ,ÏȲ»¼±

Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00000400   (1)00 00 00 00 00 00 00 00  00 00 00 00 71 60 00 00   ............q`..
00000410   3C 60 00 00 (2)00 00 00 00  00 00 00 00 00 00 00 00   <`..............
00000420   9A 60 00 00 48 60 00 00  (3)00 00 00 00 00 00 00 00   š`..H`..........
00000430   00 00 00 00 00 00 00 00  00 00 00 00 54 60 00 00   ............T`..
00000440   63 60 00 00 00 00 00 00  80 60 00 00 8C 60 00 00   c`......€`..Œ`..
00000450   00 00 00 00 00 00 47 65  74 54 69 63 6B 43 6F 75   ......GetTickCou
00000460   6E 74 00 00 00 45 78 69  74 50 72 6F 63 65 73 73   nt...ExitProcess
00000470   00 4B 65 72 6E 65 6C 33  32 2E 64 6C 6C 00 00 00   .Kernel32.dll...
00000480   00 00 77 73 70 72 69 6E  74 66 41 00 00 00 4D 65   ..wsprintfA...Me
00000490   73 73 61 67 65 42 6F 78  41 00 55 73 65 72 33 32   ssageBoxA.User32
000004A0   2E 64 6C 6C 00 00 00 00  00 00 00 00 00 00 00 00   .dll............
000004B0   54 68 65 20 54 69 63 6B  43 6F 75 6E 74 20 3A 25   The TickCount :%
000004C0   6C 75 00 00 00 00 00 00  00 00 00 00 00 00 00 00   lu..............
000004D0   43 72 61 63 6B 00 00 00  00 00 00 00 00 00 00 00   Crack...........
000004E0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
000004F0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................

  ºÃÁËÉÏÃæ¾ÍÊÇÎÒÃÇÌîдºÃµÄ½á¹¹,ÏÂÃæ¾ÍÀ´·ÖÎöÒ»ÏÂÌî³äµÄ¹ý³Ì,Ê×ÏÈÎÒÃÇÐèÒª3¸öIID½á¹¹,
ËùÒÔÎÒÃÇÐèÒª60¸ö×ֽڵĿռä(ÿ¸öIID½á¹¹20¸ö×Ö½Ú).½ÓÏÂÀ´ÊÇÌî³äFirstThunkËùÖ¸ÏòµÄÄÚÈÝ
ÒòΪÎÒÃÇÿ¸ödllÖÐÓÐÁ½¸öº¯Êýµ÷ÓÃ,ËùÒÔÎÒÃÇÐèÒª12¸ö×ֽڵĿռä,×îºó4¸ö×Ö½ÚΪ¿Õ±íʾ½áÊø.
ËùÒÔÔÚ0x43C-0x447Ϊһ´¦,0x448-0x453ΪµÚ¶þ´¦.½ÓÏÂÀ´ÔÚ0x454¾Í¿ÉÒÔÌîдÎÒÃǵĺ¯ÊýÁË,
¼ÇµÃÇ°ÃæÓÐHint,ÎÒÃÇ¿ÉÒÔÌî³ä0.¼ÇµÃ×Ö·û´®ÒªÒÔ0½áβ.ÎÒÃÇ°ÑËùÐèµÄº¯ÊýºÍdllÃû³ÆÌî³ä½øÈ¥.
Ìî³äÍêÁËÒÔºó,ÎÒÃÇ¿ªÊ¼Ìîд0x43C-0x447,0x448-0x453´¦µÄÄÚÈÝ,¼´Ö¸Ïòº¯ÊýµÄµØÖ·.ÌîдÍêÁË
ÒÔºóÎÒÃǽÓ×ÅÌîдÁ½¸öIID½á¹¹ÖеÄName1ºÍFirstThunk×Ö¶Î.ÒÔÉϾÍÊÇÌîдµÄ·ÖÎö¹ý³Ì,ÎÒÃÇ
ÏÈÌîдºóÃæµÄ²¿·ÖÔÚÌîдǰÃæµÄ²¿·Ö.
  ½ÓÏÂÀ´ÎÒÃÇÌîдһЩ×Ö·ûÔÚÒÔºóµÄMessageBoxÖÐÏÔʾ³öÀ´,ÔÚ0x4B0´¦ÌîдwsprintfAËùÐèÒªµÄ
¸ñʽ,0x4D0´¦ÌîдTitle.ÖÁÓÚ0x4E0-0x4F0ÎÒÃÇÓÃ×ö»º³åÇø.ÎÒÃǵĴúÂ뽫ÔÚ0x500´¦Write Down.

ÒÔÏÂÓÃHiew±à¼­:
500
Call d,[40603C] ;00006054ÔÚ0x43C´¦,Call GetTickCount
push eax
push 4060B0 ;¸ñʽ»¯×Ö·û´®
push 4060E0 ;»º³åÇø
call d,[406048] ;call wsprintfA
push 0
push 4060D0 ;Caption
push 4060E0
push 0
call d,[40604C] ;call MessageBoxA
push 0
call d,[406040] ;call ExitProcess

  ½ÓÏÂÀ´ÎÒÃÇÐèÒª×öµÄ¾ÍÊÇһЩɨβ¹¤×÷,ÐÞ¸ÄImport TableµÄÆðʼλÖúʹóС,ÒÔ¼°³ÌÐòµÄÈë¿ÚµØÖ·
Ê£ÏÂÀ´µÄ¹¤×÷¾ÍÁô¸øÄãÁË!

  ÎÒµÄÕâ¸öÐ޸IJ»ÊǺÜÍêÉÆÒòΪûÓÐÂú×ãÌâÄ¿µÄÒªÇóËüÒªÓÃÒѾ­ÓÐÁ˵ÄExitProcess,¶øÎÒµÄÊÇ×Ô¼º½¨
µÄ!Èç¹û·µ»Øµ½405000,¼´ËüµÄÈë¿ÚµØÖ·,ÓÖ»á³ö´í!Èç¹ûË­ÖªµÀÇë¸æËßÎÒÒ»ÏÂ!Èç¹ûÀïÃæµÄ¶«Î÷²»ÊÇÌ«Çå
³þÇë¿´¿´½éÉÜPE½á¹¹µÄÊéºÍÎÒдµÄÆäËû¼¸ÆªÎÄÕÂ!



Made By dengkeng
E-mail:shellc0de@sohu.com
»¶Ó­×ªÔØ,Çë±£³ÖÎÄÕµÄÍêÕûÐÔ