Csc.exe

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

Full path

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

  1. CompileUser T1127

    Compile attacker code on system. Bypass defensive counter measures.

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

    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.

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

  2. CompileUser T1127

    Compile attacker code on system. Bypass defensive counter measures.

    csc -target:library {PATH:.cs}

    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.

    os: Windows vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11

Detection

Resources