Windows forfiles.exe Execution with /c Flag Command Proxying

Flags forfiles.exe executions that include the /c flag, indicating potential indirect command execution.

FreeReviewedSigma · Medium · v2
Product
windows
Category
process_creation
Author
Tim Rauch, Elastic, E.M. Anhaus (originally from Atomic Blue Detections, Endgame), oscd.community (SigmaHQ), DRL 1.1
Published
2022-06-14
Updated
2026-07-31
title: Windows forfiles.exe Execution with /c Flag Command Proxying
id: 9e3e4878-1857-4d14-9fa6-ac6fe2bf1d71
related:
  - id: a85cf4e3-56ee-4e79-adeb-789f8fb209a8
    type: obsolete
  - id: fa47597e-90e9-41cd-ab72-c3b74cfb0d02
    type: obsolete
  - id: 9aa5106d-bce3-4b13-86df-3a20f1d5cf0b
    type: derived
status: test
description: This rule matches process creation events where forfiles.exe is launched and its command line includes the /c flag. Attackers can use forfiles to proxy or relay execution of other commands, which may help bypass application control or whitelisting policies. The detection relies on Windows process creation telemetry, specifically the executable image/original filename and the presence of the /c argument in the command line.
references:
  - https://lolbas-project.github.io/lolbas/Binaries/Forfiles/
  - https://pentestlab.blog/2020/07/06/indirect-command-execution/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_forfiles_proxy_execution_.yml
author: Tim Rauch, Elastic, E.M. Anhaus (originally from Atomic Blue Detections, Endgame), oscd.community, Huntrule Team
date: 2022-06-14
modified: 2024-03-05
tags:
  - attack.execution
  - attack.t1059
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith: \forfiles.exe
    - OriginalFileName: forfiles.exe
  selection_cli:
    CommandLine|contains|windash: " -c "
  condition: all of selection_*
falsepositives:
  - Legitimate use via a batch script or by an administrator.
level: medium
license: DRL-1.1