概述
红蓝对抗中,如何能够对渗透测试的目标进行长期控制,绕过操作系统的安全检测和防护软件的查杀检测,长久进行后门植入,进行长期的攻防对抗,这是一个非常值得深入研究的技术话题,笔者对国内某款办公处理软件,进行技术研究,就基于此办公处理处理软件进行后门植入和控守作为示例,进行技术演示。例,进行技术演示。
控守思路
诸如办公处理软件,Adobe Reader和某PDF阅读器都是每个人常用的办公处理类的软件,标准配置。在红蓝对抗的渗透测试中,基于办公处理软件来做到长期控守,后门工具能够依托于办公处理软件启动而运行,工具隐藏程度深,可作为办公处理软件的正常功能来使用,做到操作系统环境中不闪、不弹、不卡,隐蔽执行。
确认了研究思路框架,接下来就是如何达到控守的目标,分几步走,以及是否有比较完美的解决方案?
带着这些问题,我进行了以下研究。
安装分析
首选安装包
控守目标选择的是办公处理软件,首先从安装包开始进行分析,安装包大致上可以分为 络安装包和离线安装包,两者都可以进行分析,找出安装包执行过程中,存在的弱点,校验是否有可利用的点,如下:
某办公处理软件的安装包拷贝到桌面,使用ProcessMonitor监控执行过程中的行为,安装过程中可以观察到很有意义的输出。
NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopMSIMG32.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopWINSPOOL.DRV NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopoledlg.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopurlmon.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopVERSION.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopIPHLPAPI.DLL NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopWININET.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopUSERENV.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopOLEACC.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopWINMM.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopiertutil.dll NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktopOLEACCRC.DLL NoFinishPage_foucs_app.exe CreateFile C:UsersAdminDesktop4_GA_NoFinishPage_foucs_appCHS.dll
安装包会在桌面路径C:UsersAdminDesktop来搜索和加载DLL文件,很不合理,应该从C:windows和C:windowssystem32文件夹路径搜索和加载DLL。
再来看另一个办公处理软件的安装包执行记录,也存在同样的问题:
test_office_inst.exe CreateFile C:UsersAdminDesktopIphlpapi.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopWldp.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktoptest_office_inst.exe.Local NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktoptest_office_inst.exe.Local NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopmsimg32.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopWINHTTP.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopwebio.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopwinnlsres.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopSspiCli.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopwhite_list.data NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopTextShaping.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopDWrite.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopWindowsCodecs.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopncrypt.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopMSASN1.dll NAME NOT FOUND test_office_inst.exe CreateFile C:UsersAdminDesktopDPAPI.DLL NAME NOT FOUND
再来校验一下DLL模块调用堆栈:
ntdll.dll RtlUpcaseUnicodeChar + 0x1b1 0x7701f341 C:WindowsSysWOW64ntdll.dllntdll.dll RtlMultiAppendUnicodeStringBuffer + 0x1e8 0x7701f7f8 C:WindowsSysWOW64ntdll.dllntdll.dll LdrLoadDll + 0xf6 0x7701fdc6 C:WindowsSysWOW64ntdll.dllKernelBase.dll LoadLibraryExW + 0x156 0x7630ec56 C:WindowsSysWOW64KernelBase.dllKernelBase.dll LoadLibraryA + 0x42 0x7630f772 C:WindowsSysWOW64KernelBase.dll // 调用LoadLibraryA() 函数test_office_inst.exe test_office_inst.exe + 0xf3253 0x643253 C:UsersAdminDesktoptest_office_inst.exetest_office_inst.exe test_office_inst.exe + 0xf408d 0x64408d C:UsersAdminDesktoptest_office_inst.exe
部分DLL文件是通过LoadLibraryA()函数进行调用执行加载动作。
办公处理软件的安装包在安装过程中就存在DLL路径加载的问题,这给我们达到控守的目标创造了条件,其次软件安装包在执行过程中windows操作系统的权限校验,特别是UAC已经是用户同意了的,后门工具执行不会遇到执行权限上的障碍。
运行时后门植入分析
办公处理软件的安装包正常运行结束,办公处理软件也能够正常运行工作,使用工具来分析办公处理软件运行中的行为。
其中一个办公处理软件,安装目录是:
C:UsersAdminAppDataLocalSoftwareOffice11.23.548.10152office6
首先来看,目录是当前用户,这意味着当前用户拥有对软件安装目录的所有权限,包括读写、删除和执行,其次配合其他的安全问题,比如任意文件移动、任意文件写,或者文件释放的安全方面问题,最后达到的效果就是在办公处理软件目录下可进行任意操作。
一个相较于特殊的情况是办公处理软件在操作系统层面是默认在系统白名单中,普通用户也不会留意软件的某些恶意行为,相对较为隐蔽。
再来看另外一个办公处理软件,虽然其安装目录是C:Program Files (x86)PDF SoftwarePDF Reader,但是更新程序的加载目录却是当前用户目录,如下:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!