Suspicious MSBuild Rename
The analytic detects the execution of renamed instances of msbuild.exe, a legitimate tool abused by attackers to execute malicious code while evading detection, potentially leading to system compromise, data exfiltration, or lateral movement.
This detection identifies renamed instances of msbuild.exe being executed. msbuild.exe is a legitimate Microsoft build tool, but attackers frequently abuse it to proxy execution of malicious code, bypassing application control and other security measures. This is a living-off-the-land technique (LOLBAS) that allows adversaries to execute arbitrary code without introducing new, potentially detectable binaries to the system. Successful exploitation can lead to system compromise, data exfiltration, or further lateral movement. The LOLBAS Project and Atomic Red Team provide further context around MSBuild’s abuse potential. This technique has been associated with various threat actors and ransomware families, including Cobalt Strike, BlackByte Ransomware, and the Storm-2460 CLFS Zero Day Exploitation.
Attack Chain
- The attacker gains initial access via an existing vulnerability or remote access mechanism (not detailed in source).
- The attacker renames
msbuild.exeto a different filename (e.g.,msbuild_renamed.exe). - The attacker crafts a malicious XML project file containing inline code or instructions to download and execute a payload.
- The attacker executes the renamed
msbuild.exewith the malicious project file as an argument (msbuild_renamed.exe evil.xml). msbuild.exeparses the XML file and executes the embedded malicious code. This code could be shellcode, PowerShell commands, or .NET assemblies.- The executed code performs malicious actions, such as downloading additional malware, establishing persistence, or exfiltrating data.
- The attacker uses the compromised system to move laterally within the network, escalating privileges and accessing sensitive resources.
Impact
Successful execution of renamed msbuild.exe can lead to full system compromise. Attackers can leverage this technique to bypass application control and execute arbitrary code, potentially leading to data theft, ransomware deployment, or disruption of critical services. The use of a trusted system utility for malicious purposes makes detection more challenging, increasing the likelihood of successful exploitation.
Recommendation
- Enable Sysmon process creation logging (Event ID 1) and Windows Event Log Security 4688 to capture process execution details.
- Deploy the Sigma rule
Suspicious MSBuild Renameto your SIEM to detect renamed instances ofmsbuild.exe. - Investigate any instances of renamed
msbuild.exeexecutions, focusing on the parent processes, command-line arguments, and network connections. - Implement application control policies to restrict the execution of renamed system utilities.
- Monitor for unusual network activity originating from systems where
msbuild.exehas been renamed.
Detection coverage 2
Suspicious MSBuild Rename
highDetects the execution of renamed MSBuild.exe instances
MSBuild Spawned Suspicious Child Processes
mediumDetects MSBuild spawning command interpreters or script hosts
Detection queries are kept inside the platform. Get full rules →