MITRE ATT&CK / Techniques / T1059.007

Command and Scripting Interpreter: JavaScript

ID
T1059.007
Tactics
TA0002 Execution
Sub-technique of
T1059 Command and Scripting Interpreter
Platforms
Linux, macOS, Windows
Data sources
Process Creation, Script Execution, Module Load, Command Execution
Source
attack.mitre.org
MITRE last modified
12 May 2026

Adversaries may abuse various implementations of JavaScript for execution. JavaScript (JS) is a platform-independent scripting language (compiled just-in-time at runtime) commonly associated with scripts in webpages, though JS can be executed in runtime environments outside the browser.[2]

JScript is the Microsoft implementation of the same scripting standard. JScript is interpreted via the Windows Script engine and thus integrated with many components of Windows such as the Component Object Model and Internet Explorer HTML Application (HTA) pages.[3][4][5]

JavaScript for Automation (JXA) is a macOS scripting language based on JavaScript, included as part of Apple’s Open Scripting Architecture (OSA), that was introduced in OSX 10.10. Apple’s OSA provides scripting capabilities to control applications, interface with the operating system, and bridge access into the rest of Apple’s internal APIs. As of OSX 10.10, OSA only supports two languages, JXA and AppleScript. Scripts can be executed via the command line utility osascript, they can be compiled into applications or script files via osacompile, and they can be compiled and executed in memory of other programs by leveraging the OSAKit Framework.[6][7][8][9][10]

Adversaries may abuse various implementations of JavaScript to execute various behaviors. Common uses include hosting malicious scripts on websites as part of a Drive-by Compromise or downloading and executing these script files as secondary payloads. Since these payloads are text-based, it is also very common for adversaries to obfuscate their content as part of Obfuscated Files or Information.

Detection

Mitigations (4)

M1021 Restrict Web-Based Content

Script blocking extensions can help prevent the execution of JavaScript and HTA files that may commonly be used during the exploitation process. For malicious code served up through ads, adblockers can help prevent that code from executing in the first place.

M1038 Execution Prevention

Denylist scripting where appropriate.

M1040 Behavior Prevention on Endpoint

On Windows 10, enable Attack Surface Reduction (ASR) rules to prevent JavaScript scripts from executing potentially malicious downloaded content [1].

M1042 Disable or Remove Feature or Program

Turn off or restrict access to unneeded scripting components.

Groups (30)

Software (43)

References

  1. win10_asr
  2. NodeJS
  3. JScrip May 2018
  4. Microsoft JScript 2007
  5. Microsoft Windows Scripts
  6. Apple About Mac Scripting 2016
  7. SpecterOps JXA 2020
  8. SentinelOne macOS Red Team
  9. Red Canary Silver Sparrow Feb2021
  10. MDSec macOS JXA and VSCode