Windows Shell/Scripting Tool File Write to Suspicious Directories

Alert on file writes by common Windows shells/scripting tools to C:\PerfLogs, C:\Users\Public, or C:\Windows\Temp.

FreeReviewedSigma · High · v2
Product
windows
Category
file_event
Author
Florian Roth (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2021-11-20
Updated
2026-07-31
title: Windows Shell/Scripting Tool File Write to Suspicious Directories
id: e101da0b-8587-454b-b54a-bc1add48d366
status: test
description: This rule flags file events where common Windows shells and scripting tools (bash, cmd, cscript, powershell, pwsh, sh, wscript, msbuild) or related script execution utilities (certutil, forfiles, mshta, schtasks, scriptrunner, wmic) write to targeted “suspicious” locations. Such activity can indicate staging, payload preparation, or other persistence-related file drops using legitimate interpreters and execution binaries. It relies on Windows file event telemetry that includes the process image path and the target filename written to PerfLogs, Users\Public, or Windows\Temp.
references:
  - Internal Research
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/file/file_event/file_event_win_shell_write_susp_directory.yml
author: Florian Roth (Nextron Systems), Huntrule Team
date: 2021-11-20
modified: 2023-03-29
tags:
  - attack.execution
  - attack.t1059
logsource:
  category: file_event
  product: windows
detection:
  selection_1:
    Image|endswith:
      - \bash.exe
      - \cmd.exe
      - \cscript.exe
      - \msbuild.exe
      - \powershell.exe
      - \pwsh.exe
      - \sh.exe
      - \wscript.exe
    TargetFilename|startswith:
      - C:\PerfLogs\
      - C:\Users\Public\
  selection_2:
    Image|endswith:
      - \certutil.exe
      - \forfiles.exe
      - \mshta.exe
      - \schtasks.exe
      - \scriptrunner.exe
      - \wmic.exe
    TargetFilename|contains:
      - C:\PerfLogs\
      - C:\Users\Public\
      - C:\Windows\Temp\
  condition: 1 of selection_*
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 1277f594-a7d1-4f28-a2d3-73af5cbeab43
    type: derived