heroui logo

Dynamic .NET Compilation Via Csc.EXE

Sigma Rules

View Source
Summary
This detection rule identifies the execution of 'csc.exe', which is the C# compiler in the .NET framework. Attackers may exploit this executable to dynamically compile malicious code on the fly, allowing them to evade detection during various stages of an attack. The rule focuses on process creation events where 'csc.exe' is utilized, specifically looking for command lines that suggest suspicious usage patterns. It examines whether the file path of 'csc.exe' ends with \\csc.exe and cross-references the command line executed for any indications of executing from uncommon folders such as temporary file locations or user profile directories. Additionally, the detection rule incorporates exclusions for processes originating from known legitimate locations and executables, thereby reducing false positives.
Categories
  • Windows
  • Endpoint
Data Sources
  • Process
ATT&CK Techniques
  • T1027.004
Created: 2019-08-24