首 页文章中心黑客工具黑吧学院技术论坛安全培训免费频道最近更新瑞星在线杀毒黑吧百度繁體中文
  设为首页
加入收藏
发布作品
   
栏目导航
· 漏洞利用 · 脚本注入
· 入侵实例 · 编程代码
· 逆向工程
热门文章
· 如何封别人QQ
· 充QQ币的疯狂——宽...
· 免费得QB
· 400秒远程攻破你的Q...
· [图文] QQ免费建400个群
· [组图] 给你一台永远不关机...
· [注意] QQ宠物砸蛋秘诀
· 再次有机会免费获得...
· 想的挂QQvip的进
· 在QQ中将自己从对方...
相关文章
· 逆向初步,增加XP记事...
· [图文] 逆向初步,增加XP记事...
XP记事本被我PE成垃圾
作者:佚名  来源:转载  发布时间:2008-6-26 7:57:12  发布人:黑客动画吧

减小字体 增大字体

文章作者:qiweixue

让我的Xp的记事本只允许打开一个事例,没有别的意思,只是看到满屏幕的记事本有些烦,顺便改一改
要用到一个API函数,FindWindowA来检测记事本的事例是否存在,IsDebuggerPresent检验NT调试器,同时,检测了OD的的存在用的是FindWindowA,用ShellExecuteA打开了htt:\www.pediy.com的网址,用打开了本地一OUTlook,可以同时到看雪,同时发邮件 还可以编辑文本(可是倒贴钱也没有人要,要是有兴趣,那自己做了一 个吧,)很简单;什么别的意思,代码不多
我在记事本里用到API函数,这里就不一一声明了,
用到是FindwindowA,LoadLibraryA GetProcAddress ShellExecuteA MessageBoxA等在www.baidu.com很好找到它们的声明;

工具:lordpe,  od,  Hex workshop
作者:QiWeiXue
声明:可以增强自己的调试能力,有利于(不知道)···
第一步,先用lordpe加入我们要引入的函数
第二步,再用od写代码;

下面要讲到;写入的代码不是很多;

第一步:
用lordpe就可以加你要的函数,(也可以用hex的写输入表,在引入函数,)不多说了;
对了,先把记事本的BoundImport表清0(不要绑定输入,我们好引入函数),lordpe打开记事本
选ImportTable表,add import 表,加入一个USER32.DLL库,在加上FindWindowA与MessageBoxA
选上这个view always Firstthunk,如下:
ThunkRva  ThunkOFfset  ThunkValue  Hint   APIName
00013027  00010227   0001300b   0000   FindWindowA  
0001302b  0001022b   00013019   0000   MessageBoxA
再加入一个kernel32.dll库,加一个ExitProcess ,API

ThunkRVA       Thunkoffset   ThunkValue  Hint     APIName
0001304e        0001024e    00013040    0000      ExitProcess
00013083        0001024e    0001024e    0000      LoadLibraryA
00013087        0001024e    0001024e    0000      GetProcAddress
            

好保存,ThunkRva(记好引入函数的RVA) 对我们有用,一会将用到;

第二步:
打开od改入口,让指令跳到我们的代码出,再找空隙;以下是我的及时本的OEP,要保留好,改完要用到;
01006AE0 N> $  6A 70         push 70
01006AE2   .  68 88180001     push NOTEPAD.01001888
01006AE7   .  E8 BC010000     call NOTEPAD.01006CA8
01006AEC   .  33DB          xor ebx,ebx
01006AEE   .  53           push ebx                           ; /pModule => NULL
01006AEF   .  8B3D 4C110001    mov edi,dword ptr ds:[<&KERNEL32.GetModuleHandl>; |kernel32.GetModuleHandleA
01006AF5   .  FFD7          call edi                           ; GetModuleHandleA
                     
好,原来没有改oep要记好了,改完要用到;

一下是我找的第一快空隙,空隙很好找;看到都是0000的大都就可以用,不都说了;
01007D71     00           db 00
01007D72     00           db 00
01007D73     00           db 00
01007D74     00           db 00
01007D75     00           db 00
01007D76     00           db 00
01007D77     00           db 00
01007D78     00           db 00
01007D79     00           db 00
01007D7A     00           db 00
01007D7B     00           db 00
01007D7C     00           db 00
01007D7D     00           db 00
01007D7E     00           db 00


这里我改好了所有代码,改好的OEP
我改了入口之后:
01006AE0 N> $  60           pushad
01006AE1   .  9C           pushfd
01006AE2   .  E9 8A120000     jmp NOTEPAD.01007D71  跳到找到的空隙
01006AE7   >  E8 BC010000     call NOTEPAD.01006CA8
01006AEC   .  33DB          xor ebx,ebx
01006AEE   .  53           push ebx                           ; e
01006AEF   .  8B3D 4C110001    mov edi,dword ptr ds:[<&KERNEL32.GetModuleHandl>;
01006AF5   .  FFD7          call edi                           ;


空隙要找足够大,第一次的时候,我就是空隙不足,很严重~我用加了新区块物理地址大小1000,够大了~~其实都浪费了:=()以下是我在空隙该里写入的代码:
01007D71   > 6A 00        push 0                            ; /Title = NULL
01007D73   .  68 E0810001    push NOTEPAD.010081E0                  ; |Class = "Notepad"
01007D78   .  FF15 27300101  call dword ptr ds:[<&user32.FindWindowA>]    ; FindWindowA
01007D7E   .  83F8 00      cmp eax,0
01007D81   .  74 1D        je short NOTEPAD.01007DA0
01007D83   .  90          nop
01007D84   .  6A 00        push 0                            ; /Style = MB_OK|MB_APPLMODAL
01007D86   .  68 F0810001    push NOTEPAD.010081F0                  ; |Title = " Only Run One; "
01007D8B   .  68 00820001    push NOTEPAD.01008200                  ; |Text = "Warning Only runing One~"
01007D90   .  6A 00        push 0                            ; |hOwner = NULL
01007D92   .  FF15 2B300101  call dword ptr ds:[<&user32.MessageBoxA>]    ; MessageBoxA
01007D98   >  6A 00        push 0                            ; /ExitCode = 0
01007D9A   .  FF15 4E300101  call dword ptr ds:[101304E]              ; ExitProcess
01007DA0   >  90          nop
01007DA1   .  6A 00        push 0                            ; /Style = MB_OK|MB_APPLMODAL
01007DA3   .  68 20820001    push NOTEPAD.01008220                  ; |Title = "First Runing Me"
01007DA8   .  68 40820001    push NOTEPAD.01008240                  ; |Text = "Hello,GoodLuck~"
01007DAD   .  6A 00        push 0                            ; |hOwner = NULL
01007DAF   .  FF15 2B300101  call dword ptr ds:[<&user32.MessageBoxA>]    ; MessageBoxA
01007DB5   .  90          nop
01007DB6   .  68 50820001    push NOTEPAD.01008250                  ; /pModule = "KERNEL32.dll"
01007DBB   .  FF15 4C110001  call dword ptr ds:[<&KERNEL32.GetModuleHandleA>; GetModuleHandleA
01007DC1   .  8BD0        mov edx,eax
01007DC3   .  68 60820001    push NOTEPAD.01008260                  ; /ProcNameOrOrdinal = "IsDebuggerPresent"
01007DC8   .  52          push edx                          ; |hModule
01007DC9   .  FF15 83300101  call dword ptr ds:[1013083]              ; GetProcAddress
01007DCF   .  8BD8        mov ebx,eax
01007DD1   .  90          nop
01007DD2   .  6A 00        push 0
01007DD4   .  FFD3        call ebx
01007DD6   .  83F8 00      cmp eax,0
01007DD9   .  74 17        je short NOTEPAD.01007DF2
01007DDB   .  6A 00        push 0                            ; /Style = MB_OK|MB_APPLMODAL
01007DDD   .  68 30820001    push NOTEPAD.01008230                  ; |Title = "Warning!!!"
01007DE2   .  68 74820001    push NOTEPAD.01008274                  ; |Text = "Can not debug me!!!:=("
01007DE7   .  6A 00        push 0                            ; |hOwner = NULL
01007DE9   .  FF15 2B300101  call dword ptr ds:[<&user32.MessageBoxA>]    ; MessageBoxA
01007DEF   .  90          nop
01007DF0   .^ EB A6        jmp short NOTEPAD.01007D98
01007DF2   >- E9 09A20000    jmp NOTEPAD.01012000  ==》》跳到我另一个空隙以为在往下写会pp的(很难看啊~~)

又一个空隙这一块代码就是上边条过来的(代码大多od都注释了,不在一一注释了)
01012000    68 90820001     push NOTEPAD.01008290                  ; ASCII "SHELL32.dll"
01012005    FF15 87300101    call dword ptr ds:[1013087]              ; kernel32.LoadLibraryA
0101200B    8BD0          mov edx,eax
0101200D    90           nop
0101200E    68 9C820001     push NOTEPAD.0100829C                  ; ASCII "ShellExecuteA"
01012013    52           push edx
01012014    FF15 83300101    call dword ptr ds:[1013083]              ; kernel32.GetProcAddress
0101201A    8BD0          mov edx,eax
0101201C    90           nop
0101201D    6A 05         push 5
0101201F    6A 00         push 0
01012021    6A 00         push 0
01012023    68 B0820001     push NOTEPAD.010082B0                  ; ASCII "http:\www.pediy.com:80"
01012028    68 AB820001     push NOTEPAD.010082AB                  ; ASCII "open"
0101202D    6A 00         push 0
0101202F    FFD2          call edx
01012031    68 90820001     push NOTEPAD.01008290                  ; ASCII "SHELL32.dll"
01012036    FF15 4C110001    call dword ptr ds:[<&KERNEL32.GetModuleHandleA>; kernel32.GetModuleHandleA
0101203C    8BD0          mov edx,eax
0101203E    90           nop
0101203F    68 9C820001     push NOTEPAD.0100829C                  ; ASCII "ShellExecuteA"
01012044    52           push edx
01012045    FF15 83300101    call dword ptr ds:[1013083]              ; kernel32.GetProcAddress
0101204B    8BD0          mov edx,eax
0101204D    90           nop
0101204E    6A 01         push 1
01012050    6A 00         push 0
01012052    6A 00         push 0
01012054    68 C8820001     push NOTEPAD.010082C8                  ; ASCII "mailtYouMailAddr@WebSite.com"
01012059    68 AB820001     push NOTEPAD.010082AB                  ; ASCII "open"
0101205E    6A 00         push 0
01012060    FFD2          call edx
01012062    90           nop
01012063    EB 04         jmp short NOTEPAD.01012069
01012065    90           nop
01012066    90           nop
01012067    90           nop
01012068    90           nop
01012069    68 50820001     push NOTEPAD.01008250                  ; ASCII "KERNEL32.dll"
0101206E    FF15 4C110001    call dword ptr ds:[<&KERNEL32.GetModuleHandleA>; kernel32.GetModuleHandleA
01012074    90           nop
01012075    8BD0          mov edx,eax
01012077    68 10830001     push NOTEPAD.01008310                  ; ASCII "CloseHandle"
0101207C    52           push edx
0101207D    FF15 83300101    call dword ptr ds:[1013083]              ; kernel32.GetProcAddress
01012083    A3 20830001     mov dword ptr ds:[1008320],eax
01012088    6A 00         push 0
0101208A    68 30830001     push NOTEPAD.01008330                  ; ASCII "Ollydbg"
0101208F    A1 27300101     mov eax,dword ptr ds:[<&user32.FindWindowA>]
01012094    FFD0          call eax
01012096    83F8 00        cmp eax,0
01012099  - 0F85 3C5DFFFF    jnz NOTEPAD.01007DDB
0101209F    6A 00         push 0
010120A1    68 38830001     push NOTEPAD.01008338                  ; ASCII "eXpLoRer"
010120A6    A1 27300101     mov eax,dword ptr ds:[<&user32.FindWindowA>]
010120AB    FFD0          call eax
010120AD    83F8 00        cmp eax,0
010120B0  - 0F85 255DFFFF    jnz NOTEPAD.01007DDB
010120B6    6A 00         push 0
010120B8    68 E8820001     push NOTEPAD.010082E8                  ; ASCII "Tankes:=)"
010120BD    68 F2820001     push NOTEPAD.010082F2                  ; ASCII "Program runing,Thank you!:=)"
010120C2    6A 00         push 0
010120C4    FF15 2B300101    call dword ptr ds:[<&user32.MessageBoxA>]    ; USER32.MessageBoxA
010120CA    9D           popfd         ;恢复栈
010120CB    61           popad
010120CC    6A 70         push 70          ;这就是原来的oep要恢复
010120CE    68 88180001     push NOTEPAD.01001888
010120D3  - E9 0F4AFFFF     jmp NOTEPAD.01006AE7   
010120D8    90           nop
010120D9    50           push eax
010120DA    8B1D 20830001    mov ebx,dword ptr ds:[1008320]
010120E0    FFD3          call ebx
010120E2  - E9 F45CFFFF     jmp NOTEPAD.01007DDB




原理很简单,不多说了!!!
~~~~很菜的,别见笑~~~~谢谢,你的支持~~~
GOOD LUCK FOR YOU AND FOR ME~~~
[ ] [返回上一页] [打 印] [收 藏]
 
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 网站导航 - 作品发布
互联网备案登记:粤ICP备05008775号
友情提示:浏览本站,请使用IE6.0浏览,并将分辩率设置为1024*768 为佳
Copyright © 2002-2005 Hack58.Com. All Rights Reserved .