<?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>Process-Injection — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/process-injection/</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>Thu, 09 May 2024 14:22:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/process-injection/feed.xml" rel="self" type="application/rss+xml"/><item><title>Windows Parent Process PID Spoofing Detection</title><link>https://feed.craftedsignal.io/briefs/2024-05-parent-process-spoofing/</link><pubDate>Thu, 09 May 2024 14:22:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-05-parent-process-spoofing/</guid><description>Adversaries use parent process PID spoofing to evade detection by creating processes with mismatched parent-child relationships, hindering process monitoring and potentially elevating privileges on Windows systems.</description><content:encoded><![CDATA[<p>Parent process PID spoofing is a defense evasion technique where a process is created with a parent process ID (PPID) that differs from its actual creator. This can be used to circumvent process monitoring tools that rely on accurate parent-child relationships. Adversaries may leverage this technique to disguise malicious processes as legitimate system processes or to elevate privileges by associating malicious activities with trusted processes. The technique involves manipulating process creation APIs to set an arbitrary PPID. The Elastic Defend integration is designed to capture the necessary process telemetry to detect these discrepancies. This activity matters because it can allow attackers to hide their actions and persist on compromised systems undetected. The referenced Elastic detection rule was last updated on 2026/04/30, demonstrating continued relevance.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker gains initial access to the Windows system (e.g., via phishing or exploit).</li>
<li>Attacker executes a malicious process, such as a script or executable.</li>
<li>The malicious process uses API calls (e.g., <code>CreateProcess</code>, <code>NtCreateProcessEx</code>) to spawn a new process.</li>
<li>During process creation, the attacker modifies the PPID parameter to spoof a legitimate parent process.</li>
<li>The new process is launched with the spoofed PPID, appearing as a child of the chosen parent.</li>
<li>The spoofed process executes malicious code, potentially downloading additional payloads or establishing command and control.</li>
<li>The adversary leverages the trusted appearance of the spoofed process to evade detection by security tools.</li>
<li>The attacker achieves their final objective, such as data exfiltration, lateral movement, or persistence.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful parent process PID spoofing can allow attackers to evade detection and maintain persistence on a compromised system. This can lead to data breaches, system compromise, and financial loss. While the number of victims and specific sectors targeted are not specified in the provided source material, the technique is applicable across various sectors and organizations utilizing Windows-based systems. The lack of detection can lead to prolonged dwell time, increasing the potential for significant damage.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Detect Suspicious Process Creation with PPID Spoofing</code> to your SIEM to identify potential parent process PID spoofing attempts based on process telemetry data.</li>
<li>Enable and monitor process creation events with parent-child relationships using Elastic Defend to capture the necessary data for the provided rule.</li>
<li>Investigate alerts generated by the Sigma rule by examining the process tree and verifying the legitimacy of parent-child relationships as outlined in the rule&rsquo;s description.</li>
<li>Configure endpoint detection and response (EDR) solutions to identify and block suspicious processes spawned by common exploitation vectors like Office applications and script hosts, as these are often associated with PPID spoofing.</li>
<li>Review and tune the Sigma rule, specifically the <code>process.pe.original_file_name</code> and <code>process.executable</code> lists, to match your organization&rsquo;s baseline and reduce false positives.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>defense-evasion</category><category>process-injection</category><category>windows</category></item><item><title>Potential Process Injection via PowerShell</title><link>https://feed.craftedsignal.io/briefs/2024-01-24-posh-process-injection/</link><pubDate>Wed, 24 Jan 2024 10:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-24-posh-process-injection/</guid><description>This detection identifies PowerShell scripts leveraging Win32 APIs for memory allocation, process access, and thread creation, indicative of potential process injection or in-memory payload execution on Windows systems.</description><content:encoded><![CDATA[<p>This detection focuses on identifying PowerShell scripts that combine specific Win32 API calls, often used in process injection and in-memory payload execution techniques. Attackers use PowerShell, a ubiquitous scripting language in Windows environments, to inject malicious code into other processes, bypassing traditional security controls. The rule specifically targets API combinations related to memory allocation (VirtualAlloc, VirtualAllocEx), memory protection (VirtualProtect), process access (OpenProcess), dynamic library loading (LdrLoadDll, LoadLibrary), and thread manipulation (CreateRemoteThread, NtCreateThreadEx). The rule excludes script activity originating from within Microsoft Defender Advanced Threat Protection directories, reducing false positives. This technique is valuable to attackers seeking to evade detection and execute malicious code stealthily. The detection logic is based on observing specific API combinations, commonly seen in tools like Empire.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system, possibly through phishing or exploiting a vulnerability.</li>
<li>The attacker uses PowerShell to execute a malicious script.</li>
<li>The PowerShell script uses <code>OpenProcess</code> to gain access to a target process.</li>
<li>The script then uses <code>VirtualAllocEx</code> to allocate memory within the target process.</li>
<li><code>WriteProcessMemory</code> is used to write malicious code into the allocated memory.</li>
<li>The script uses <code>CreateRemoteThread</code> or <code>NtCreateThreadEx</code> to create a new thread within the target process, pointing to the injected code.</li>
<li>The injected code executes within the context of the target process.</li>
<li>The attacker achieves their objective, such as credential dumping or establishing persistence.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful process injection allows attackers to execute arbitrary code within the context of another process, often a legitimate one. This can lead to credential theft, privilege escalation, data exfiltration, or the deployment of ransomware. The impact is significant, as it allows attackers to bypass security controls and operate stealthily. While the number of victims is unknown, the widespread use of PowerShell makes this a potentially widespread threat. Successful attacks can compromise sensitive data, disrupt business operations, and damage an organization&rsquo;s reputation.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging to capture the necessary events (4104) for this detection to function as described in the setup instructions <a href="https://ela.st/powershell-logging-setup">https://ela.st/powershell-logging-setup</a>.</li>
<li>Deploy the provided Sigma rules to your SIEM to detect suspicious PowerShell scripts indicative of process injection. Tune the rules based on your environment&rsquo;s baseline activity.</li>
<li>Investigate any alerts generated by these rules, focusing on the reconstructed script content, target process, and execution context. Refer to the investigation guide section for triage steps.</li>
<li>Implement application control policies to restrict the execution of unauthorized PowerShell scripts.</li>
<li>Monitor PowerShell execution for suspicious API calls related to process injection, as described in the rule&rsquo;s <code>query</code>.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>process injection</category><category>powershell</category><category>defense evasion</category></item><item><title>Uncommon Svchost Command Line Parameters Indicate Potential Masquerading or Injection</title><link>https://feed.craftedsignal.io/briefs/2024-01-23-svchost-uncommon-params/</link><pubDate>Tue, 23 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-23-svchost-uncommon-params/</guid><description>Detection of svchost.exe executing with uncommon command-line parameters, excluding known legitimate patterns, which may indicate file masquerading, process injection, or process hollowing.</description><content:encoded><![CDATA[<p>Svchost.exe (Service Host) is a critical Windows process responsible for hosting various Windows services. Attackers frequently target svchost.exe to disguise malicious activity, using techniques like process injection or file masquerading. By injecting malicious code into a legitimate svchost.exe process or creating a fake svchost.exe executable, attackers can evade detection and escalate privileges. This can be done by spawning the process with unusual arguments to trick the OS or a user. Detecting these anomalies is crucial for identifying potentially compromised systems. The attacks documented leveraging this technique started to gain prominence around 2018 and are still relevant in 2026.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to the system (e.g., through phishing or exploiting a vulnerability).</li>
<li>The attacker uploads a malicious executable or script to the compromised system.</li>
<li>The attacker injects malicious code into a legitimate svchost.exe process. Alternatively, the attacker may copy the svchost.exe executable and rename it, placing it in a different directory.</li>
<li>The injected code or masqueraded executable executes with unusual command-line arguments, deviating from the standard &ldquo;-k <servicegroup>&rdquo; parameter.</li>
<li>The malicious svchost process performs unauthorized actions, such as establishing network connections, modifying files, or creating new processes.</li>
<li>The attacker leverages the elevated privileges of the svchost process to further compromise the system.</li>
<li>The attacker attempts to maintain persistence by modifying registry keys or scheduling tasks.</li>
<li>The ultimate goal is data exfiltration, lateral movement, or ransomware deployment.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Compromised svchost.exe processes can lead to significant system instability and data breaches. Attackers may leverage these processes to gain complete control over affected systems, potentially impacting hundreds or thousands of machines in a network. The consequences can include data theft, financial losses, and reputational damage. Ransomware groups, such as BlackByte/Exbyte, and APT groups, like APT41, have been observed using similar techniques to evade detection and achieve their objectives.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule &ldquo;Uncommon Svchost Command Line Parameter&rdquo; to your SIEM to detect anomalous svchost.exe processes based on command-line arguments.</li>
<li>Investigate any alerts triggered by the Sigma rule to determine if they are indicative of malicious activity.</li>
<li>Enable process creation logging, specifically capturing command-line arguments, to provide the necessary data for detection.</li>
<li>Implement application control policies to restrict the execution of unauthorized executables, including masqueraded svchost.exe instances.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>defense-evasion</category><category>privilege-escalation</category><category>process-injection</category></item><item><title>Potential LSASS Clone Creation via PssCaptureSnapShot</title><link>https://feed.craftedsignal.io/briefs/2024-01-lsass-clone-creation/</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-lsass-clone-creation/</guid><description>Detection of LSASS process cloning using PssCaptureSnapShot, where the parent process is also LSASS, indicating a potential attempt to dump LSASS memory for credential access.</description><content:encoded><![CDATA[<p>This detection identifies the creation of an LSASS process clone via <code>PssCaptureSnapShot</code> on Windows systems. The rule focuses on scenarios where the parent process of the new LSASS instance is also <code>lsass.exe</code>. This behavior is often associated with attackers attempting to bypass security controls and dump LSASS memory to extract credentials. The technique is used to evade detection mechanisms that monitor the primary LSASS process. Successful exploitation can lead to the compromise of domain or local credentials stored in memory, allowing for lateral movement and privilege escalation within the network. The detection is based on Windows Security Event Logs, specifically event code 4688, and is designed to identify this specific cloning behavior.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker gains initial access to the system (e.g., through phishing or exploiting a vulnerability).</li>
<li>The attacker executes code on the target system, potentially using tools like PowerShell or command-line utilities.</li>
<li>The attacker initiates a process to clone the LSASS process using <code>PssCaptureSnapShot</code>.</li>
<li>The newly created process, a clone of LSASS, runs alongside the original.</li>
<li>The attacker leverages the cloned LSASS process to dump its memory. This may involve tools like <code>comsvcs.dll</code>, <code>rundll32.exe</code> or custom scripts leveraging the MiniDumpWriteDump function.</li>
<li>The attacker extracts sensitive information from the dumped memory, including usernames, passwords, and Kerberos tickets.</li>
<li>The attacker uses the extracted credentials to move laterally within the network, accessing additional systems and resources.</li>
<li>The attacker achieves their final objective, such as data exfiltration or deploying ransomware.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation can result in the compromise of sensitive credentials stored in LSASS memory, including domain and local account credentials. This can lead to unauthorized access to critical systems and data, potentially resulting in data breaches, financial loss, and reputational damage. Domain controllers, jump hosts, and systems with privileged accounts are at especially high risk. The number of affected systems can range from a single machine to a large portion of the network, depending on the attacker&rsquo;s objectives and the scope of the compromised credentials.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable and monitor Windows Security Event Logs with event code 4688 for process creation events, specifically focusing on the process and parent process names to identify LSASS cloning attempts (see rule below).</li>
<li>Deploy the provided Sigma rule to your SIEM to detect potential LSASS clone creation via <code>PssCaptureSnapShot</code>. Tune the rule for your environment to reduce false positives.</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on identifying the processes involved in cloning and dumping LSASS memory.</li>
<li>Enable Audit Process Creation and Command Line logging as per the Elastic documentation to ensure the events used by the provided Sigma rules are captured.</li>
<li>If a LSASS clone is detected, review authentication events (4624, 4648, 4625) on the affected host to identify any suspicious logons or credential usage.</li>
<li>Monitor for file activity related to memory dumps (e.g., .dmp files) using the process clone to identify potential credential theft attempts.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>credential-access</category><category>lsass</category><category>process-injection</category></item><item><title>PowerShell P/Invoke Process Injection API Chain Detection</title><link>https://feed.craftedsignal.io/briefs/2024-01-powershell-pinvoke-process-injection/</link><pubDate>Wed, 03 Jan 2024 18:23:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-powershell-pinvoke-process-injection/</guid><description>This analytic detects PowerShell code that uses P/Invoke to call Windows API functions associated with process injection, such as VirtualAlloc, WriteProcessMemory, and CreateRemoteThread, indicating potential malicious activity.</description><content:encoded><![CDATA[<p>This detection identifies PowerShell scripts leveraging the P/Invoke (Platform Invoke) technology to perform process injection. P/Invoke allows managed code (like PowerShell) to call unmanaged functions exported from DLLs, including critical Windows API functions. Attackers use this to inject malicious code into legitimate processes for evasion and persistence. The detection focuses on identifying specific API chains commonly used in process injection techniques, such as allocating memory in a target process (VirtualAlloc), writing malicious code into the allocated memory (WriteProcessMemory), and executing the injected code (CreateRemoteThread). This activity is often associated with malware deployment, privilege escalation, and defense evasion. The detection logic is designed to identify these API chains either at the compile phase using Add-Type or during the execution phase, alerting on suspicious PowerShell behavior.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker gains initial access to the system, potentially through phishing or exploiting a vulnerability.</li>
<li>PowerShell is invoked to execute a malicious script.</li>
<li>The PowerShell script uses Add-Type and DllImport to declare external functions from Windows DLLs, including kernel32.dll and ntdll.dll.</li>
<li>The script uses functions such as OpenProcess to gain a handle to a target process.</li>
<li>VirtualAllocEx is called to allocate memory within the target process.</li>
<li>WriteProcessMemory is used to write malicious code into the allocated memory region of the target process.</li>
<li>CreateRemoteThread is called to create a new thread within the target process, pointing to the injected code.</li>
<li>The injected code executes within the context of the target process, achieving code execution and potential privilege escalation.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful process injection allows attackers to execute arbitrary code within the context of a trusted process, bypassing security controls and potentially gaining elevated privileges. This can lead to data theft, system compromise, or further propagation within the network. The use of PowerShell and P/Invoke makes detection more challenging, as the activity can blend in with legitimate system administration tasks. A successful attack could lead to the deployment of a VIP Keylogger or other malware, as noted in the provided references.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging (Event ID 4104) to provide the necessary data for detection (data_source).</li>
<li>Deploy the Sigma rule <code>PowerShell PInvoke Process Injection</code> to your SIEM and tune the rule to your environment (rules).</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on the specific API chains identified in the <code>detection</code> section of the rule.</li>
<li>Review PowerShell execution policies and restrict the execution of unsigned scripts to reduce the attack surface.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>process-injection</category><category>powershell</category><category>pinvoke</category><category>defense-evasion</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>Suspicious Endpoint Security Parent Process Detected</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-suspicious-endpoint-parent/</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-suspicious-endpoint-parent/</guid><description>This rule detects suspicious parent processes of endpoint security solutions such as Elastic Defend, Microsoft Defender, and SentinelOne, indicating potential process hollowing or code injection attempts to evade detection.</description><content:encoded><![CDATA[<p>This detection identifies potentially malicious attempts to evade endpoint security solutions by monitoring the parent processes of security executables. Adversaries may employ process hollowing or other code injection techniques to inject malicious code into legitimate processes, such as <code>esensor.exe</code> or <code>elastic-endpoint.exe</code>, to avoid detection. The rule flags unexpected parent processes based on deviations from expected behavior, excluding known benign paths and arguments to minimize false positives. This activity is important for defenders as successful evasion can lead to significant compromise of systems and data. The rule supports various data sources, including Elastic Defend, Microsoft Defender XDR, SentinelOne Cloud Funnel, and Sysmon, providing broad coverage across different security ecosystems.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to the system through an unknown vector.</li>
<li>The attacker attempts to inject malicious code into a legitimate endpoint security process (<code>esensor.exe</code> or <code>elastic-endpoint.exe</code>).</li>
<li>The malicious code is injected using process hollowing or similar techniques.</li>
<li>The endpoint security process is launched by a suspicious parent process outside of known legitimate paths (e.g., not in <code>C:\Program Files\Elastic\*</code> or <code>C:\Windows\System32\*</code>).</li>
<li>The injected code executes within the context of the endpoint security process, potentially disabling or bypassing security controls.</li>
<li>The attacker leverages the compromised endpoint security process to perform further malicious activities, such as lateral movement or data exfiltration.</li>
<li>The endpoint security solution&rsquo;s ability to detect and respond to threats is impaired, allowing the attacker to operate undetected.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation via process injection can lead to a significant degradation of endpoint security posture. Attackers can disable or bypass security controls, allowing them to perform malicious activities such as data theft, ransomware deployment, or lateral movement undetected. The impact can range from individual system compromise to widespread network breaches, depending on the scope of the attack.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Suspicious Endpoint Security Parent Process</code> to your SIEM to detect anomalous parent-child process relationships involving endpoint security executables.</li>
<li>Enable Sysmon process creation logging (Event ID 1) to provide detailed process execution data for the Sigma rule.</li>
<li>Investigate any alerts generated by the Sigma rule by reviewing the parent process executable path, command-line arguments, and historical activity.</li>
<li>Add legitimate but unusual parent process paths to the Sigma rule&rsquo;s exclusion list to reduce false positives, as described in the rule&rsquo;s <code>False positive analysis</code> section.</li>
<li>Correlate alerts from this rule with other security events from data sources like Elastic Endgame, Microsoft Defender XDR, or Sysmon, as recommended in the rule&rsquo;s <code>Possible investigation steps</code> section.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>process-injection</category><category>windows</category></item><item><title>PowerShell P/Invoke API Chain for Process Injection</title><link>https://feed.craftedsignal.io/briefs/2024-01-powershell-pinvoke-injection/</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-powershell-pinvoke-injection/</guid><description>This brief details detection of PowerShell scripts leveraging P/Invoke API calls to perform process injection, covering techniques like self-injection, remote thread injection, APC injection, thread-context hijacking, process hollowing, section-map injection, reflective DLL loading, and DLL injection.</description><content:encoded><![CDATA[<p>This brief focuses on the detection of PowerShell scripts utilizing Platform Invoke (P/Invoke) to perform process injection. P/Invoke allows managed code (PowerShell) to call native, unmanaged code (Windows API functions). Adversaries leverage this capability to inject malicious code into other processes, bypassing traditional defenses. This activity is identified through PowerShell script block logging (Event ID 4104). The detection strategy covers both the compile phase (detecting inline .NET class definitions with DllImport declarations) and the execution phase (detecting static method invocation patterns using ::MethodName syntax with execution context indicators). This ensures broad coverage, even when pre-compiled assemblies are loaded. The techniques detected cover a wide range of process injection methods, increasing the likelihood of detection against various attack vectors.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker executes a PowerShell script containing malicious code designed for process injection.</li>
<li>The script uses <code>Add-Type -TypeDefinition</code> to define a .NET class inline, embedding C# source code that includes <code>[DllImport]</code> declarations for Windows API functions.</li>
<li>The <code>DllImport</code> attribute specifies the native DLL (e.g., kernel32.dll, ntdll.dll) and the function name to import.</li>
<li>The script declares external functions like <code>VirtualAlloc</code>, <code>WriteProcessMemory</code>, <code>CreateRemoteThread</code>, <code>NtCreateSection</code>, and <code>NtMapViewOfSection</code> using <code>extern &lt;ReturnType&gt; &lt;FunctionName&gt;</code>.</li>
<li>The script uses static method invocation (e.g., <code>[IntPtr]::Zero</code>, <code>[Marshal]::Copy</code>) to call the declared functions.</li>
<li>The script allocates memory in the target process using <code>VirtualAllocEx</code> or <code>NtAllocateVirtualMemory</code>.</li>
<li>The malicious code (shellcode or DLL) is written to the allocated memory using <code>WriteProcessMemory</code>.</li>
<li>A new thread is created in the target process to execute the injected code using <code>CreateRemoteThread</code> or <code>RtlCreateUserThread</code>. Alternatively, APC injection uses <code>QueueUserAPC</code> to queue an Asynchronous Procedure Call in the target process.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful process injection allows attackers to execute arbitrary code within the context of a legitimate process. This can lead to privilege escalation, credential theft, and persistence. Process injection can also be used to bypass security software and gain unauthorized access to sensitive data. This technique has been observed in malware campaigns associated with VIP Keylogger and similar threats, leading to data exfiltration and system compromise.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell script block logging (Event ID 4104) to capture the necessary data for detection.</li>
<li>Deploy the provided Sigma rules to your SIEM to detect malicious PowerShell scripts using P/Invoke for process injection.</li>
<li>Investigate any alerts generated by the Sigma rules, focusing on processes that exhibit suspicious API call patterns.</li>
<li>Review and tune the Sigma rules based on your environment to minimize false positives and ensure accurate detection.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>process-injection</category><category>powershell</category><category>pinvoke</category></item><item><title>Unusual Parent-Child Relationship Detection</title><link>https://feed.craftedsignal.io/briefs/2024-01-unusual-parent-child/</link><pubDate>Wed, 03 Jan 2024 10:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-unusual-parent-child/</guid><description>This rule identifies Windows programs run from unexpected parent processes, which could indicate masquerading or other strange activity on a system, potentially indicating process injection, masquerading, access token manipulation, or parent PID spoofing.</description><content:encoded><![CDATA[<p>This detection identifies Windows programs executed with unexpected parent processes, which may indicate masquerading, process injection, or other anomalous behavior. The detection logic focuses on deviations from established parent-child process relationships within the Windows operating system. This rule leverages data from multiple sources, including Elastic Defend, CrowdStrike, Microsoft Defender XDR, SentinelOne Cloud Funnel, Sysmon, and Windows Security Event Logs, to enhance detection coverage. This is important for defenders as unusual parent-child process relationships can be indicative of various malicious activities, including privilege escalation and defense evasion techniques employed by threat actors. The rule aims to provide early detection of potentially malicious activities by identifying deviations from the expected process execution patterns.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker gains initial access to the system (e.g., through phishing or exploiting a vulnerability).</li>
<li>The attacker executes a malicious payload that attempts to masquerade as a legitimate process.</li>
<li>The malicious process is launched with an unexpected parent process, deviating from normal Windows process relationships. For example, <code>autochk.exe</code> running without <code>smss.exe</code> as its parent.</li>
<li>The malicious process attempts to inject code into other processes for privilege escalation or defense evasion, leveraging techniques like process hollowing.</li>
<li>The injected code gains elevated privileges, allowing the attacker to perform sensitive actions on the system.</li>
<li>The attacker uses the elevated privileges to move laterally within the network, compromising additional systems.</li>
<li>The attacker attempts to maintain persistence by creating scheduled tasks or modifying registry keys.</li>
<li>The attacker achieves their final objective, such as data exfiltration or deploying ransomware.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack exploiting unusual parent-child relationships can lead to privilege escalation, allowing attackers to gain control of the compromised system. This can result in data breaches, system downtime, and financial losses. The rule aims to mitigate these risks by detecting suspicious process executions early in the attack chain. While the exact number of potential victims and sectors targeted is not explicitly mentioned, the broad applicability of Windows systems makes this a widespread threat.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the provided Sigma rules to your SIEM and tune for your environment to detect unusual parent-child process relationships (see <code>rules</code> section).</li>
<li>Enable process creation logging with command line arguments in your Windows environment using Sysmon or Windows Security Event Logs to ensure the necessary data is available for detection.</li>
<li>Investigate and baseline common parent-child process relationships in your environment to reduce false positives.</li>
<li>Integrate your SIEM with threat intelligence feeds to identify known malicious processes and their associated parent processes.</li>
<li>Configure endpoint detection and response (EDR) solutions like Elastic Defend, CrowdStrike, Microsoft Defender XDR, and SentinelOne to collect and analyze process execution data (see <code>setup</code> section in the source URL).</li>
<li>Refer to the investigation guide linked in the source URL to triage alerts related to unusual parent-child process relationships.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>privilege-escalation</category><category>defense-evasion</category><category>windows</category><category>process-injection</category><category>masquerading</category><category>access-token-manipulation</category><category>parent-pid-spoofing</category></item><item><title>Suspicious Process Creation Followed by Memory Access from Unknown Region</title><link>https://feed.craftedsignal.io/briefs/2024-01-suspicious-process-calltrace/</link><pubDate>Wed, 03 Jan 2024 10:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-suspicious-process-calltrace/</guid><description>The rule identifies suspicious process creation where a process is created and immediately accessed from an unknown memory code region by the same parent process, indicating a potential code injection attempt, specifically process hollowing, commonly targeting processes spawned by Microsoft Office applications, scripting engines, and command-line tools for defense evasion.</description><content:encoded><![CDATA[<p>This detection identifies potential process injection attempts, specifically process hollowing, by monitoring process creation events followed by memory access from unknown regions. The rule focuses on processes spawned by Microsoft Office applications (winword.exe, excel.exe, outlook.exe, powerpnt.exe), scripting engines (cscript.exe, wscript.exe, mshta.exe), and command-line tools (cmd.exe, powershell.exe, rundll32.exe, regsvr32.exe, wmic.exe, cmstp.exe, msxsl.exe). The logic looks for a spawned process by one of these applications/tools, followed by a process access event for an unknown memory region by the parent process, indicating a potential code injection attempt. Attackers use process injection to hide malicious activity within legitimate processes, evading detection and hindering forensic analysis. This technique is a common tactic used to establish persistence, escalate privileges, or execute malicious payloads.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>A user opens a malicious document or executes a script.</li>
<li>The Microsoft Office application (e.g., winword.exe) or scripting engine (e.g., wscript.exe) starts as a parent process.</li>
<li>The parent process creates a new child process (e.g., a legitimate system executable).</li>
<li>The attacker injects malicious code into the newly created child process&rsquo;s memory, often overwriting legitimate code sections.</li>
<li>The parent process accesses the child process&rsquo;s memory from an unknown code region, indicating the injected code. Sysmon event ID 10 captures this access.</li>
<li>The injected code executes within the context of the child process, performing malicious actions.</li>
<li>These actions can include establishing persistence, downloading additional malware, or exfiltrating data.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful process injection allows attackers to mask their malicious activities within legitimate processes, making detection and attribution significantly harder. This can lead to prolonged infections, data breaches, and system compromise. The impact can range from individual workstation compromise to widespread organizational damage, depending on the attacker&rsquo;s objectives and the compromised system&rsquo;s role. The rule mitigates risks associated with advanced persistent threats (APTs) and commodity malware using process injection for defense evasion.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable Sysmon Event ID 1 (Process Creation) and Event ID 10 (Process Access) to collect the necessary telemetry for this detection (<a href="https://ela.st/sysmon-event-1-setup">Sysmon Event ID 1 - Process Creation</a>, <a href="https://ela.st/sysmon-event-10-setup">Sysmon Event ID 10 - Process Access</a>).</li>
<li>Deploy the Sigma rule &ldquo;Suspicious Process Creation CallTrace&rdquo; to your SIEM and tune for your environment.</li>
<li>Investigate any alerts triggered by the Sigma rule, focusing on the process execution chain and potential malicious activities performed by the injected code.</li>
<li>Consider memory dumping the child process for further analysis, to examine if malicious code exists.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>defense-evasion</category><category>process-injection</category><category>windows</category></item><item><title>Unusual Child Process from a System Virtual Process</title><link>https://feed.craftedsignal.io/briefs/2024-01-unusual-system-vp-child/</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-unusual-system-vp-child/</guid><description>A suspicious child process of the Windows virtual system process is detected, potentially indicating code injection and defense evasion.</description><content:encoded><![CDATA[<p>This detection identifies unusual child processes spawned by the Windows virtual system process (PID 4). This activity is suspicious because the System process should typically only spawn specific, known system-level processes. Unexpected child processes could indicate code injection, process hollowing, or other defense evasion techniques. The rule specifically looks for processes where the parent PID is 4 and the executable name does not match expected system binaries (Registry, MemCompression, smss.exe, HotPatch). This rule uses data from Elastic Defend, Microsoft Defender XDR, SentinelOne, Sysmon, and Windows event logs, making it applicable across various environments. The rule focuses on Windows systems because PID 4 is specific to the Windows operating system.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to the system through an exploit or social engineering.</li>
<li>The attacker injects malicious code into a running process.</li>
<li>The injected code leverages the SYSTEM process (PID 4) to spawn a child process.</li>
<li>The child process is an unexpected or malicious binary, not typically associated with the SYSTEM process.</li>
<li>The malicious child process executes further actions, such as establishing persistence or escalating privileges.</li>
<li>The attacker uses the spawned process to perform lateral movement or data exfiltration.</li>
<li>The attacker attempts to evade detection by hiding within the SYSTEM process context.</li>
<li>The final objective is to compromise the system, steal data, or establish a persistent foothold.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack could lead to complete system compromise, data theft, or the installation of persistent malware. The attacker gains elevated privileges by leveraging the SYSTEM process, making detection and remediation more difficult. While the number of affected victims and sectors are not specified, this technique can be used in targeted attacks against high-value systems, potentially impacting critical infrastructure or sensitive data environments.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Unusual System Virtual Process Child Process</code> to your SIEM to detect potential code injection and defense evasion attempts.</li>
<li>Enable Sysmon process creation logging (Event ID 1) to ensure the required data is available for the Sigma rule.</li>
<li>Investigate any alerts generated by the Sigma rule by examining the parent and child process relationships, binary identities, and process behaviors as outlined in the rule&rsquo;s triage notes.</li>
<li>Monitor <code>process.executable</code>, <code>process.hash.sha256</code>, <code>process.pe.original_file_name</code>, <code>process.code_signature.subject_name</code> to confirm the child binary identity and ensure it is consistent with the claimed system component.</li>
<li>Review <code>process.Ext.relative_file_creation_time</code>, <code>process.Ext.relative_file_name_modify_time</code>, and <code>process.Ext.created_suspended</code> to identify potential file dropping, renaming, or hollowing techniques at process startup.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>defense-evasion</category><category>process-injection</category><category>windows</category></item></channel></rss>