Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / EXECUTION

Command Shell Abuse

This note documents detection patterns related to Command Shell Abuse within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4688Process creationCriticalCore source for cmd.exe execution and arguments.
Sysmon1Process creationCriticalBest source for lineage, hashes, and parent process context.
Sysmon11File createHighOutput files, redirected results, dropped payloads.
Sysmon3Network connectionHighShell-triggered outbound connections.
PowerShell4104Script block loggingMediumWhen PowerShell launches cmd wrappers.
Sysmon23File deleteMediumCleanup after shell execution.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Suspicious parent launches cmdOffice, browser, service, WMICriticalHigh-confidence signal.
Redirection abuse>, 2>&1, pipesHighOutput capture / stealth clue.
Chained commands&&, `, &`
Encoded child followscmd spawns PowerShell / LOLBINCriticalStaging indicator.
Hidden shell flags/Q /cHighCommon stealth flags.
Short-lived shellRapid execution and exitHighOperator automation clue.

Common Tools

ToolUsage
cmd.exeCore shell execution
conhost.exeConsole host
batch scriptsMulti-command staging
schtasks.exeShell trigger
services.exeService-spawned shell

Relevant Artifacts

  • Security Event ID 4688
  • Sysmon Event IDs 1, 3, 11, 23
  • Prefetch:
    • CMD.EXE
    • CONHOST.EXE
  • Amcache / ShimCache
  • Batch files
  • MFT / USN for redirected outputs
  • EDR process tree

MITRE ATT&CK References

  • T1059.003 Windows Command Shell

Decision Tree

  1. Which parent launched cmd?

    • User shell
    • Office
    • Service
    • WMI
  2. Arguments suspicious?

    • /c
    • /q
    • Redirection
    • Chain operators
  3. Child process follows?

    • PowerShell
    • LOLBIN
    • Admin tools
  4. Output stored?

    • File
    • Share
    • Temp folder
  5. Expand:

    • Adjacent recon
    • Persistence
    • Network
  6. Scope:

    • Single shell
    • Burst shells
    • Scripted chain

Example Detection Templates

KQL

SecurityEvent
| where EventID == 4688
| where NewProcessName endswith "cmd.exe"
| project TimeGenerated, Computer, ParentProcessName, CommandLine
Sysmon
| where EventID == 1
| where Image endswith "\\cmd.exe"
| project TimeGenerated, Computer, ParentImage, CommandLine

EQL

process where process.name == "cmd.exe"
sequence by host.name with maxspan=5m
  [ process where process.name == "cmd.exe" ]
  [ process where process.parent.name == "cmd.exe" ]

Sigma

title: Command Shell Abuse Detection
id: 7d3e2b41-command-shell
status: experimental
description: Detects suspicious cmd.exe execution
references:
  - https://attack.mitre.org/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  service: security
detection:
  selection:
    NewProcessName|endswith: '\cmd.exe'
  condition: selection
fields:
  - ParentProcessName
  - CommandLine
falsepositives:
  - Administrative shell use
level: medium
tags:
  - attack.execution
  - attack.t1059.003

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Parent-child monitoringAlert on abnormal shell parentsCriticalStrong signal
Command-line retentionPreserve shell argumentsCriticalEssential context
Sequence analyticsDetect shell chainsHighStrong operator detection
Application controlRestrict scripted shellsHighReduces abuse
EDR lineageTrack full shell treeCriticalBest operational visibility