>Msbuild.exe

Used to compile and execute code

Default Executable Paths

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

Integrity & Metadata

Category Count: 5 weaponized patterns
Forensics & Triage Insight

Documented in LOLBAS project by Oddvar Moe.

Detection Engineering Notes

Monitor process creation events where FileName is "Msbuild.exe" or command line references known attack arguments.

Executive Summary & AI Quick Reference

High-Fidelity Telemetry Profile

Msbuild.exe is a native utility pre-installed on Windows systems. Threat actors and red teams abuse Msbuild.exe as a Living-off-the-Land Binary (LOLBin) to achieve Defense Evasion, Execute without triggering traditional antivirus file-hash alerts. Legitimate system administrators use it for routine administration, making behavioral command-line telemetry essential for differentiation.

Primary Abused Tactics
Defense Evasion, Execute
Minimum Privilege
User
Key Telemetry Source
Sysmon 1 / 4688
ATT&CK Mapping
T1127.001, T1036

Weaponized Parameters & Proof-of-Concepts

Documented attack commands, parameter flags, and privilege prerequisites.

5 documented methods
Filter Purpose:
Defense EvasionPrivileges: User
T1127.001: Technique T1127.001

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

msbuild.exe {PATH:.xml}
ExecutePrivileges: User
T1127.001: Technique T1127.001

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

msbuild.exe {PATH:.csproj}
ExecutePrivileges: User
T1127.001: Technique T1127.001

Executes generated Logger DLL file with TargetLogger export.

msbuild.exe /logger:TargetLogger,{PATH_ABSOLUTE:.dll};MyParameters,Foo
ExecutePrivileges: User
T1127.001: Technique T1127.001

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

msbuild.exe {PATH:.proj}
ExecutePrivileges: User
T1036: Technique T1036

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.

msbuild.exe @{PATH:.rsp}

SIEM & EDR Detection Rules

Production telemetry rules configured for Microsoft Defender, Sigma, and Splunk.

Telemetry & SIEM Detection Suite (Msbuild.exe)

Validated against MITRE T1127.001, T1036
Msbuild.exe Microsoft Defender Querykql
1// Microsoft Defender XDR / Microsoft Sentinel
2// Tactic: Defense Evasion
3DeviceProcessEvents
4| where FileName =~ "Msbuild.exe"
5| where ProcessCommandLine has_any ("Msbuild")
6| project
7 Timestamp,
8 DeviceName,
9 AccountName,
10 InitiatingProcessParentFileName,
11 InitiatingProcessFileName,
12 InitiatingProcessCommandLine,
13 FileName,
14 FolderPath,
15 ProcessCommandLine,
16 MD5,
17 SHA256
18| sort by Timestamp desc

Mitigation, Hardening & Prevention

Recommended defensive controls to block or constrain Msbuild.exe abuse.

Application Whitelisting

Enforce Windows Defender Application Control (WDAC) or AppLocker publisher rules to prevent execution outside approved enterprise administration scripts.

Attack Surface Reduction

Enable ASR rules: Block executable content from email client and webmail and Block Office applications from creating child processes spawning Msbuild.exe.

Behavioral Alerting

Deploy the KQL, Sigma, and Splunk detection queries below. Alert on anomalous child processes, web requests to unrated external IPs, or encoded payload strings.

Frequently Asked Questions (FAQ) • Msbuild.exe

Key operational questions and defensive answers about Msbuild.exe LOLBin tradecraft.

What is Msbuild.exe and why is it classified as a LOLBin?

Msbuild.exe is a legitimate, pre-installed or trusted utility on Windows. It is classified as a Living-off-the-Land Binary (LOLBin) because adversaries abuse its built-in functionality to perform malicious operations—such as Defense Evasion, Execute—without dropping custom malware binaries on disk.

How do threat actors abuse Msbuild.exe in cyber intrusions?

Adversaries leverage Msbuild.exe to execute stealthy actions while evading signature-based security controls. For example, attackers execute commands like "msbuild.exe {PATH:.xml}" to achieve Defense Evasion, Execute, masquerading behind legitimate system process lineage.

How can SOC analysts detect suspicious Msbuild.exe activity?

Detection engineers monitor process creation events (Windows Event ID 4688 or Sysmon Event ID 1; Linux auditd EXECVE; macOS Endpoint Security) inspecting anomalous command line arguments, unusual parent-child process relationships (e.g. Office apps or web servers spawning Msbuild.exe), and unexpected network connections.

What MITRE ATT&CK techniques does Msbuild.exe map to?

Msbuild.exe maps to MITRE ATT&CK technique(s): T1127.001, T1036. These techniques cover adversary actions across tactics such as Defense Evasion, Execution, Persistence, and Command and Control.

How can organizations mitigate and restrict Msbuild.exe?

Mitigation strategies include implementing Application Control policies (AppLocker or Windows Defender Application Control - WDAC), enforcing Attack Surface Reduction (ASR) rules, configuring strict privilege separation (disallowing standard users from running sensitive switches), and alerting on execution from non-standard directories.

Sharon Ben Moshe
Curated & Verified by
Sharon Ben Moshe
Cybersecurity Researcher & Detection EngineerCheck Point