Msbuild.exe

type: OSBinaries
Used to compile and execute code

Full path

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Msbuild.exe
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Msbuild.exe
C:\Windows\Microsoft.NET\Framework\v3.5\Msbuild.exe
C:\Windows\Microsoft.NET\Framework64\v3.5\Msbuild.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Msbuild.exe
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Msbuild.exe
C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe

Commands

  1. AWL BypassUser T1127.001

    Compile and run code

    msbuild.exe {PATH:.xml}

    Build and execute a C# project stored in the target XML file.

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

    Execute: CSharp

  2. ExecuteUser T1127.001

    Compile and run code

    msbuild.exe {PATH:.csproj}

    Build and execute a C# project stored in the target csproj file.

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

    Execute: CSharp

  3. ExecuteUser T1127.001

    Execute DLL

    msbuild.exe /logger:TargetLogger,{PATH_ABSOLUTE:.dll};MyParameters,Foo

    Executes generated Logger DLL file with TargetLogger export.

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

    Execute: DLL

  4. ExecuteUser T1127.001

    Execute project file that contains XslTransformation tag parameters

    msbuild.exe {PATH:.proj}

    Execute JScript/VBScript code through XML/XSL Transformation. Requires Visual Studio MSBuild v14.0+.

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

    Execute: XSL

  5. ExecuteUser T1036

    Bypass command-line based detections

    msbuild.exe @{PATH:.rsp}

    By putting any valid msbuild.exe command-line options in an RSP file and calling it as above will interpret the options as if they were passed on the command line.

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

    Execute: CMD

Detection

Resources

acknowledgement: Casey Smith @subtee, Cn33liz @Cneelis, Jimmy @bohops