通行证│用户名: 密码: 验证码: 验证码,看不清楚?请点击刷新验证码 电信网通铁通移动   在线
文章搜索:
热门搜索:红客 黑鹰 红客技术 安全动画 红客培训
首页 文章 软件 动画 资源 励志 论坛 邮箱 会员 军事 科技 博客 爱心红客 最近更新 800g资源
 业内新闻 漏洞公告 病毒公告 电脑知识 网络知识 菜鸟入门 攻防教程 黑客攻防 安全编程 工具使用 综合安全 个人安全 安全相关 Q Q安全 原创精华 红客人物 站内事件
您现在的位置: 爱国者安全网 >> 文章类 >> 红客教程 >> 网络攻防 >> 文章正文
《加密解密 技术内幕》 3.1 病毒是如何抗动态测试
责任编辑:酷酷の鱼   更新日期:2008-3-14
 

来源:安全中国

我们来讲讲如何在Debugger这样的软件中生存——呵呵,她执行了病毒然后作内存分析 
;----------简单的代码做出重要的事情------------ 
.586p 
.model flat 
extrn GetProcAddress:PROC 
extrn GetModuleHandleA:PROC 

extrn MessageBoxA:PROC 
extrn ExitProcess:PROC 

.data 
szTitle db "IsDebuggerPresent Demonstration",0 
msg1 db "Application Level Debugger Found",0 
msg2 db "Application Level Debugger NOT Found",0 
msg3 db "Error: Couldn’t get IsDebuggerPresent.",10 
db "We CAN’T RUN under Win95",0 ;作了测试。。。证明不行 

@IsDebuggerPresent db "IsDebuggerPresent",0 
K32 db "KERNEL32",0 

.code 

antidebug: 
push offset K32 ; 取kernel32的base地址 
call GetModuleHandleA 
or eax,eax ; 检测是否失败 
jz error 

push offset @IsDebuggerPresent ;得到函数地址 
push eax ; 压入堆栈 
call GetProcAddress ; ~~~!!~~可能产生错误 
or eax,eax 
jz error 

call eax ; 调用IsDebuggerPresent 

or eax,eax ; 如果不等于 0,就说明有人在分析我们的代码 
jnz debugger_found ;那就——呵呵,要做什么?你想作什么?那就作吧。。 

debugger_not_found: 
push 0 ;显示"Debugger not found" 
push offset szTitle 
push offset msg2 ;呵呵,你知道这里做的事情。。。 
push 0 
call MessageBoxA 
jmp exit 

error: 
push 00001010h ; WIN95我们不能运行。。。 
push offset szTitle 
push offset msg3 
push 0 
call MessageBoxA 
jmp exit 

debugger_found: 
push 00001010h ; 显示 "Debugger found!" 
push offset szTitle 
push offset msg1 ;你也可以做些其他的事 
push 0 
call MessageBoxA 

exit: 
push 00000000h ; 退出 
call ExitProcess 

end antidebug 

不过这样只是躲了——可是我们应该防止这种事情 
呵呵,这就是SEH的妙用了 
;----------简单的代码做出重要的事情------------ 
.386p 
.model flat 

extrn MessageBoxA:PROC 
extrn ExitProcess:PROC 

.data 

szTitle db "Structured Exception Handler example",0 
szMessage db "Intercepted General Protection Fault!",0 

.code 

start: 
call setupSEH ; 标准的方法。。。。 


exceptionhandler: 
mov esp,[esp+8] ;不明白别问我 


push 00000000h ; 引发MessageBoxA 
push offset szTitle 
push offset szMessage 
push 00000000h 
call MessageBoxA 

push 00000000h 
call ExitProcess ; 退出 

setupSEH: 
push dword ptr fs:[0] ; 得到SEH局柄 
mov fs:[0],esp ;创建新局柄 


mov ebx,0BFF70000h ; 写入核地址 
mov eax,012345678h 
xchg eax,[ebx] 

end start 
这个代码在win2k上容易出错(原因我不知道)——所以呵呵,我在白白那里看到了下面的好代码。。。 
;Author: whg 
;Email: whg@whitecell.org 
;Homepage:http://www.whitecell.org 
.386p 
.model flat,stdcall 

extrn MessageBoxA: proc 
extrn ExitProcess: proc 

.data 

Msg db ’ERROR’,0 

SetSehFrame: ;ecx=忽略错误继续执行地址 
pop eax ;弹出返回地址 
push ecx ;保存忽略错误继续执行地址 
call PushExceptionProc 
jmp short Exception 
PushExceptionProc: 
push fs:dword ptr[0] 
mov fs:[0],esp 
call GetEspAddr 
push D [edx] ;保存原Esp地址值 
mov [edx],esp 
jmp eax 
ClearSehFrame: 
pop eax ;弹出返回地址 
call GetEspAddr 
mov esp,[edx] 
pop D [edx] ;恢复原Esp地址值 
pop fs:dword ptr[0] 
pop ecx 
pop ecx ;弹出忽略错误继续执行地址 
jmp eax 

[1] [2] 下一页

  • 上一篇文章:
  • 下一篇文章:
  • 最近更新
    固顶文章 Delphi编程培训班开课了
    普通文章 万元赏金 寻找动易SiteWeaver CMS/eShop 产品安全漏洞
    普通文章 瑞星公司03月15日发布 每日计算机病毒及木马播报
    推荐文章 [推荐]Windows用户摆脱黑客攻击的方法
    普通文章 加密与你零距离 个人隐私不泄露!
    普通文章 解开高强度文件夹加密大师里面的"秘密"
    普通文章 运用Windows命令 识别木马蛛丝马迹
    普通文章 拔营起寨 插入式木马的清除方法!
    普通文章 电脑菜鸟必懂 常见木马连接的原理
    普通文章 计算机在中毒后的五大紧急处理措施
    热门文章
    普通文章安全你我他:IPS与IDS技术路向何方?
    普通文章企业用户防御网络威胁十要素
    普通文章使用360安全卫士 教你五分钟搞定装机
    普通文章针对性防御手段 十招教你应对邮件欺诈
    普通文章设置Web邮箱黑客警报器 防止财务损失
    普通文章Discuz! 6 后台拿Shell的方法
    普通文章如何使电脑无法更改系统用户名
    推荐文章推荐:XSS攻击Cookie欺骗中隐藏JavaScript执行
    普通文章瑞星公司03月05日发布 每日计算机病毒及木马播报
    普通文章微软证实Hotmail登录故障未解决 遭用户抗议
    精彩专题