T1059.002: AppleScript
摘要
攻击者可能滥用 AppleScript 进行执行。AppleScript 是一种 macOS 脚本语言,设计用于通过称为 AppleEvents 的应用程序间消息来控制应用程序和操作系统的各个部分。(Citation: Apple AppleScript)这些 AppleEvent 消息可以独立发送,也可以用 AppleScript 轻松编写脚本。这些事件可以定位打开的窗口、发送按键,并在本地或远程与几乎任何打开的应用程序交互。 脚本可以通过命令行运行,使用 <code>osascript /path/to/script</code> 或 <code>osascript -e "script here"</code>。除命令行外,脚本还可以通过多种方式执行,包括邮件规则、Calendar.app 闹钟和 Automator 工作流。AppleScript 也可以通过脚本文件开头添加 <code>#!/usr/bin/osascript</code> 而作为纯文本 shell 脚本执行。(Citation: SentinelOne AppleScript) AppleScript 不需要调用 <code>osascript</code> 来执行。然而,它们可以通过使用 macOS [Native API](https://attack.mitre.org/techniques/T1106) 的 <code>NSAppleScript</code> 或 <code>OSAScript</code> 从 mach-O 二进制文件内部执行,这两者都独立于 <code>/usr/bin/osascript</code> 命令行工具执行代码。 攻击者可能滥用 AppleScript 来执行各种行为,例如与打开的 SSH 连接交互、移动到远程机器,甚至向用户呈现伪造的对话框。这些事件不能远程启动应用程序(它们只能在本地启动),但如果应用程序已在远程运行,它们可以与之交互。在 macOS 10.10 Yosemite 及更高版本上,AppleScript 能够执行 [Native API](https://attack.mitre.org/techniques/T1106),否则这些 API 需要以 mach-O 二进制文件格式编译和执行。(Citation: SentinelOne macOS Red Team)由于这是一种脚本语言,它也可以用于启动更常见的技术,例如通过 [Python](https://attack.mitre.org/techniques/T1059/006) 反弹 shell。(Citation: Macro Malware Targets Macs)
来源归属
来源:MITRE ATT&CK · 置信度:high
平台
- macOS
战术
执行
参考来源
- https://attack.mitre.org/techniques/T1059/002
- https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
- https://www.sentinelone.com/blog/macos-red-team-calling-apple-apis-without-building-binaries/
- https://www.sentinelone.com/blog/how-offensive-actors-use-applescript-for-attacking-macos/
- https://www.mcafee.com/blogs/other-blogs/mcafee-labs/macro-malware-targets-macs/