Windows cmd.exe Output Redirection to User Writable Paths

Flags cmd.exe commands that redirect output (>) into temp/AppData and other commonly targeted directories.

FreeReviewedSigma · Medium · v2
Product
windows
Category
process_creation
Author
Nasreddine Bencherchali (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2022-07-12
Updated
2026-07-31
title: Windows cmd.exe Output Redirection to User Writable Paths
id: 7b236dd9-7f7a-41f1-ad5e-4bb602e5891e
related:
  - id: aa2efee7-34dd-446e-8a37-40790a66efd7
    type: derived
  - id: 4f4eaa9f-5ad4-410c-a4be-bc6132b0175a
    type: similar
  - id: 8e0bb260-d4b2-4fff-bb8d-3f82118e6892
    type: derived
status: test
description: This rule flags process creations where cmd.exe is invoked and the command line contains output redirection using the “>”/“>>” operators to common user-writable directories such as %APPDATA%, %TEMP%, and user profile paths. Attackers often use redirection to capture the results of recon or enumeration commands into files for later staging or exfiltration. It relies on Windows process creation telemetry, specifically matching cmd.exe process names and substrings in the full command line.
references:
  - https://thedfirreport.com/2022/07/11/select-xmrig-from-sqlserver/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_cmd_redirection_susp_folder.yml
author: Nasreddine Bencherchali (Nextron Systems), Huntrule Team
date: 2022-07-12
modified: 2024-03-19
tags:
  - attack.stealth
  - attack.t1218
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith: \cmd.exe
    - OriginalFileName: Cmd.Exe
  selection_cli_1:
    CommandLine|contains:
      - ">?%APPDATA%\\"
      - ">?%TEMP%\\"
      - ">?%TMP%\\"
      - ">?%USERPROFILE%\\"
      - ">?C:\\ProgramData\\"
      - ">?C:\\Temp\\"
      - ">?C:\\Users\\Public\\"
      - ">?C:\\Windows\\Temp\\"
  selection_cli_2:
    CommandLine|contains:
      - " >"
      - '">'
      - "'>"
    CommandLine|contains|all:
      - C:\Users\
      - \AppData\Local\
  condition: selection_img and 1 of selection_cli_*
falsepositives:
  - Legitimate admin or third party scripts used for diagnostic collection might generate some false positives
level: medium
license: DRL-1.1