Detection rules › Sigma
Dynamic .NET Compilation Via Csc.EXE
Detects execution of "csc.exe" to compile .NET code. Attackers often leverage this to compile code on the fly and use it in other stages.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Defense Evasion | T1027.004 Obfuscated Files or Information: Compile After Delivery |
Event coverage
| Provider | Event ID | Title |
|---|---|---|
| Sysmon | 1 | Process creation |
Stages and Predicates
Stage 1: selection_img
Image|endswith: '\csc.exe'
Stage 2: 1 of selection_susp_location_1
or:
CommandLine|contains: ':\Perflogs\'
CommandLine|contains: ':\Users\Public\'
CommandLine|contains: '\AppData\Local\Temp\'
CommandLine|contains: '\Temporary Internet'
CommandLine|contains: '\Windows\Temp\'
Stage 3: 1 of selection_susp_location_2
or:
CommandLine|contains: ':\Users\'
CommandLine|contains: '\Contacts\'
CommandLine|contains: ':\Users\'
CommandLine|contains: '\Favorites\'
CommandLine|contains: ':\Users\'
CommandLine|contains: '\Favourites\'
CommandLine|contains: ':\Users\'
CommandLine|contains: '\Pictures\'
Stage 4: 1 of selection_susp_location_3
CommandLine|re: '([Pp]rogram[Dd]ata|%([Ll]ocal)?[Aa]pp[Dd]ata%|\\[Aa]pp[Dd]ata\\([Ll]ocal([Ll]ow)?|[Rr]oaming))\\[^\\]{1,256}$'
Stage 5: not 1 of filter_main_*
or:
ParentImage: 'C:\Windows\System32\inetsrv\w3wp.exe'
ParentImage: 'C:\Windows\System32\sdiagnhost.exe'
ParentImage|startswith: 'C:\Program Files (x86)\'
ParentImage|startswith: 'C:\Program Files\'
Stage 6: not 1 of filter_optional_*
or:
ParentCommandLine|contains: 'JwB7ACIAZgBhAGkAbABlAGQAIgA6AHQAcgB1AGUALAAiAG0AcwBnACIAOgAiAEEAbgBzAGkAYgBsAGUAIAByAGUAcQB1AGkAcgBlAHMAIABQAG8AdwBlAHIAUwBoAGUAbABsACAAdgAzAC4AMAAgAG8AcgAgAG4AZQB3AGUAcgAiAH0AJw'
ParentCommandLine|contains: '\ProgramData\Microsoft\Windows Defender Advanced Threat Protection'
ParentCommandLine|contains: 'cAewAiAGYAYQBpAGwAZQBkACIAOgB0AHIAdQBlACwAIgBtAHMAZwAiADoAIgBBAG4AcwBpAGIAbABlACAAcgBlAHEAdQBpAHIAZQBzACAAUABvAHcAZQByAFMAaABlAGwAbAAgAHYAMwAuADAAIABvAHIAIABuAGUAdwBlAHIAIgB9ACcA'
ParentCommandLine|contains: 'nAHsAIgBmAGEAaQBsAGUAZAAiADoAdAByAHUAZQAsACIAbQBzAGcAIgA6ACIAQQBuAHMAaQBiAGwAZQAgAHIAZQBxAHUAaQByAGUAcwAgAFAAbwB3AGUAcgBTAGgAZQBsAGwAIAB2ADMALgAwACAAbwByACAAbgBlAHcAZQByACIAfQAnA'
ParentImage: 'C:\ProgramData\chocolatey\choco.exe'
ParentImage: 'C:\ProgramData\chocolatey\tools\shimgen.exe'
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
CommandLine | match |
|
CommandLine | regex_match |
|
Image | ends_with |
|
ParentCommandLine | match |
|
ParentImage | eq |
|
ParentImage | starts_with |
|