Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may use MSBuild to proxy execution of code through a trusted Windows utility.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | -21% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -47% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -20% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 6% | 0% |
> Sub-technique of: T1127
Adversaries may use MSBuild to proxy execution of code through a trusted Windows utility. MSBuild.exe (Microsoft Build Engine) is a software build platform used by Visual Studio. It handles XML formatted project files that define requirements for loading and building various platforms and configurations.
Adversaries can abuse MSBuild to proxy execution of malicious code. The inline task capability of MSBuild that was introduced in .NET version 4 allows for C# or Visual Basic code to be inserted into an XML project file. MSBuild will compile and execute the inline task. MSBuild.exe is a signed Microsoft binary, so when it is used this way it can execute arbitrary code and bypass application control defenses that are configured to allow MSBuild.exe execution.
Platforms: Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Executes the code in a project file using msbuild.exe. The default C# project example file (T1127.001.csproj) will simply print "Hello From a Code Fragment" and "Hello From a Class." to the screen.
Supported Platforms: windows
cmd#{msbuildpath}\#{msbuildname} "#{filename}"
Dependencies:
Executes the code in a project file using msbuild.exe. The default Visual Basic example file (vb.xml) will simply print "Hello from a Visual Basic inline task!" to the screen.
Supported Platforms: windows
cmd#{msbuildpath}\#{msbuildname} "#{filename}"
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
MSBuild.exe may not be necessary within an environment and should be removed if not being used.
Use application control configured to block execution of <code>msbuild.exe</code> if it is not required for a given system or network to prevent potential misuse by adversaries. For example, in Windows 10 and Windows Server 2016 and above, Windows Defender Application Control (WDAC) policy rules may be applied to block the <code>msbuild.exe</code> application and to prevent abuse.
| Finding | Severity | Impact | | ---------------------------- | -------- | --------------- | | MSBuild technique applicable | Medium | Defense Evasion |
| CWE ID | Title | | ------- | ---------------------------- | | CWE-693 | Protection Mechanism Failure |
Other measured skills in the registry, with their headline benchmark lift.