Windows: Suspicious Child Process Spawned by VsCode code.exe

Alerts when code.exe spawns suspicious binaries, script hosts, or command-line activity that matches common execution patterns.

FreeUnreviewedSigmamediumv1
title: "Windows: Suspicious Child Process Spawned by VsCode code.exe"
id: 99c82700-6e02-4f4d-a78a-09b83d8352fb
status: test
description: This rule flags process creation events where a VsCode code.exe process spawns uncommon or high-risk child executables, scripts, or command-line interpreters. Such behavior can indicate attempts to execute payloads or leverage development features for stealth, including running command utilities and scripting engines. It relies on Windows process creation telemetry capturing the parent Image ending with \code.exe, the child Image ending with specific suspicious binaries, and child command lines containing well-known invocation patterns (e.g., IEX/Invoke-Command/DownloadString).
references:
  - https://twitter.com/nas_bench/status/1618021838407495681
  - https://twitter.com/nas_bench/status/1618021415852335105
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_vscode_child_processes_anomalies.yml
author: Nasreddine Bencherchali (Nextron Systems), Huntrule Team
date: 2023-01-26
modified: 2023-10-25
tags:
  - attack.execution
  - attack.stealth
  - attack.t1218
  - attack.t1202
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentImage|endswith: \code.exe
  selection_children_images:
    Image|endswith:
      - \calc.exe
      - \regsvr32.exe
      - \rundll32.exe
      - \cscript.exe
      - \wscript.exe
  selection_children_cli:
    Image|endswith:
      - \powershell.exe
      - \pwsh.exe
      - \cmd.exe
    CommandLine|contains:
      - Invoke-Expressions
      - IEX
      - Invoke-Command
      - ICM
      - DownloadString
      - rundll32
      - regsvr32
      - wscript
      - cscript
  selection_children_paths:
    Image|contains:
      - :\Users\Public\
      - :\Windows\Temp\
      - :\Temp\
  condition: selection_parent and 1 of selection_children_*
falsepositives:
  - In development environment where VsCode is used heavily. False positives may occur when developers use task to compile or execute different types of code. Remove or add processes accordingly
level: medium
license: DRL-1.1
related:
  - id: 5a3164f2-b373-4152-93cf-090b13c12d27
    type: derived

What it detects

This rule flags process creation events where a VsCode code.exe process spawns uncommon or high-risk child executables, scripts, or command-line interpreters. Such behavior can indicate attempts to execute payloads or leverage development features for stealth, including running command utilities and scripting engines. It relies on Windows process creation telemetry capturing the parent Image ending with \code.exe, the child Image ending with specific suspicious binaries, and child command lines containing well-known invocation patterns (e.g., IEX/Invoke-Command/DownloadString).

Known false positives

  • In development environment where VsCode is used heavily. False positives may occur when developers use task to compile or execute different types of code. Remove or add processes accordingly

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.