T1059.007: JavaScript
摘要
攻击者可能滥用 JavaScript 的各种实现进行执行。JavaScript (JS) 是一种平台无关的脚本语言(在运行时即时编译),通常与网页中的脚本相关联,不过 JS 也可以在浏览器之外的运行时环境中执行。(Citation: NodeJS) JScript 是同一脚本标准的 Microsoft 实现。JScript 通过 Windows Script 引擎解释,因而与 Windows 的许多组件集成,例如 [Component Object Model](https://attack.mitre.org/techniques/T1559/001) 和 Internet Explorer HTML 应用程序(HTA)页面。(Citation: JScrip May 2018)(Citation: Microsoft JScript 2007)(Citation: Microsoft Windows Scripts) JavaScript for Automation (JXA) 是一种基于 JavaScript 的 macOS 脚本语言,作为 Apple 开放脚本架构(OSA)的一部分包含在内,在 OSX 10.10 中引入。Apple 的 OSA 提供脚本功能来控制应用程序、与操作系统交互,并桥接访问 Apple 其余内部 API。自 OSX 10.10 起,OSA 仅支持两种语言:JXA 和 [AppleScript](https://attack.mitre.org/techniques/T1059/002)。脚本可以通过命令行实用程序 <code>osascript</code> 执行,可以通过 <code>osacompile</code> 编译成应用程序或脚本文件,也可以通过利用 OSAKit 框架在其他程序的内存中编译和执行。(Citation: Apple About Mac Scripting 2016)(Citation: SpecterOps JXA 2020)(Citation: SentinelOne macOS Red Team)(Citation: Red Canary Silver Sparrow Feb2021)(Citation: MDSec macOS JXA and VSCode) 攻击者可能滥用 JavaScript 的各种实现来执行各种行为。常见用途包括将恶意脚本托管在网站上作为 [Drive-by Compromise](https://attack.mitre.org/techniques/T1189) 的一部分,或下载并执行这些脚本文件作为二级载荷。由于这些载荷是基于文本的,攻击者也非常常见地将其内容混淆作为 [Obfuscated Files or Information](https://attack.mitre.org/techniques/T1027) 的一部分。
来源归属
来源:MITRE ATT&CK · 置信度:high
平台
- Linux
- macOS
- Windows
战术
执行
参考来源
- https://attack.mitre.org/techniques/T1059/007
- https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/index.html
- https://www.mdsec.co.uk/2021/01/macos-post-exploitation-shenanigans-with-vscode-extensions/
- https://docs.microsoft.com/archive/blogs/gauravseth/the-world-of-jscript-javascript-ecmascript
- https://docs.microsoft.com/scripting/winscript/windows-script-interfaces
- https://docs.microsoft.com/windows/win32/com/translating-to-jscript
- https://nodejs.org/
- https://www.sentinelone.com/blog/macos-red-team-calling-apple-apis-without-building-binaries/
- https://posts.specterops.io/persistent-jxa-66e1c3cd1cf5
- https://redcanary.com/blog/clipping-silver-sparrows-wings/