Csc.exe

Binary file used by .NET Framework to compile C# code

Paths

  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe
  • C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe
  • C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe
  • C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe
  • C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe

Commands

Compile

Use csc.exe to compile C# code, targeting the .NET Framework, stored in the specified .cs file and output the compiled version to the specified .exe path.

Use case: Compile attacker code on system. Bypass defensive counter measures.

Privileges: User

csc.exe -out:{PATH:.exe} {PATH:.cs}

Compile

Use csc.exe to compile C# code, targeting the .NET Framework, stored in the specified .cs file and output the compiled version to a DLL file with the same name.

Use case: Compile attacker code on system. Bypass defensive counter measures.

Privileges: User

csc -target:library {PATH:.cs}

Detection

Resources