Detection of Shell Application File Write Operations to Suspicious Directories
Detection of Windows shell and scripting applications writing files to common staging directories used by threat actors for persistence and lateral movement.
This threat brief focuses on detecting the usage of Windows shell and scripting binaries that interact with directories typically associated with malicious staging and file persistence. Threat actors frequently utilize folders such as C:\Users\Public, C:\PerfLogs, and C:\Windows\Temp\ to drop secondary payloads, stage exfiltration data, or maintain persistence through scheduled tasks or autoruns. Because these directories often allow read/write access to non-privileged users or are frequently overlooked by administrators, they are prime targets for malicious activity. Defenders monitoring file system events can identify suspicious process-to-directory interactions by flagging shells (like PowerShell or cmd.exe) or utility binaries (like certutil or mshta) that perform file write operations within these locations.
Impact
Successful file staging in these directories often precedes second-stage malware deployment, lateral movement, or unauthorized data exfiltration. If left unmonitored, these paths serve as reliable "safe harbors" for attackers to drop tools that might otherwise trigger security alerts if placed in more restrictive or sensitive system directories.
Recommendation
Deploy file system monitoring on endpoints to identify processes writing to public-facing or sensitive directories.
- Enable Sysmon (Event ID 11) or equivalent Endpoint Detection and Response (EDR) file-write event logging.
- Deploy the provided Sigma rule to your SIEM to alert on shell activity targeting the identified directories.
- Review baseline activity in your environment to distinguish between automated administrative scripts and unauthorized process file writes.
Immediate actions
Deploy the provided Sigma rule to SIEM environment.
Mitigations
Restrict write permissions for non-privileged accounts on C:\Users\Public and C:\PerfLogs directories.
T1059
Detection coverage 1
Detect Windows Shell and Scripting File Write to Suspicious Directory
highDetects Windows shells, scripting applications, and utility binaries that write files to suspicious or commonly abused folders like C:\Users\Public\, C:\PerfLogs\, and C:\Windows\Temp\
Detection queries are available on the platform. Get full rules →