Complete technique description
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.[NodeJS]
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.[JScrip May 2018][Microsoft JScript 2007][Microsoft Windows Scripts]
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 <code>osascript</code>, they can be compiled into applications or script files via <code>osacompile</code>, and they can be compiled and executed in memory of other programs by leveraging the OSAKit Framework.[Apple About Mac Scripting 2016][SpecterOps JXA 2020][SentinelOne macOS Red Team][Red Canary Silver Sparrow Feb2021][MDSec macOS JXA and VSCode]
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.
Official technique definition · Open in the interactive matrix
Parent and sub-techniques
Related pages are navigation context. Their tools, rules and lab results are not automatically inherited.
Detection telemetry and configuration
These contracts are selected through exact technique-to-data-component relationships or explicitly labelled planning overrides. Configure a collector at the relevant observation point; a telemetry name alone is not coverage.
Command Execution · source-mapped
DC0064 collection page — Collect process command lines and relevant shell/interpreter audit; shell history alone is neither complete nor tamper-resistant.
Providers and collection configuration
- Enable Script Block Logging through the policy/configuration for the installed edition. Forward Microsoft-Windows-PowerShell/Operational for Windows PowerShell, or PowerShellCore/Operational for PowerShell 7.
- Retain script-block ID and fragment ordering alongside process creation. Protect access to collected script text; secrets may be included.
- On Linux, use narrowly scoped Audit execution rules for the lab account and supported architectures, and retain joined SYSCALL/EXECVE/PATH records.
Required normalized fields: interpreter, command_line, actor_uid, session_id.
Illustrative collection event
Project-normalized synthetic JSON, not a native provider log, captured event, attack verdict or validated detection. A parser/adapter is required for a real SIEM. Example names, IPs and values are fictional.
{
"schema": "1200km.telemetry.example.v1",
"synthetic": true,
"timestamp": "2026-09-27T12:00:00Z",
"telemetry_id": "DC0064",
"collector": "illustrative-lab-collector",
"observation": {
"interpreter": "/bin/sh",
"command_line": "printf LAB_TELEMETRY_CHECK",
"actor_uid": 1000,
"session_id": "lab-session-1"
}
}
Visibility limits: Script content and process command lines are different signals. Logging may be partial, fragmented, filtered or disabled; never assume a command line reveals everything executed.
Module Load · source-mapped
DC0016 collection page — Scope Sysmon ImageLoad (7) to lab processes/paths; retain module hash, signer and destination process. Inventory alone does not prove a module loaded.
Providers and collection configuration
- Microsoft Sysmon: Windows event-based collection; enable the event types needed below.
- Linux Audit: Linux alternative for supported system-call and file events; different semantics and fields.
- Apple Endpoint Security clients: macOS alternative where the subscribed event exists; requires an entitled, approved client, not an iOS collector.
- On a disposable Windows host, review the installed Sysmon schema and current configuration; merge scoped event filters into the existing policy rather than replacing it.
- Forward Microsoft-Windows-Sysmon/Operational to the lab collector. Preserve event ID, timestamp, computer, process identifiers and the original event.
- For Linux or macOS, select the equivalent sensor separately and test its emitted fields; a Windows event ID does not transfer across platforms.
Required normalized fields: process_id, image_loaded, signed, action.
Illustrative collection event
Project-normalized synthetic JSON, not a native provider log, captured event, attack verdict or validated detection. A parser/adapter is required for a real SIEM. Example names, IPs and values are fictional.
{
"schema": "1200km.telemetry.example.v1",
"synthetic": true,
"timestamp": "2026-09-27T12:00:00Z",
"telemetry_id": "DC0016",
"collector": "illustrative-lab-collector",
"observation": {
"process_id": 4200,
"image_loaded": "C:\\Lab\\demo.dll",
"signed": false,
"action": "load"
}
}
Visibility limits: Event filtering and sensor versions change coverage. High-volume image-load and process-access collection needs tuning; endpoint events alone do not establish intent.
Process Creation · source-mapped
DC0032 collection page — Collect Sysmon ProcessCreate (1); preserve ProcessGuid and parent identifiers. Security 4688 is an alternative with separate audit/command-line settings.
Providers and collection configuration
- Microsoft Sysmon: Windows event-based collection; enable the event types needed below.
- Linux Audit: Linux alternative for supported system-call and file events; different semantics and fields.
- Apple Endpoint Security clients: macOS alternative where the subscribed event exists; requires an entitled, approved client, not an iOS collector.
- On a disposable Windows host, review the installed Sysmon schema and current configuration; merge scoped event filters into the existing policy rather than replacing it.
- Forward Microsoft-Windows-Sysmon/Operational to the lab collector. Preserve event ID, timestamp, computer, process identifiers and the original event.
- For Linux or macOS, select the equivalent sensor separately and test its emitted fields; a Windows event ID does not transfer across platforms.
Required normalized fields: process_guid, image, parent_image, command_line, user.
<EventFiltering>
<ProcessCreate onmatch="include">
<Image condition="is">C:\Windows\System32\whoami.exe</Image>
</ProcessCreate>
</EventFiltering>
This fragment only selects the named process. It is not a complete production policy. Inspect the installed schema with sysmon64 -s; preserve existing rules, then apply the reviewed complete configuration with sysmon64 -c <configuration-file>.
Illustrative collection event
Project-normalized synthetic JSON, not a native provider log, captured event, attack verdict or validated detection. A parser/adapter is required for a real SIEM. Example names, IPs and values are fictional.
{
"schema": "1200km.telemetry.example.v1",
"synthetic": true,
"timestamp": "2026-09-27T12:00:00Z",
"telemetry_id": "DC0032",
"collector": "illustrative-lab-collector",
"observation": {
"process_guid": "lab-process-001",
"image": "C:\\Windows\\System32\\whoami.exe",
"parent_image": "C:\\Windows\\System32\\cmd.exe",
"command_line": "whoami",
"user": "LAB\\analyst"
}
}
Visibility limits: Event filtering and sensor versions change coverage. High-volume image-load and process-access collection needs tuning; endpoint events alone do not establish intent.
Script Execution · source-mapped
DC0029 collection page — Collect PowerShell 4104 with script-block ID and fragment sequence; instrument other engines separately rather than assigning them the same event ID.
Providers and collection configuration
- Enable Script Block Logging through the policy/configuration for the installed edition. Forward Microsoft-Windows-PowerShell/Operational for Windows PowerShell, or PowerShellCore/Operational for PowerShell 7.
- Retain script-block ID and fragment ordering alongside process creation. Protect access to collected script text; secrets may be included.
- On Linux, use narrowly scoped Audit execution rules for the lab account and supported architectures, and retain joined SYSCALL/EXECVE/PATH records.
Required normalized fields: engine, script_block_id, fragment, fragments_total, script_text.
Get-WinEvent -FilterHashtable @{
LogName = 'Microsoft-Windows-PowerShell/Operational'
Id = 4104
} -MaxEvents 5
Read-only check after Script Block Logging is configured. For PowerShell 7 use its registered PowerShellCore/Operational channel. Missing events are not proof of no execution; check policy, channel and permissions.
Illustrative collection event
Project-normalized synthetic JSON, not a native provider log, captured event, attack verdict or validated detection. A parser/adapter is required for a real SIEM. Example names, IPs and values are fictional.
{
"schema": "1200km.telemetry.example.v1",
"synthetic": true,
"timestamp": "2026-09-27T12:00:00Z",
"telemetry_id": "DC0029",
"collector": "illustrative-lab-collector",
"observation": {
"engine": "PowerShell",
"script_block_id": "lab-script-1",
"fragment": 1,
"fragments_total": 1,
"script_text": "Write-Output \"LAB_TELEMETRY_CHECK\""
}
}
Visibility limits: Script content and process command lines are different signals. Logging may be partial, fragmented, filtered or disabled; never assume a command line reveals everything executed.
Simulation design and documented procedures
Atomic evidence: 5 compatible documented candidates. Live lab status: not run for these imported procedures.
Use disposable lab hosts and test accounts, explicit target allowlists, a clean snapshot, bounded egress and a restore plan. Review every candidate and dependency before any execution.
JScript execution to gather local computer information via cscript
JScript execution test, execute JScript via cscript command. When successful, system information will be written to $env:TEMP\T1059.007.out.txt
Pinned Atomic procedure · 01d75adf-ca1b-4dd1-ac96-7c9550ad1035 · windows · command_prompt.
Elevation: not declared required. Cleanup: defined upstream; review required. This is source documentation, not an execution approval.
jscript: Path to sample script (type string; source default PathToAtomicsFolder\T1059.007\src\sys_info.js)
Review the upstream command, dependencies and cleanup at the source link. Source defaults may refer to real infrastructure or destructive actions; they are not authorized targets. No automatic install, prerequisite download or command execution is provided.
1 prerequisite definitions:
- Sample script must exist on disk at specified location (#{jscript})
Turla KopiLuwak RC4 Decryption Stager
Emulates KopiLuwak's next-stage JavaScript loader named Chkdsk.js. The script accepts an
RC4 decryption key via the -scan parameter and decrypts hardcoded ciphertext bytes, which are then run as script.
In this atomic, the decrypted bytes generate and display a random number instead of performing malicious behavior.
In the real attack chain, a scheduled task (ProactiveScan) invokes this script with the key every 30 minutes.
Reference: https://securelist.com/turla-renews-its-arsenal-with-topinambour/91687/
Pinned Atomic procedure · 02428cbe-c230-4353-b31d-61c9d328b153 · windows · command_prompt.
Elevation: not declared required. Cleanup: not declared. This is source documentation, not an execution approval.
chkdsk_path: Path to the KopiLuwak Chkdsk.js stager script (type path; source default PathToAtomicsFolder\T1059.007\src\Chkdsk.js)
Review the upstream command, dependencies and cleanup at the source link. Source defaults may refer to real infrastructure or destructive actions; they are not authorized targets. No automatic install, prerequisite download or command execution is provided.
1 prerequisite definitions:
- Chkdsk.js must exist on disk
JScript execution to gather local computer information via wscript
JScript execution test, execute JScript via wscript command. When successful, system information will be shown with four message boxes.
Pinned Atomic procedure · 0709945e-4fec-4c49-9faf-c3c292a74484 · windows · command_prompt.
Elevation: not declared required. Cleanup: not declared. This is source documentation, not an execution approval.
jscript: Path to sample script (type string; source default PathToAtomicsFolder\T1059.007\src\sys_info.js)
Review the upstream command, dependencies and cleanup at the source link. Source defaults may refer to real infrastructure or destructive actions; they are not authorized targets. No automatic install, prerequisite download or command execution is provided.
1 prerequisite definitions:
- Sample script must exist on disk at specified location (#{jscript})
Turla KopiLuwak Registry JavaScript Payload Execution
Emulates KopiLuwak's technique of storing a JavaScript payload as REG_BINARY data in the Windows registry
and executing it. The script uses WMI StdRegProv to read binary data from
HKCU\Software\Microsoft\Windows\CurrentVersion\Maintenance\MOfficeMaintenance, converts the
bytes to a string with String.fromCharCode, and runs it with eval(). The registry path, value
name, and WMI access pattern mirror the real malware.
Reference: https://securelist.com/turla-renews-its-arsenal-with-topinambour/91687/
Pinned Atomic procedure · 9be739ec-b1ba-4950-94d0-e62444b23645 · windows · powershell.
Elevation: not declared required. Cleanup: defined upstream; review required. This is source documentation, not an execution approval.
payload: JavaScript code to store in the registry as binary and execute via eval (type string; source default var shell = new ActiveXObject('WScript.Shell');shell.Exec('cmd.exe /c whoami');)registry_script: Path to the registry payload JScript file (type path; source default PathToAtomicsFolder\T1059.007\src\registry_payload.js)
Review the upstream command, dependencies and cleanup at the source link. Source defaults may refer to real infrastructure or destructive actions; they are not authorized targets. No automatic install, prerequisite download or command execution is provided.
3 prerequisite definitions:
- Registry payload JScript must exist on disk
- Backup existing Maintenance registry key if present
- Payload must be written to registry as REG_BINARY
Turla Kopiluwak Windows Enumeration
Executes a JScript file via wscript.exe that runs a series of reconnaissance commands (net use, ipconfig,
systeminfo, whoami, tasklist, netstat, arp, dir, etc.) and appends all output to a single staging file
at c:\windows\temp\result2.dat. Output file name, wscript.exe execution, and reconnaisance commands run mirror the behaviors of Turla's Javascript trojan Kopiluwak
Reference: https://unit42.paloaltonetworks.com/turla-pensive-ursa-threat-assessment/
Pinned Atomic procedure · e65e6772-bfd3-4f25-934b-861d5caa34db · windows · command_prompt.
Elevation: not declared required. Cleanup: defined upstream; review required. This is source documentation, not an execution approval.
jscript: Path to the reconnaissance JScript file (type path; source default PathToAtomicsFolder\T1059.007\src\xpexplore.js)
Review the upstream command, dependencies and cleanup at the source link. Source defaults may refer to real infrastructure or destructive actions; they are not authorized targets. No automatic install, prerequisite download or command execution is provided.
1 prerequisite definitions:
- Reconnaissance JScript must exist on disk
Technique-specific experiment contract
- Choose one procedure implementing T1059.007 JavaScript; identify the observable behavior in the source definition, not just its tactic.
- Record exact target, tool/version, inputs, privileges, network limits and approval. Never run an imported default target automatically.
- Enable the collection sources above and verify a benign baseline reaches the detector.
- Run only the approved isolated scenario; capture native events and an independent behavior observable.
- Evaluate the exact rule/model, restore the lab, and preserve configuration, event hashes, alerts, controls and misses.