|
[求助]一段shellcode的汇编执行错误
我以前写的一个查找kernel32.dll基址,并根据名称查找函数地址的ShellCode,已经注释得很清楚了,XP和WIN7通用 jmp ShellCodeStart Addr_IAT_LoadLibraryA dd 402000h ;LoadLibraryA在IAT中的地址,由注入函数写入 Addr_LoadLibraryA dd 7C801D77h ;LoadLibraryA的地址,由注入函数写入,在ShellCode + 2 + 4处 Addr_VirtualProtectName db "VirtualProtect",0 ;VirtualProtect名称的地址 Addr_LoadDllName db "InputDll.dll",0 ShellCodeStart: push ebx push ecx push edx push esi push edi push ebp xor ecx, ecx ;查找kernel32.dll基址放入eax,xor ecx, ecx不可丢 assume fs:nothing mov esi, fs:[30h] ;取PEB mov esi, [esi+0Ch] mov esi, [esi+1Ch] InInitializationOrderModuleList: mov eax, ds:[esi+8] mov edi, ds:[esi+20h] mov esi, ds:[esi] cmp WORD ptr ds:[edi+18h],cx jnz InInitializationOrderModuleList push ebp call RelocLocation ;push eip,eip = 新RelocLocation的地址 RelocLocation: pop ebp ;将eip出栈给ebp,ebp = 新RelocLocation的地址 sub ebp, offset RelocLocation ;ebp = ebp - offset RelocLocation(原RelocLocation地址)= 新旧地址的差值(参考重定位),后续需重定位的地址 = 原地址 + ebp mov ecx, ebp ;取Addr_VirtualProtectName重定位后的地址并压栈 add ecx, offset Addr_VirtualProtectName invoke GetAPI, eax, ecx, 14 ;调用GetAPI获取VirtualProtect的地址 mov ebx, eax ;将获取的地址放入ebx中 mov eax, ebp ;取Addr_LoadDllName重定位后的地址并压栈 add eax, offset Addr_LoadDllName push eax lea esi, [ebp + Addr_LoadLibraryA] ;取Addr_LoadLibraryA重定位后的地址,并调用LoadLibraryA call DWORD ptr [esi] ;API为stdcall调用,自平衡堆栈 mov edi, [ebp + Addr_IAT_LoadLibraryA] ;取LoadLibraryA在IAT的地址 push eax ;随便压栈一个数,我们要用这个数的地址作为VirtualProtect的lpflOldProtect的地址,因为ShellCode的代码段不可写,只能用堆栈返回 push esp ;调用VirtualProtect修改IAT的写保护 push PAGE_READWRITE push 4 push edi call ebx pop eax mov eax, [esi] ;[esi] = LoadLibraryA的地址 mov [edi], eax ;将LoadLibraryA在IAT的地址改为IDHookLoadLibraryA的地址 pop ebp ;平衡 pop ebp pop edi pop esi pop edx pop ecx pop ebx jmp eax ;跳转至LoadLibraryA继续执行 GetAPI proc _Kernel32Base:DWORD, _szAPIName:DWORD, _APINameLength:DWORD local @SizeOfFNT:DWORD local @APIAddr:DWORD pushad mov ebx, _Kernel32Base assume ebx:ptr IMAGE_DOS_HEADER add ebx, [ebx].e_lfanew ;取PE的首地址,即PE标志位 assume ebx:ptr IMAGE_NT_HEADERS mov ebx, [ebx].OptionalHeader.DataDirectory.VirtualAddress add ebx, _Kernel32Base assume ebx:ptr IMAGE_EXPORT_DIRECTORY mov eax, [ebx].NumberOfNames ;将函数总数乘以4,得FNT表大小 shl eax, 2 mov @SizeOfFNT, eax mov edi, [ebx].AddressOfNames ;获取输出表API名称查询表(FNT)RVA add edi, _Kernel32Base ;获取输出表API名称查询表(FNT)内存地址 mov esi, _szAPIName mov ecx, _APINameLength xor edx, edx xor eax, eax ;eax置0 .while edx < @SizeOfFNT ;遍历Dll所有函数名称,当计数edx=Dll函数总数时退出循环 push ecx ;保存字符串长度 push edi ;保存edi,比较API名称 push esi mov edi, [edi] ;取API名称的RVA add edi, _Kernel32Base ;取API名称的内存地址 cld repe cmpsb pop esi ;将esi重新指向_szAPIName首地址 pop edi pop ecx jnz FAA_FindExportAPIAddr_NoFind ;如果ecx=0,说明函数字符全部相同 mov eax, [ebx].AddressOfFunctions ;取FAT表RVA add eax, _Kernel32Base ;取FAT表RVA内存地址 add eax, edx ;取查找函数FAT表项的地址 mov eax, [eax] ;取查找函数的RVA add eax, _Kernel32Base ;取查找函数的内存地址 mov @APIAddr, eax .break ;找到则退出循环 FAA_FindExportAPIAddr_NoFind: add edx, 4 ;计数+4指向下一个FNT表项 add edi, 4 ;edi指向下一个FNT表项 .endw assume ebx:nothing popad mov eax, @APIAddr ret |
|
[原创]硬件条件断点插件源码!!!(我的第一次)
我试了也不起作用- - |
|
[讨论]写不下去了,发上来求继续,重载内核加自定义异常
你这个是写好了还是没写好.... |
|
[原创]告别硬编码-发个获取未导出函数地址的Dll及源码
还有就是高手握着技术不肯发,网上这方面的资料真的很少,写这个前我百度了半天大概只搜到3、4份源码,而且没一份能在我机子上编译成功的,或者编译成功了导出的结果老是为0,还有就是一些必须的文件基本没人提供,真正完善的资料还只有微软的dbghelp的说明文件,可惜是英文的,可能一般人也不愿意去看。 |
|
[原创]告别硬编码-发个获取未导出函数地址的Dll及源码
高手都知道,一般的都是用硬编码或者暴搜吧,估计版主不是因为方法加精,主要是由于自己写符号文件查找很繁琐,我给个Dll给大家直接调用就方便多了,源码我也给了,主要想有更多的人再增加些功能,能像windbg的符号显示一样就完美了 |
|
|
|
中国的聊天软件有什么不足?QQ YY等等
QQ广告太多,弹窗太多,不搞会员还去不掉,烦 |
|
|
|
[求助]这个mov是什么意思
对齐用的,相当于2个nop |
|
利用窗口标题查找窗口,怎么来找到属于自己程序的窗口?
每个窗口不是有一个自己的句柄,在程序启动时保存你要查找的那个窗口句柄,然后要用的时候枚举窗口句柄进行比较 |
|
[求助]使用PsSetCreateProcessNotifyRoutine监控进程退出产生多个进程
找到原因了,回调函数CallCreateProcessNotifyRoutines中不能嵌套调用PsSetCreateProcessNotifyRoutine解除设置的回调函数,否则就会产生我上面帖子所说的连XT都杀不死的进程(每嵌套调用一次就会多产生一个),将PsSetCreateProcessNotifyRoutine(CallCreateProcessNotifyRoutines, TRUE)提出来放在其他地方调用就没这问题了 PS:这不是不是可以用来搞不死进程呢,这样产生的进程在任务管理器中是看不见的。 |
|
完整注释汇编聊天软件,客户端代码,可聊天了,希望有人可以帮我完善。
爱咋干就咋干,没人能阻拦你,成功的人放个屁大家都会觉得香,没成功之前少不了别人的不理解的。上班要干自己不喜欢的事,业余了还不能自由的做自己想干的事情,生活还有什么意思呢。 |
|
完整注释汇编聊天软件,客户端代码,可聊天了,希望有人可以帮我完善。
支持下楼主,呵呵,又碰到一个和我一样热爱汇编的同志了,自从学习汇编以来,一直坚持ring3下的程序一律用汇编写,不为了别的,只为了提高自己的看汇编代码的功力。 当然,汇编写界面确实是短板,用易,用C#等一些高级语言拖拖拉拉就能写出一个ring3下的程序出来,开发大型程序汇编就乏力了,干一些邪恶事情的的时候才是汇编大显身手的地方。 最后透露个汇编写程序的心得:不知道楼主发现没,调试汇编写的程序是最简单的,也是最容易发现BUG的 |
|
[求助]Inline Hook KiDispatchException遭遇奇怪的蓝屏
找到原因了,由于inline Hook内核函数之后新跳转的函数内我预留了一段nop代码用来写入代码,没用cr0去除写保护,加上后就不蓝了,不过以前都是直接在自己函数的预留nop代码或int代码中写代码的,不除写保护都没蓝过,而且上面的代码中为什么不调用test()不蓝,调用就蓝还是不懂,有点莫名其妙的感觉 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值