OpenParable
Skip to content
← Back to skills

T1127.001_msbuild

DevOps & Security

Adversaries may use MSBuild to proxy execution of code through a trusted Windows utility.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/CyberStrikeus/CyberStrike/blob/HEAD/.cyberstrike/skill/mitre_attack/TA0005_defense-evasion/T1127.001_msbuild/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/t1127-001-msbuild, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

T1127.001 MSBuild

Sub-technique of: T1127

High-Level Description

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.

Kill Chain Phase

  • Defense Evasion (TA0005)

Platforms: Windows

What to Check

  • Identify if MSBuild technique is applicable to target environment
  • Check Windows systems for indicators of MSBuild
  • Verify mitigations are bypassed or absent (2 known mitigations)
  • Assess detection coverage (1 detection strategies)

How to Test

Atomic Red Team Tests

The following tests are from Atomic Red Team and provide actionable ways to test this technique:

Atomic Test 1: MSBuild Bypass Using Inline Tasks (C#)

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

#{msbuildpath}\#{msbuildname} "#{filename}"

Dependencies:

  • Project file must exist on disk at specified location (#{filename})

Atomic Test 2: MSBuild Bypass Using Inline Tasks (VB)

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

#{msbuildpath}\#{msbuildname} "#{filename}"

Dependencies:

  • Project file must exist on disk at specified location (#{filename})

Manual Testing

If Atomic Red Team tests are not applicable, manually verify the technique by:

  1. Identify Attack Surface: Determine if the target environment is susceptible to MSBuild by examining the target platforms (Windows).

  2. Assess Existing Defenses: Review whether mitigations for T1127.001 are in place. If defenses are absent or misconfigured, this technique may be exploitable.

  3. Execute Test: Use tools and methods described in the MITRE ATT&CK page and external references below.

Remediation Guide

M1042 Disable or Remove Feature or Program

MSBuild.exe may not be necessary within an environment and should be removed if not being used.

M1038 Execution Prevention

Use application control configured to block execution of msbuild.exe 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 msbuild.exe application and to prevent abuse.

Detection

Behavior-chain detection strategy for T1127.001 Trusted Developer Utilities Proxy Execution: MSBuild (Windows)

Risk Assessment

FindingSeverityImpact
MSBuild technique applicableMediumDefense Evasion

CWE Categories

CWE IDTitle
CWE-693Protection Mechanism Failure

References