一、Coyote 银行木马介绍
1、Coyote 银行木马概述
-
名称:Coyote
-
类型:Windows 平台银行木马
-
首次发现时间:2024年6月-7月左右(由ThreatFabric首次披露)
-
特点:首个已知利用 Windows UI Automation(UIA) 框架窃取银行凭据的木马
-
目标:主要针对巴西金融机构,但可能扩展到其他地区
2、利用 Windows UI Automation(UIA)框架的方式
1. 什么是 UI Automation?
-
UIA 是 Windows 提供的一种辅助功能框架
-
设计初衷:让残障用户通过屏幕阅读器等工具更好地操作图形界面(GUI)
-
提供程序接口(API):开发人员和辅助工具可以读取和操纵 UI 元素(如按钮、文本框等)
-
2. Coyote 如何滥用 UIA?
Coyote 恶意软件滥用 UIA 的能力来:
-
监听并读取 GUI 中的文本字段内容(如用户名、密码)
-
捕捉敏感表单中的输入信息,绕过传统的键盘记录器检测机制
-
检测和识别特定银行的窗口和表单字段
这意味着:即使输入字段受到防键盘记录器保护,Coyote 仍然可以通过 UIA 抓取显示内容。
3、技术实现与攻击链
1. 技术栈
-
用 C# 编写(这是与其它传统用 Delphi 或 C++ 编写的银行木马的差异之一)
-
使用**.NET 8 和 NativeAOT(提前编译)**
-
可生成不依赖.NET运行时的独立可执行文件
-
有利于规避杀毒软件对.NET运行时特征的监测
-
2. 主要行为流程
步骤 | 行为描述 |
---|---|
1 | 伪装为合法安装程序(如驱动、证书工具)进行传播 |
2 | 安装后运行时自动调用 System.Windows.Automation API |
3 | 探测目标应用(银行客户端窗口或浏览器) |
4 | 利用 UIA 枚举 UI 元素,获取输入框内容 |
5 | 将收集的敏感数据通过加密通道发送回攻击者服务器 |
4、规避检测手段
Coyote 具备较强的隐蔽性:
-
利用 UIA 读取界面控件内容,规避传统键盘记录检测
-
使用 NativeAOT 编译方式,生成不易被静态分析的无托管 PE 文件
-
通过合法签名或捆绑软件隐藏自己
-
可能在虚拟机/沙箱环境下不运行(反沙箱机制)
5、已知攻击目标与传播方式
-
目标地区:主要针对拉丁美洲(尤其是巴西的银行)
-
传播方式:
-
冒充银行技术支持或驱动更新网站
-
通过社交工程诱导用户下载安装程序(例如假冒 Itaú 或 Bradesco 银行的证书更新工具)
-
6、潜在影响与安全建议
影响
-
新一代信息窃取技术:利用 UIA 提供的“合法接口”进行“非传统键盘监听”
-
难以检测:杀软不容易察觉 UI Automation 调用为恶意行为
-
影响扩大风险:未来可能被其他木马或 APT 模仿
安全建议
-
禁用 Windows UI Automation 功能(如无必要)
-
加强 EDR 行为分析能力,关注非预期的 UIA API 调用行为
-
加密用户输入或采用屏幕键盘、图形密码等方式降低被 UIA 窃取的风险
-
使用具备“行为沙箱分析”的安全防护软件(可识别 UIA 滥用行为)
-
尽量在银行操作中启用多因素认证(MFA),增加攻破难度
7、总结
Coyote 是一种具有前瞻性的银行木马,它开创性地利用了 Windows 系统的无障碍机制(UI Automation)进行信息窃取,这类技术规避了传统防护手段,预示着未来恶意软件将更多地“借道合法系统接口”来实现攻击目标。
二、检测规则、关闭 UIA 功能的策略脚本
1、Coyote 木马使用的 UIA 信息窃取 PoC(C# 实现)
这个 PoC 演示如何使用 System.Windows.Automation
命名空间中的 API 枚举当前窗口中的控件并读取其内容,从而模拟 Coyote 的关键技术。
using System;
using System.Windows.Automation;
class UIADataStealerPoC
{
static void Main()
{
Console.WriteLine("[*] 开始枚举所有窗口中的文本控件...");
// 获取桌面级自动化元素(即屏幕根节点)
AutomationElement desktop = AutomationElement.RootElement;
// 枚举所有子窗口
Condition condition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window);
AutomationElementCollection windows = desktop.FindAll(TreeScope.Children, condition);
foreach (AutomationElement window in windows)
{
Console.WriteLine($"[+] 窗口:{window.Current.Name}");
// 寻找文本框(Edit 控件)
Condition textBoxCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
AutomationElementCollection edits = window.FindAll(TreeScope.Descendants, textBoxCondition);
foreach (AutomationElement edit in edits)
{
try
{
string content = (edit.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern)?.Current.Value;
if (!string.IsNullOrEmpty(content))
{
Console.WriteLine($" [!] 捕获内容:{content}");
}
}
catch (Exception ex)
{
Console.WriteLine($" [x] 读取失败: {ex.Message}");
}
}
}
}
}
⚠️ 说明:此代码仅用于教育目的,模拟UIA工作原理,切勿用于非法用途!
2、如何在系统中禁用 UI Automation(组策略或注册表)
方法一:通过注册表禁用 UIA(推荐给企业环境)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Accessibility]
"DisableAT"=dword:00000001
重启系统后生效。此操作会禁止系统加载辅助工具(包括屏幕阅读器和自动化脚本),但可能影响残障用户使用辅助设备。
3、YARA 检测规则(匹配 Coyote NativeAOT 构建特征 + UIA调用)
rule Coyote_UIA_Malware_NativeAOT
{
meta:
author = "chatgpt"
description = "Detects Coyote-like malware abusing UIA with NativeAOT .NET"
reference = "https://www.threatfabric.com/"
version = "1.0"
strings:
$s1 = "System.Windows.Automation.AutomationElement" ascii
$s2 = "System.Windows.Automation.ControlType" ascii
$s3 = "ValuePattern" ascii
$aot1 = "System.Private.CoreLib.NativeAOT" ascii
$aot2 = "NativeAOT-LLVM" ascii
condition:
2 of ($s*) and 1 of ($aot*)
}
4、使用 PowerShell 检测正在运行的 UIA 窃取行为(行为监测)
Get-Process |
Where-Object {
$_.Path -ne $null -and
(Get-Content $_.Path -Raw -ErrorAction SilentlyContinue) -match "System\.Windows\.Automation"
} |
Select-Object Name, Path
5、防御建议总结(安全团队可执行操作)
项 | 建议 |
---|---|
☑ | 禁用无障碍功能(注册表或组策略) |
☑ | 使用 EDR 工具,设规则检测对 System.Windows.Automation 命名空间的频繁调用 |
☑ | 监控 .NET NativeAOT 编译文件在终端中的异常执行(通常文件体积小、导入表稀少) |
☑ | 金融客户端引入防 UI Automation 技术,如 SecureTextBox、自绘控件等 |
6、基于 Sysmon + WEF/QRadar 的 Coyote 类 UI Automation 恶意行为检测规则
目标是:发现滥用 Windows UI Automation API 的恶意程序行为,适用于部署了 Sysmon + SIEM(如 QRadar、Splunk、ELK) 的企业环境。
1. Sysmon 配置规则(sysmonconfig.xml
片段)
监控 .NET NativeAOT
加载 + UIA 自动化命名空间调用
<!-- 监控模块加载事件 -->
<EventFiltering>
<ImageLoad onmatch="include">
<!-- System.Windows.Automation 相关 DLL -->
<Image condition="contains">UIAutomationClient.dll</Image>
<Image condition="contains">UIAutomationTypes.dll</Image>
</ImageLoad>
<!-- 监控对 .NET NativeAOT 文件的加载 -->
<ImageLoad onmatch="include">
<Image condition="ends with">.exe</Image>
<ImageLoaded condition="contains">NativeAOT</ImageLoaded>
</ImageLoad>
<!-- 检测子进程执行,例如通过社会工程安装程序启动 -->
<ProcessCreate onmatch="include">
<CommandLine condition="contains">setup</CommandLine>
<CommandLine condition="contains">install</CommandLine>
</ProcessCreate>
</EventFiltering>
2. Windows Event Forwarding + QRadar/Splunk SIEM 规则(简化示例)
QRadar AQL 查询规则示例(搜集 Sysmon Event ID 7 + DLL 加载)
SELECT * FROM events
WHERE
(eventID = 7 OR eventID = 10)
AND UTF8(payload) ILIKE '%UIAutomation%'
AND NOT UTF8(payload) ILIKE '%Microsoft%'
AND LOGSOURCETYPENAME(devicetype) ILIKE 'Microsoft Sysmon%'
Splunk 查询(SPL)示例:
index=sysmon (EventCode=7 OR EventCode=10)
| search ImageLoaded="*UIAutomation*"
| stats count by Image, ImageLoaded, ProcessId, CommandLine, ParentImage
3. 行为异常检测建议
行为特征 | 分析说明 |
---|---|
加载 UIAutomationClient.dll 的进程不是 explorer.exe 或 Narrator.exe 等系统组件 | 极可能是恶意滥用 |
.exe 为 NativeAOT 编译格式,文件小但功能强 | 可标记为“潜在无托管执行器” |
命令行中含有诱导性关键词,如“setup”、“driver”、“certificate” | 高风险传播渠道行为 |
4. 示例可疑日志匹配截图(假设 Sysmon 日志)
EventID: 7 (ImageLoad)
Image: C:\Users\Victim\AppData\Roaming\coyote.exe
ImageLoaded: C:\Windows\System32\UIAutomationClient.dll
Description: 非系统程序加载了辅助功能 DLL
7、额外补充:使用 Sysmon + MITRE ATT&CK 映射
Tactic | Technique | Description |
---|---|---|
Credential Access | T1056.002 | 输入捕获(GUI Automation) |
Defense Evasion | T1218 | Signed Binary Proxy Execution(NativeAOT) |
Discovery | T1082 | System Information Discovery |
8、总结
你现在掌握的内容包括:
-
✅ PoC 演示代码(使用 UIA 获取窗口控件内容)
-
✅ 禁用 UIA 的注册表策略
-
✅ YARA 规则(用于检测 Coyote 类行为)
-
✅ Sysmon + SIEM 检测规则(QRadar/Splunk 均适配)
-
✅ 攻击行为映射至 MITRE ATT&CK