T1059.007 IBM QRadar · QRadar

Detect JavaScript in IBM QRadar

Adversaries may abuse various implementations of JavaScript for execution. JavaScript (JS) is a platform-independent scripting language commonly associated with web pages, but can also execute in runtime environments outside the browser. JScript is Microsoft's implementation interpreted via the Windows Script engine. JavaScript for Automation (JXA) is a macOS scripting language based on JavaScript, included in Apple's Open Scripting Architecture. Adversaries abuse JS for drive-by compromises, malicious email attachments (.js files), HTA-based payloads, and post-exploitation on macOS via JXA. Threat actors including APT32, TA505, Contagious Interview, and FIN6 use JavaScript extensively.

MITRE ATT&CK

Tactic
Execution
Technique
T1059 Command and Scripting Interpreter
Sub-technique
T1059.007 JavaScript
Canonical reference
https://attack.mitre.org/techniques/T1059/007/

QRadar Detection Query

IBM QRadar (QRadar)
sql
SELECT
  DATEFORMAT(devicetime, 'yyyy-MM-dd HH:mm:ss') AS event_time,
  LOGSOURCENAME(logsourceid) AS log_source,
  sourceip,
  username,
  "Process Name" AS process_name,
  "Command" AS command_line,
  "Parent Process Name" AS parent_process,
  CASE
    WHEN LOWER("Command") MATCHES '.*\.(js|jse|wsf)(\s|"|$).*' THEN 1
    ELSE 0
  END AS is_jscript,
  CASE
    WHEN LOWER("Command") MATCHES '.*(activexobject|wscript\.createobject|getobject).*' THEN 2
    ELSE 0
  END AS activex_score,
  CASE
    WHEN LOWER("Command") MATCHES '.*(wscript\.shell|shell\.application|powershell|cmd\s+/c).*' THEN 2
    ELSE 0
  END AS shell_score,
  CASE
    WHEN LOWER("Command") MATCHES '.*(msxml2\.xmlhttp|winhttp|adodb\.stream|xmlhttprequest).*' THEN 2
    ELSE 0
  END AS network_score
FROM events
WHERE
  LOGSOURCETYPEID IN (12, 13, 14) -- Windows Security, Sysmon, and related Windows log sources
  AND QIDNAME(qid) IN ('Process Create', 'ProcessCreate')
  AND (
    LOWER("Process Name") IN ('wscript.exe', 'cscript.exe', 'mshta.exe', 'node.exe', 'osascript')
  )
  AND (
    LOWER("Command") MATCHES '.*\.(js|jse|wsf|hta)(\s|"|$).*'
    OR LOWER("Command") MATCHES '.*(activexobject|wscript\.createobject|getobject|wscript\.shell|shell\.application|adodb\.stream|msxml2\.xmlhttp|winhttp|eval\(|new function|runhtmlapplication|certutil|bitsadmin|powershell|cmd\/c|scriptengine).*'
    OR (LOWER("Process Name") = 'osascript' AND LOWER("Command") MATCHES '.*-l javascript.*')
  )
  AND devicetime > NOW() - 86400000
ORDER BY devicetime DESC
LIMIT 1000
high severity medium confidence

QRadar AQL query detecting JavaScript interpreter abuse by monitoring process creation events for wscript.exe, cscript.exe, mshta.exe, node.exe, and osascript with suspicious command-line patterns indicative of T1059.007 including ActiveX use, shell invocation, and network download activity.

Data Sources

Windows Security Event LogSysmonQRadar Windows DSM

Required Tables

events

False Positives & Tuning

  • Legitimate Windows administrative scripts using CScript or WScript for enterprise automation, inventory management, or software deployment tools
  • Development and CI/CD pipeline tooling that uses Node.js with subprocess invocations for build automation
  • Security tools and vulnerability scanners that may invoke HTA or script-based components as part of legitimate scanning activity
Download portable Sigma rule (.yml)

Other platforms for T1059.007


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1JScript Execution via wscript.exe

    Expected signal: Sysmon Event ID 1: Process Create for wscript.exe executing .js file. Child process event for cmd.exe spawned by wscript.exe. AMSI Event: JScript content inspection.

  2. Test 2Node.js Command Execution

    Expected signal: Sysmon Event ID 1: Process Create for node.exe with child_process in CommandLine. Child process event for cmd.exe spawned by node.exe.

  3. Test 3JXA Execution on macOS

    Expected signal: Unified Log: osascript process with '-l JavaScript' flag. Process tree shows osascript spawning child process for whoami. MDE DeviceProcessEvents on managed macOS endpoints.

Unlock Pro Content

Get the full detection package for T1059.007 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections