<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>MSBuild — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/msbuild/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 09 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/msbuild/feed.xml" rel="self" type="application/rss+xml"/><item><title>MSBuild Making Network Connections Indicating Potential Defense Evasion</title><link>https://feed.craftedsignal.io/briefs/2024-01-09-msbuild-network-connections/</link><pubDate>Tue, 09 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-09-msbuild-network-connections/</guid><description>MsBuild.exe making outbound network connections may indicate adversarial activity as attackers leverage MsBuild to execute code and evade detection.</description><content:encoded><![CDATA[<p>Attackers may abuse the Microsoft Build Engine (MSBuild) to execute malicious files or masquerade as legitimate utilities to bypass detections and evade defenses. MSBuild is a platform for building applications using an XML schema for project files that controls how the build platform processes and builds software. The observed behavior involves MsBuild.exe initiating outbound network connections, which is not typical for its intended use and may indicate unauthorized code execution or command and control activity. This activity can be used to download malicious payloads, exfiltrate data, or establish a reverse shell. Detecting this behavior is crucial as it can be an early indicator of compromise.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker gains initial access through an external vector (e.g., phishing, software vulnerability).</li>
<li>Attacker executes MsBuild.exe.</li>
<li>MSBuild executes a malicious project file (.csproj, .vbproj).</li>
<li>The project file contains embedded or referenced code (e.g., C#, VB.NET) designed to perform malicious actions.</li>
<li>The malicious code executes, initiating a network connection.</li>
<li>The network connection is established to an external command and control (C2) server or a resource hosting a malicious payload.</li>
<li>Data exfiltration or payload download occurs via the network connection.</li>
<li>The attacker gains further control over the compromised system, potentially leading to lateral movement or data theft.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Compromised systems can lead to data breaches, system instability, and further propagation of malware within the network. Successful exploitation can result in sensitive information being stolen, disruption of services, and potential financial losses. This activity can be difficult to detect without specific monitoring rules and can lead to extended dwell time for attackers within the compromised environment.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>MSBuild Making Outbound Network Connection</code> to your SIEM to detect suspicious network connections initiated by MsBuild.exe.</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on the destination IP addresses and the content of the network traffic.</li>
<li>Monitor process execution events for instances of MsBuild.exe executing unusual or suspicious project files.</li>
<li>Enable process monitoring with command-line argument logging to identify potential malicious project files being passed to MsBuild.exe.</li>
<li>Consider implementing application control policies to restrict the execution of MsBuild.exe to authorized users and processes only.</li>
<li>Block known malicious domains and IP addresses associated with command and control activity at the firewall or DNS resolver.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>command-and-control</category><category>msbuild</category></item><item><title>MSBuild Making Network Connections</title><link>https://feed.craftedsignal.io/briefs/2024-01-09-msbuild-network/</link><pubDate>Tue, 09 Jan 2024 10:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-09-msbuild-network/</guid><description>Detection of MsBuild.exe making outbound network connections which may indicate adversarial activity used to execute code and evade detection.</description><content:encoded><![CDATA[<p>The Microsoft Build Engine (MSBuild) is a platform for building applications that uses an XML schema for project files to control the build process. Attackers can abuse MSBuild to execute malicious code, proxy code execution, and masquerade as legitimate utilities to evade defenses. This behavior is often used in defense evasion tactics. This detection identifies instances of <code>MsBuild.exe</code> executing and subsequently establishing network connections to external addresses. This activity warrants further investigation as it deviates from expected usage patterns and might signify malicious exploitation of MSBuild.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Adversary gains initial access to the system via unspecified means.</li>
<li>Adversary executes <code>MsBuild.exe</code>.</li>
<li>MSBuild process loads and executes a malicious project file, potentially containing embedded code or instructions to download and execute further payloads.</li>
<li>The project file instructs MSBuild to initiate a network connection to a remote server.</li>
<li>MSBuild establishes an outbound network connection to the attacker-controlled server.</li>
<li>The attacker can use the established connection for command and control (C2) or data exfiltration.</li>
<li>The compromised host may download additional malicious tools or payloads from the C2 server using MSBuild&rsquo;s network capabilities.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack leveraging MSBuild can lead to code execution, defense evasion, and potentially command and control. Although the number of affected organizations is not specified, any Windows environment where developers use MSBuild is potentially at risk. If successful, attackers can bypass traditional security measures, gain unauthorized access, and exfiltrate sensitive data.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable process creation logging and network connection logging on Windows endpoints to capture the necessary events for detection.</li>
<li>Deploy the Sigma rule &ldquo;MSBuild Making Network Connections&rdquo; to your SIEM and tune for your environment.</li>
<li>Investigate any alerts generated by the Sigma rule by examining the process execution chain and network connections for suspicious activity.</li>
<li>Consider adding exceptions for legitimate MSBuild network activity, based on destination IP addresses and command-line arguments.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>msbuild</category><category>windows</category></item><item><title>MSBuild запускает необычные процессы</title><link>https://feed.craftedsignal.io/briefs/2024-01-msbuild-unusual-process/</link><pubDate>Wed, 03 Jan 2024 15:30:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-msbuild-unusual-process/</guid><description>Adversaries may exploit MSBuild to execute malicious scripts or compile code, bypassing security controls; this rule detects unusual processes initiated by MSBuild, such as PowerShell or C# compiler, signaling potential misuse for executing unauthorized or harmful actions.</description><content:encoded><![CDATA[<p>The Microsoft Build Engine (MSBuild) is a legitimate tool used for building applications. However, adversaries may abuse MSBuild to execute malicious scripts or compile code, effectively bypassing security controls. This technique is often employed to deploy malicious payloads. This detection focuses on identifying instances where MSBuild initiates unusual processes such as PowerShell, Internet Explorer, or the Visual C# Command Line Compiler (csc.exe). This activity is considered suspicious because legitimate software development workflows do not typically involve MSBuild directly spawning these processes. The original Elastic detection rule was created on 2020-03-25 and last updated on 2026-05-04.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a system (e.g., through phishing or exploiting a vulnerability).</li>
<li>The attacker modifies or creates an MSBuild project file (.csproj or .sln) containing malicious commands.</li>
<li>The malicious MSBuild project file is crafted to execute a script or compile code.</li>
<li>The attacker uses the MSBuild.exe or msbuild.exe utility to execute the malicious project file.</li>
<li>MSBuild spawns an unusual process such as powershell.exe, csc.exe, or iexplore.exe based on the malicious project file configuration.</li>
<li>PowerShell executes arbitrary commands, downloads further payloads, or performs other malicious actions.</li>
<li>The C# compiler (csc.exe) compiles malicious code into an executable or library.</li>
<li>The compiled malware or downloaded payloads execute, leading to further compromise, such as data exfiltration or lateral movement.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation can lead to arbitrary code execution, allowing attackers to deploy malware, compromise sensitive data, and establish persistence on the targeted system. The use of MSBuild for malicious purposes allows attackers to bypass application whitelisting and other security controls that trust signed Microsoft binaries. While the precise number of victims is unknown, this technique can be employed against a wide range of organizations, particularly those with vulnerable systems or inadequate endpoint protection.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable process creation logging, specifically including parent-child relationships, to detect unusual process spawning by MSBuild (logs-endpoint.events.process-*, logs-system.security*, logs-windows.forwarded*, logs-windows.sysmon_operational-*, winlogbeat-*).</li>
<li>Deploy the Sigma rule &ldquo;Microsoft Build Engine Started an Unusual Process&rdquo; to your SIEM to identify instances of MSBuild spawning suspicious processes, and tune for your environment.</li>
<li>Investigate any instances of MSBuild spawning PowerShell, csc.exe, or iexplore.exe to determine if the activity is legitimate or malicious (process.name:(&ldquo;csc.exe&rdquo; or &ldquo;iexplore.exe&rdquo; or &ldquo;powershell.exe&rdquo;)).</li>
<li>Monitor for modifications to MSBuild project files (.proj or .sln) for signs of tampering.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>execution</category><category>msbuild</category></item><item><title>Suspicious MSBuild Execution from Scripting Processes</title><link>https://feed.craftedsignal.io/briefs/2024-01-msbuild-script-execution/</link><pubDate>Wed, 03 Jan 2024 14:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-msbuild-script-execution/</guid><description>Adversaries may use MSBuild, a legitimate Microsoft tool, to execute malicious code through script interpreters for defense evasion and execution on Windows systems.</description><content:encoded><![CDATA[<p>The Microsoft Build Engine (MSBuild) is a software build platform typically used by developers. However, attackers can abuse MSBuild to execute malicious code by using it as a proxy execution method, allowing them to bypass traditional defenses. This technique involves invoking MSBuild from scripting environments like PowerShell or cmd.exe to run arbitrary code within the context of a trusted process. The activity detected by this rule focuses on instances where MSBuild is launched by a script interpreter, which is not typical for standard software development workflows. This behavior, observed since at least 2020, can be used for stealthy execution of payloads and defense evasion tactics, especially in environments that trust MSBuild as a legitimate system utility. Defenders should be aware of this technique as it allows attackers to blend in with normal system activity and bypass application control policies.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker gains initial access to the target system, potentially through phishing or exploiting a software vulnerability.</li>
<li>A script (e.g., PowerShell, cmd.exe) is used to execute a malicious command or series of commands.</li>
<li>The script invokes <code>msbuild.exe</code> with specific arguments to execute arbitrary code. This might involve inline tasks or references to external XML project files containing malicious instructions.</li>
<li>MSBuild processes the provided XML file or inline task, interpreting and executing the malicious code.</li>
<li>The executed code performs actions such as downloading additional payloads, modifying system configurations, or establishing persistence.</li>
<li>MSBuild, acting as a proxy, executes the attacker&rsquo;s code within a trusted process, potentially evading detection by security software.</li>
<li>The attacker leverages the compromised system to move laterally within the network, escalating privileges, and accessing sensitive data.</li>
<li>The attacker&rsquo;s final objective is achieved, such as data exfiltration or deploying ransomware.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows attackers to execute arbitrary code on Windows systems, potentially leading to data theft, system compromise, and further propagation within the network. This technique can bypass application control and other security measures, making it difficult to detect and prevent. The impact can range from minor data breaches to complete system takeover, depending on the attacker&rsquo;s objectives and the compromised system&rsquo;s role within the organization.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable Sysmon process creation logging (Event ID 1) to capture the process tree and command-line arguments, enabling detection of suspicious MSBuild executions.</li>
<li>Deploy the Sigma rule <code>Microsoft Build Engine Started by a Script Process</code> to your SIEM to identify instances of MSBuild being invoked by script interpreters. Tune the rule with appropriate whitelisting for known development activities to reduce false positives.</li>
<li>Monitor process execution events for <code>msbuild.exe</code> with parent processes such as <code>cmd.exe</code>, <code>powershell.exe</code>, <code>cscript.exe</code>, and <code>mshta.exe</code>.</li>
<li>Implement application control policies to restrict the execution of MSBuild to authorized users and directories.</li>
<li>Regularly review and update the list of excluded processes and directories in the Sigma rule to adapt to changing development practices.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>execution</category><category>msbuild</category><category>proxy-execution</category></item><item><title>MSBuild Process Injection Detection</title><link>https://feed.craftedsignal.io/briefs/2024-01-msbuild-process-injection/</link><pubDate>Wed, 03 Jan 2024 14:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-msbuild-process-injection/</guid><description>The Microsoft Build Engine (MSBuild) is being abused to perform process injection by creating threads in other processes, a technique used to evade detection and potentially escalate privileges.</description><content:encoded><![CDATA[<p>The Microsoft Build Engine (MSBuild) is a platform for building applications, commonly used in software development environments. Adversaries are exploiting MSBuild to perform process injection, a technique to execute malicious code within the address space of another process. This allows attackers to evade detection and potentially escalate privileges. The detection focuses on monitoring for thread creation in other processes by instances of MSBuild.exe. This activity is considered unusual outside of legitimate software development or build environments. The exploitation of MSBuild for process injection is a known technique (T1127.001) to proxy execution through trusted developer utilities.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to the system through various means (e.g., compromised credentials, software vulnerability).</li>
<li>The attacker executes MSBuild.exe, either directly or through another process.</li>
<li>MSBuild.exe is used to load and execute a malicious project file or inline code.</li>
<li>The malicious code within the MSBuild project file leverages Windows API calls to create a thread in a target process.</li>
<li>The created thread injects malicious code or a payload into the target process&rsquo;s memory space.</li>
<li>The injected code executes within the context of the target process, potentially performing malicious activities.</li>
<li>These activities could include lateral movement, data exfiltration, or establishing persistence.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful process injection can lead to a variety of malicious outcomes, including privilege escalation, data theft, and system compromise. While the specific number of victims is not available, any Windows system running MSBuild is potentially vulnerable. The use of a trusted Microsoft utility like MSBuild makes detection more difficult, as it can blend in with legitimate developer activity. This can lead to prolonged compromise and significant damage before the malicious activity is detected.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable Sysmon process creation and CreateRemoteThread logging (event IDs 1 and 8) to detect the malicious activity described in the attack chain.</li>
<li>Deploy the Sigma rule &ldquo;Process Injection by the Microsoft Build Engine&rdquo; to your SIEM and tune for your environment to reduce false positives.</li>
<li>Implement application whitelisting to prevent unauthorized execution of MSBuild.exe in non-development environments.</li>
<li>Monitor the parent processes of MSBuild.exe for unusual or suspicious activity.</li>
</ul>
]]></content:encoded><category domain="severity">low</category><category domain="type">advisory</category><category>defense-evasion</category><category>privilege-escalation</category><category>process-injection</category></item><item><title>Microsoft Build Engine Executed After Renaming</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-msbuild-renamed/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-msbuild-renamed/</guid><description>Attackers may rename the Microsoft Build Engine (MSBuild) executable to evade detection and proxy execution of malicious code.</description><content:encoded><![CDATA[<p>Attackers may rename legitimate utilities, such as MSBuild, to evade detection, application allowlists, and other security protections. MSBuild, the Microsoft Build Engine, is a platform for building applications. Attackers can abuse MSBuild to proxy the execution of malicious code. The detection rule identifies instances where MSBuild is started after being renamed, indicating a potential attempt to evade detection. The rule focuses on identifying processes where the original file name is MSBuild.exe, but the process name is different, suggesting a renaming attempt.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system.</li>
<li>The attacker renames the legitimate MSBuild.exe executable to a different name (e.g., evil.exe) to evade detection.</li>
<li>The attacker executes the renamed MSBuild executable (evil.exe) with a malicious project file (.csproj or similar).</li>
<li>MSBuild processes the project file, which contains commands or scripts to be executed.</li>
<li>The malicious commands within the project file are executed by MSBuild, potentially downloading or executing further payloads.</li>
<li>The attacker may use MSBuild to execute PowerShell commands or other scripting languages for lateral movement or further exploitation.</li>
<li>MSBuild can be used to modify files, registry entries, or other system settings.</li>
<li>The attacker achieves their final objective, such as data exfiltration or establishing persistence.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation can lead to arbitrary code execution, allowing attackers to install malware, steal sensitive information, or compromise the entire system. The renaming of MSBuild can bypass standard application allowlisting and detection mechanisms.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable Sysmon process creation logging to capture the <code>Image</code> and <code>OriginalFileName</code> fields.</li>
<li>Deploy the Sigma rule &ldquo;Microsoft Build Engine Using an Alternate Name&rdquo; to your SIEM and tune for your environment to detect renamed MSBuild executables based on process metadata and command-line arguments.</li>
<li>Monitor process execution events for processes with <code>OriginalFileName</code> of &ldquo;MSBuild.exe&rdquo; and a different <code>process.name</code>.</li>
<li>Implement application control policies to restrict the execution of renamed executables, specifically those with an <code>OriginalFileName</code> of &ldquo;MSBuild.exe.&rdquo;</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>execution</category><category>msbuild</category><category>masquerading</category></item><item><title>Potential Credential Access via MSBuild Loading Credential Management DLLs</title><link>https://feed.craftedsignal.io/briefs/2024-01-02-msbuild-credential-dumping/</link><pubDate>Tue, 02 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-02-msbuild-credential-dumping/</guid><description>The detection rule identifies a potential credential access attempt via the trusted developer utility MSBuild by detecting instances where it loads DLLs associated with Windows credential management, specifically vaultcli.dll or SAMLib.DLL, which is often used for credential dumping.</description><content:encoded><![CDATA[<p>This detection rule identifies potential credential access attempts leveraging the Microsoft Build Engine (MSBuild). Attackers may abuse MSBuild, a legitimate developer tool, to load malicious DLLs related to Windows credential management, such as <code>vaultcli.dll</code> or <code>SAMLib.dll</code>. This technique enables credential dumping by a trusted Windows utility, making it harder to detect. The rule focuses on detecting the loading of these specific DLLs by MSBuild processes. The rule relies on data from Elastic Defend and Sysmon logs.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker gains initial access to the target system (e.g., via phishing or exploiting a vulnerability).</li>
<li>Attacker places a malicious <code>.csproj</code> file or a DLL designed to load credential management DLLs on the system.</li>
<li>The attacker executes <code>MSBuild.exe</code> to process the malicious project file.</li>
<li><code>MSBuild.exe</code> loads the attacker-controlled DLL.</li>
<li>The attacker-controlled DLL loads either <code>vaultcli.dll</code> or <code>SAMLib.dll</code>.</li>
<li>The loaded DLLs are used to dump credentials from the system.</li>
<li>The attacker accesses the dumped credentials.</li>
<li>The attacker uses the compromised credentials for lateral movement or data exfiltration.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack can lead to the compromise of sensitive credentials stored on the affected system. This can allow attackers to move laterally within the network, access confidential data, and potentially compromise entire domains. The impact ranges from data breaches to complete system compromise, depending on the privileges of the compromised accounts.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>MSBuild Loads Credential Management DLL</code> to your SIEM, tuned for your specific environment, to detect instances of MSBuild loading <code>vaultcli.dll</code> or <code>SAMLib.dll</code>.</li>
<li>Enable Sysmon event ID 7 (Image Loaded) logging with the appropriate configurations to capture DLL loading events.</li>
<li>Investigate any instances of MSBuild loading <code>vaultcli.dll</code> or <code>SAMLib.dll</code> from unusual or unexpected locations using the guidance in the rule note.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>credential-access</category><category>defense-evasion</category><category>windows</category></item></channel></rss>