Windows: Alert on csc.exe Executing from User-Writable or Suspicious Paths

Alerts when csc.exe is launched from user/temp-like paths, indicating potential on-the-fly .NET compilation.

FreeReviewedSigma · Medium · v2
Product
windows
Category
process_creation
Author
Florian Roth (Nextron Systems), X__Junior (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2019-08-24
Updated
2026-07-31

ATT&CK techniques

Defense Evasion
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Execution

  5. Persistence

  6. Priv Esc

  7. Cred Access

  8. Discovery

  9. Lateral Movement

  10. Collection

  11. C2

  12. Exfiltration

  13. Impact

What it detects

This rule flags process executions of csc.exe when command-line arguments indicate the compiler is being run from or interacting with user-writable and commonly abused locations (for example, Temp, Perflogs, or Temporary Internet) or specific user directory targets. Compiling .NET code on the fly can enable stealthy staging and follow-on payload execution, so identifying csc.exe launched with suspicious path context is important. It relies on process creation telemetry including Image ending with csc.exe, command-line contents, and parent process context for multiple exclusions.

Related detections5 linkedT1027.004 — drag to rearrange
Windows Process Creation: csc.exe Used for Dynamic .NET Compilation
Windows Dynamic C# Compilation Generates .cmdline Artifact
Windows Visual Basic vbc.exe Compiles to .obj via cvtres.exe Resource Converter
Windows: Process Creation of Dnx.EXE May Indicate Application Whitelisting Bypass
Windows: Alert on suspicious parent process spawning csc.exe
Windows: Alert on csc.exe Executing from User-Writable or Suspicious Paths
Pivot detection · T1027.004 · 5 related

Changelog

v2
  1. v2
    Candidate ingested via manual entry.2026-07-31
  2. v1
    No changelog recorded for this version.2026-07-30

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.