Execution · Windows · LOLBAS
msbuild.exe
Microsoft Build Engine
Builds projects from XML project files. A project file can hold inline C# that runs during the build, so a signed build tool can compile and run code on the fly.
Legitimate use
Builds .NET and C++ projects in development and CI.
Switches
Turns off console logging.
InfoBuilds a specific target in the project.
LowSets a build property.
InfoCommand lines to worry about
- High
MSBuild running a project from a user path
MSBuild builds a project file from a temp or profile folder outside any real project. Inline tasks let it compile and run code. Check the file.
Detection regex
msbuild(\.exe)?\s+.*\\(temp|appdata|programdata|public|downloads)\\[^\s]+\.(csproj|xml|proj|txt|build)
Where it is recorded
- Security4688Process creation with the full command line, when command-line auditing is enabled.
- Sysmon1Process creation with command line, hashes and parent process.
Community detections
6 SigmaHQ rules for msbuild.exe. The explainer checks every pasted command line against all of them.
- HighHTML Help HH.EXE Suspicious Child Process
Detects a suspicious child process of a Microsoft HTML Help (HH.exe)
T1047T1059.001T1059.003T1059.005by Maxim Pavlunin, Nasreddine Bencherchali (Nextron Systems)
- HighScript Event Consumer Spawning Process
Detects a suspicious child process of Script Event Consumer (scrcons.exe).
T1047by Sittikorn S
- HighSuspicious Microsoft Office Child Process
Detects a suspicious process spawning from one of the Microsoft Office suite products (Word, Excel, PowerPoint, Publisher, Visio, etc.)
T1047T1204.002T1218.010by Florian Roth (Nextron Systems), Markus Neis, FPT.EagleEye Team, Vadim Khrykov, Cyb3rEng, Michael Haag, Christopher Peacock @securepeacock, @scythe_io
- HighSuspicious Microsoft OneNote Child Process
Detects suspicious child processes of the Microsoft OneNote application. This may indicate an attempt to execute malicious embedded objects from a .one file.
T1566T1566.001by Tim Rauch (Nextron Systems), Nasreddine Bencherchali (Nextron Systems), Elastic (idea)
- HighSuspicious Outlook Child Process
Detects a suspicious process spawning from an Outlook process.
T1204.002by Michael Haag, Florian Roth (Nextron Systems), Markus Neis, Elastic, FPT.EagleEye Team
- MediumSuspicious Msbuild Execution By Uncommon Parent Process
Detects suspicious execution of 'Msbuild.exe' by a uncommon parent process
by frack113
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.