<?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>PowerShell — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/powershell/</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>Fri, 26 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/powershell/feed.xml" rel="self" type="application/rss+xml"/><item><title>PowerShell Kerberos Ticket Dumping via LSA Authentication Package Access</title><link>https://feed.craftedsignal.io/briefs/2024-01-26-powershell-kerberos-dump/</link><pubDate>Fri, 26 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-26-powershell-kerberos-dump/</guid><description>Detection of PowerShell scripts attempting to dump Kerberos tickets from memory by accessing LSA authentication packages, potentially leading to credential access and lateral movement.</description><content:encoded><![CDATA[<p>This threat brief focuses on detecting PowerShell scripts designed to extract Kerberos tickets from memory. Attackers use these scripts to gain unauthorized access to credentials, which can then be leveraged for lateral movement within a network. The scripts achieve this by interacting with the Local Security Authority (LSA) and accessing Kerberos authentication packages. The observed PowerShell scripts utilize specific Kerberos ticket message types or dynamic Kerberos package lookup to enumerate and retrieve tickets. This behavior is often associated with post-exploitation activity, where attackers are attempting to escalate privileges or move laterally within a compromised environment. Defenders should monitor PowerShell activity for these patterns, as successful Kerberos ticket dumping can lead to significant security breaches. The scripts are not associated with any specific campaign or version.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system (e.g., through phishing or exploiting a vulnerability).</li>
<li>The attacker executes a PowerShell script.</li>
<li>The PowerShell script uses <code>LsaCallAuthenticationPackage</code> to interact with the LSA.</li>
<li>The script attempts to retrieve Kerberos tickets by using functions like <code>KerbRetrieveEncodedTicketMessage</code>, <code>KerbQueryTicketCacheMessage</code>, <code>KerbQueryTicketCacheExMessage</code>, or <code>KerbRetrieveTicketMessage</code>.</li>
<li>Alternatively, the script uses <code>LsaLookupAuthenticationPackage</code> to dynamically locate the Kerberos package.</li>
<li>The script may then decrypt the ticket data using <code>KerbDecryptDataMessage</code>.</li>
<li>The script may attempt to serialize or export the extracted tickets to a file.</li>
<li>The attacker uses the dumped Kerberos tickets to impersonate users or services, gaining unauthorized access to resources and facilitating lateral movement.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows attackers to steal Kerberos tickets from memory. The attacker can then use these tickets to impersonate legitimate users or services, enabling them to move laterally within the network, access sensitive data, and potentially compromise critical systems. The impact includes unauthorized access to resources, data breaches, and potentially a complete compromise of the targeted Windows domain.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging to capture the malicious script content (as mentioned in the &ldquo;Setup&rdquo; section).</li>
<li>Deploy the Sigma rule &ldquo;PowerShell Kerberos Ticket Dump&rdquo; to detect scripts exhibiting Kerberos ticket dumping behavior.</li>
<li>Investigate any alerts triggered by the Sigma rule, focusing on the reconstructed script block content and process lineage as outlined in the &ldquo;Triage and analysis&rdquo; section.</li>
<li>Monitor for file creation events related to ticket material exports (e.g., &ldquo;.kirbi&rdquo; files) to identify potential ticket dumping activity.</li>
<li>Review authentication events (event codes 4624, 4625, 4648) to identify suspicious logins originating from compromised systems.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>credential-access</category><category>kerberos</category><category>powershell</category><category>windows</category></item><item><title>PowerShell Share Enumeration via ShareFinder or Native APIs</title><link>https://feed.craftedsignal.io/briefs/2024-01-09-powershell-share-enumeration/</link><pubDate>Tue, 09 Jan 2024 15:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-09-powershell-share-enumeration/</guid><description>Detection of PowerShell scripts employing ShareFinder functions or Windows share enumeration APIs to discover accessible network shares for reconnaissance, lateral movement, or ransomware deployment.</description><content:encoded><![CDATA[<p>This detection identifies PowerShell scripts utilizing ShareFinder functions (Invoke-ShareFinder/Invoke-ShareFinderThreaded) or native Windows API calls for share enumeration. These techniques are commonly used by attackers to map accessible network shares within an environment. This reconnaissance is often a precursor to data collection, lateral movement, or the deployment of ransomware. The activity is detected via script block logging, and focuses on identifying specific function calls and API usage within the PowerShell script content. Defenders should be aware of this activity, particularly when performed by unexpected users or on unusual systems, as it may indicate malicious reconnaissance within the network. The references indicate that this activity can lead to corporate insurance policy exfiltration or Conti ransomware deployment.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system, potentially through phishing or compromised credentials.</li>
<li>The attacker executes a PowerShell script, either directly or through a fileless execution method.</li>
<li>The PowerShell script utilizes ShareFinder functions (Invoke-ShareFinder, Invoke-ShareFinderThreaded) or Windows share enumeration APIs (NetShareEnum, NetApiBufferFree) to discover network shares.</li>
<li>The script identifies accessible network shares by leveraging API calls and parsing the results for share names (shi1_netname) and remarks (shi1_remark).</li>
<li>The attacker analyzes the identified shares to determine those that are accessible and contain valuable data.</li>
<li>The attacker may then attempt to access these shares using compromised credentials or exploiting existing vulnerabilities.</li>
<li>Once access is gained, the attacker may collect sensitive data from the shares, move laterally to other systems, or deploy ransomware.</li>
<li>The ultimate goal is data exfiltration, system compromise, or financial gain through ransomware.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this reconnaissance technique can lead to significant data breaches, lateral movement within the network, and potential ransomware deployment. Organizations that fail to detect and prevent share enumeration may suffer financial losses, reputational damage, and operational disruption. The referenced &ldquo;Stolen Images&rdquo; campaign led to Conti ransomware deployment, and the &ldquo;Hunting for corporate insurance policies&rdquo; post highlights data exfiltration.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell script block logging to capture the necessary events for detection (as referenced in the rule setup).</li>
<li>Deploy the Sigma rule &ldquo;PowerShell Share Enumeration Script via Invoke-ShareFinder&rdquo; to your SIEM and tune for your environment.</li>
<li>Deploy the Sigma rule &ldquo;PowerShell Share Enumeration via NetShareEnum API&rdquo; to detect share enumeration using native Windows APIs.</li>
<li>Investigate any alerts generated by these rules, focusing on the PowerShell launch context and the scope of the share discovery (see triage steps in the original rule).</li>
<li>Review and restrict PowerShell execution policies to prevent unauthorized script execution, especially from user-writable locations.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>discovery</category><category>powershell</category><category>share-enumeration</category><category>lateral-movement</category><category>ransomware</category></item><item><title>Incoming Execution via PowerShell Remoting</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-powershell-remoting/</link><pubDate>Wed, 03 Jan 2024 18:53:23 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-03-powershell-remoting/</guid><description>This rule identifies remote execution via Windows PowerShell remoting, which allows a user to run any Windows PowerShell command on one or more remote computers, potentially indicating lateral movement.</description><content:encoded><![CDATA[<p>This detection identifies potential lateral movement through the exploitation of Windows PowerShell remoting. PowerShell remoting is a feature that enables administrators and attackers to execute commands on remote Windows systems. The detection focuses on identifying incoming network connections on ports 5985 (HTTP) and 5986 (HTTPS), the default ports used for PowerShell Remoting, followed by the execution of processes spawned by <code>wsmprovhost.exe</code>, the Windows Remote Management process host. This activity, when originating from unexpected sources, may indicate unauthorized access and lateral movement within a network. The rule is designed to detect suspicious activity by monitoring network traffic and process execution, flagging potential unauthorized remote executions, and enabling security teams to respond swiftly.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a network, possibly through phishing or exploiting a vulnerability on an internet-facing system.</li>
<li>The attacker leverages PowerShell remoting to initiate a connection to a target system on ports 5985 or 5986.</li>
<li>The target system accepts the incoming PowerShell Remoting connection.</li>
<li>The <code>wsmprovhost.exe</code> process is launched on the target system to facilitate the remote PowerShell session.</li>
<li>The attacker executes commands remotely, spawning child processes from <code>wsmprovhost.exe</code>.</li>
<li>The attacker attempts to escalate privileges or move laterally to other systems within the network using the remote PowerShell session.</li>
<li>The attacker uses tools such as <code>net.exe</code> or <code>PsExec</code> over the remote PowerShell session to further propagate.</li>
<li>The attacker achieves their objective, such as data exfiltration or deploying ransomware, by leveraging the established remote session.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of PowerShell Remoting for lateral movement can lead to widespread compromise within an organization. An attacker could gain control over multiple systems, potentially leading to data breaches, system outages, or ransomware deployment. The number of affected systems could range from a few critical servers to a significant portion of the network, depending on the attacker&rsquo;s objectives and the organization&rsquo;s security posture. The impact could include financial losses, reputational damage, and disruption of business operations.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Incoming Execution via PowerShell Remoting</code> to your SIEM to detect suspicious PowerShell remoting activity and tune for your environment.</li>
<li>Monitor network connections to ports 5985 and 5986, and investigate any unauthorized or unexpected traffic using the <code>network_connection</code> log source.</li>
<li>Investigate processes spawned by <code>wsmprovhost.exe</code> for unusual or malicious activity using the <code>process_creation</code> log source.</li>
<li>Whitelist authorized administrative IP addresses or user accounts that frequently perform remote management tasks, as mentioned in the false positives analysis.</li>
<li>Review and document automated scripts or scheduled tasks that use PowerShell Remoting for system maintenance, then create exceptions for their specific process names or execution paths.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>lateral-movement</category><category>powershell</category><category>remoting</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>Remote File Download via PowerShell</title><link>https://feed.craftedsignal.io/briefs/2024-01-remote-file-download-powershell/</link><pubDate>Wed, 03 Jan 2024 15:25:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-remote-file-download-powershell/</guid><description>Detects PowerShell being used to download executable files from untrusted remote destinations, a common technique for attackers to introduce tooling or malware into a compromised environment.</description><content:encoded><![CDATA[<p>Attackers frequently use PowerShell, a legitimate administration tool, to download malicious payloads into compromised systems. This technique allows them to bypass traditional security measures by leveraging a trusted tool. This activity often occurs during the command and control phase, where attackers introduce additional tooling or malware for further exploitation. This rule identifies instances where PowerShell downloads executable and script files from untrusted remote destinations. It does this by correlating network and file events, specifically looking for PowerShell processes initiating network connections to non-whitelisted domains followed by the creation of executable or script files. The rule helps defenders identify and respond to potential command and control activity and malware deployment attempts.</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 (powershell.exe, pwsh.exe, or powershell_ise.exe) to initiate a network connection to a remote domain.</li>
<li>The DNS request is made to a domain not in the allowed list (e.g., not *.microsoft.com, *.azureedge.net, etc.).</li>
<li>PowerShell downloads a file with an executable extension (e.g., .exe, .dll, .ps1, .bat) or a file with a MZ header.</li>
<li>The downloaded file is saved to disk.</li>
<li>The file is saved to a location that is not excluded by the rule, filtering out commonly used temporary directories.</li>
<li>The downloaded executable or script is then executed, leading to further malicious activities.</li>
<li>The attacker achieves persistence, lateral movement, or data exfiltration depending on the downloaded payload.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack can lead to the introduction of malware, backdoors, or other malicious tools into the compromised system. This can enable attackers to perform a wide range of malicious activities, including data theft, system compromise, and further propagation within the network. The compromised system can become a beachhead for further attacks, potentially impacting numerous systems and leading to significant financial and reputational damage.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>PowerShell Remote File Download</code> to detect PowerShell processes downloading executable files from untrusted remote destinations by correlating network and file creation events.</li>
<li>Enable Elastic Defend to provide the necessary network and file event data for the rule to function correctly as noted in the <a href="https://ela.st/install-elastic-defend">setup instructions</a>.</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on the parent process of the PowerShell process, the reputation of the downloaded file, and any other suspicious activities on the affected host, as per the investigation guide in the rule&rsquo;s <code>note</code> field.</li>
<li>Review and customize the whitelisted domains in the Sigma rule to match your organization&rsquo;s specific environment and trusted external resources, as described in the <code>query</code> field.</li>
<li>Block the identified malicious domains or IP addresses at the network perimeter to prevent further downloads.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>command-and-control</category><category>file-download</category><category>powershell</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>PowerShell Obfuscation via String Concatenation</title><link>https://feed.craftedsignal.io/briefs/2024-01-posh-string-concat/</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-posh-string-concat/</guid><description>This rule detects PowerShell scripts employing string concatenation to evade static analysis and AMSI by fragmenting keywords or URLs at runtime.</description><content:encoded><![CDATA[<p>This detection identifies PowerShell scripts that repeatedly concatenate quoted string literals using the <code>+</code> operator. Attackers use this technique to obfuscate malicious commands, URLs, or tokens, thereby evading static analysis and Anti-Malware Scan Interface (AMSI). The rule focuses on scripts with a script block length greater than 500 characters to reduce false positives. Successful exploitation allows attackers to execute malicious code without detection. This behavior matters for defenders as it bypasses traditional security measures that rely on static code analysis. This rule has been in production since 2025 and was updated in April 2026.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system through various means (e.g., phishing, exploit).</li>
<li>The attacker uploads or introduces a PowerShell script containing obfuscated code via string concatenation.</li>
<li>The script is executed using <code>powershell.exe</code>, potentially with arguments to bypass execution policies.</li>
<li>PowerShell interprets the script, which dynamically assembles commands by concatenating multiple string literals.</li>
<li>The dynamically assembled commands execute malicious actions, such as downloading a payload from a remote server.</li>
<li>The downloaded payload is saved to disk or executed directly in memory.</li>
<li>The payload establishes persistence using registry keys or scheduled tasks.</li>
<li>The attacker achieves their objective, such as data exfiltration or deploying ransomware.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful obfuscation can lead to the execution of arbitrary code, bypassing security measures, and potentially leading to system compromise. Consequences include data theft, system disruption, or ransomware deployment. The number of potential victims is broad, encompassing any Windows system running PowerShell. This technique can affect any sector.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging to capture the full script content (referenced in the rule&rsquo;s <code>Data Source: PowerShell Logs</code> tag and the <code>setup</code> section of the source).</li>
<li>Deploy the provided Sigma rule to your SIEM and tune the <code>Esql.script_block_pattern_count</code> threshold based on your environment (see <code>rules</code> section below).</li>
<li>Investigate alerts generated by this rule, focusing on the reconstructed PowerShell script and its execution context (see <code>note</code> section of the source).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>defense-evasion</category><category>powershell</category><category>obfuscation</category><category>windows</category></item><item><title>PowerShell MiniDump Script Detection</title><link>https://feed.craftedsignal.io/briefs/2024-01-powershell-minidump/</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-minidump/</guid><description>This brief detects PowerShell scripts that reference MiniDumpWriteDump or full-memory minidump types, potentially used to capture process memory from credential-bearing processes like LSASS.</description><content:encoded><![CDATA[<p>This rule detects PowerShell scripts that contain references to MiniDumpWriteDump, MiniDumpWithFullMemory, or obfuscated versions of these strings (e.g., pmuDetirWpmuDiniM). Attackers can leverage these functions to create memory dumps of processes, including sensitive processes such as LSASS, which contains cached credentials. The dumping of LSASS memory allows attackers to extract credentials for lateral movement and privilege escalation within a compromised network. The rule is designed to detect scripts utilizing these techniques, providing an early warning sign of potential credential theft attempts. The rule leverages PowerShell script block logging (event ID 4104). The original rule was created in 2021 and updated in April 2026 according to the source.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system through various means, such as phishing, exploiting a vulnerability, or using compromised credentials.</li>
<li>The attacker executes a PowerShell script on the target system. This script may be directly executed or injected into an existing PowerShell process.</li>
<li>The PowerShell script contains code that references MiniDumpWriteDump or MiniDumpWithFullMemory, or an obfuscated variant, indicating an intention to create a memory dump.</li>
<li>The script identifies a target process, often LSASS (lsass.exe), or iterates through running processes to select a target.</li>
<li>Using the MiniDumpWriteDump function, the script creates a memory dump of the targeted process.</li>
<li>The memory dump is saved to a file on the system, potentially in a location that is easily accessible to the attacker.</li>
<li>The attacker may then compress or encrypt the dump file to avoid detection and prepare it for exfiltration.</li>
<li>The attacker exfiltrates the memory dump from the compromised system for offline analysis and credential extraction.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful execution of this attack can lead to the compromise of sensitive credentials stored in memory, such as domain administrator accounts. This can enable attackers to move laterally within the network, escalate privileges, and gain access to critical systems and data. The impact could include data breaches, financial losses, and reputational damage. The number of victims can vary depending on the scope of the initial compromise and the effectiveness of the attacker&rsquo;s lateral movement.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging (event ID 4104) to capture the necessary events for detection. Reference: <a href="https://atc-project.org/atc-data/blob/master/docs/Logging_Policies/LP_0109_windows_powershell_script_block_log.md">https://atc-project.org/atc-data/blob/master/docs/Logging_Policies/LP_0109_windows_powershell_script_block_log.md</a></li>
<li>Deploy the Sigma rule &ldquo;PowerShell MiniDump Script&rdquo; to your SIEM and tune for your environment to detect suspicious PowerShell scripts.</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on the script content, target process, and output file. Use the investigation steps provided in the rule&rsquo;s documentation.</li>
<li>Monitor for file creation events related to memory dumps (e.g., *.dmp files) and analyze these files for sensitive information.</li>
<li>Implement strict access controls and privilege management to limit the potential impact of credential theft.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>credential-access</category><category>powershell</category><category>minidump</category><category>windows</category></item><item><title>PowerShell Loading .NET Assemblies via Reflection</title><link>https://feed.craftedsignal.io/briefs/2024-01-03-powershell-reflection-load/</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-03-powershell-reflection-load/</guid><description>This analytic detects PowerShell scripts leveraging .NET reflection to load assemblies into memory, a technique commonly used by threat actors to bypass defenses and execute malicious code.</description><content:encoded><![CDATA[<p>This threat brief addresses the use of PowerShell to load .NET assemblies into memory using reflection, a technique frequently observed in advanced attacks. Threat actors, including those employing frameworks like Empire and Cobalt Strike, utilize this method to execute code directly in memory, evading traditional file-based security controls. The detection strategy focuses on PowerShell Script Block Logging (EventCode=4104), which captures the full commands executed, enabling analysis for specific reflection-related keywords. This behavior is a strong indicator of potential malicious activity, as it allows for unauthorized code execution, privilege escalation, and persistent access. Defenders should prioritize detection and response to such events to mitigate the risk of compromise. The technique allows attackers to bypass traditional defenses, execute code in memory, and potentially establish persistence within the targeted environment.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Initial Access: The attacker gains initial access to the system, possibly through phishing or exploiting a vulnerability.</li>
<li>PowerShell Execution: The attacker executes PowerShell, often obfuscated or encoded, to avoid detection.</li>
<li>Reflection Assembly Loading: The PowerShell script uses reflection techniques, such as <code>[System.Reflection.Assembly]::Load()</code>, to load a .NET assembly directly into memory.</li>
<li>Bypassing Security Controls: The in-memory execution bypasses traditional security controls that scan files on disk.</li>
<li>Malicious Code Execution: The loaded assembly contains malicious code, which could be a payload for lateral movement, data exfiltration, or other malicious activities.</li>
<li>Privilege Escalation: The malicious code may attempt to escalate privileges to gain higher-level access to the system.</li>
<li>Persistence: The attacker establishes persistence by creating scheduled tasks or modifying registry keys.</li>
<li>Lateral Movement: The attacker uses the compromised system as a springboard to move laterally within the network, compromising additional systems.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation can lead to unauthorized code execution, privilege escalation, and persistent access within the environment. By loading .NET assemblies directly into memory, attackers can bypass traditional file-based security controls, making detection more challenging. This technique is often employed in advanced attacks, potentially affecting numerous systems across the network, leading to significant data breaches and system compromise. While specific victim counts are not available, the impact is considered high due to the potential for widespread damage and data loss.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging (EventCode=4104) on all endpoints to capture the full commands executed, as referenced in the description.</li>
<li>Deploy the provided Sigma rules to your SIEM to detect PowerShell scripts loading .NET assemblies into memory via reflection.</li>
<li>Investigate and remediate any alerts generated by the Sigma rules, prioritizing systems with high-value data or critical functions.</li>
<li>Regularly review and update PowerShell execution policies to restrict the execution of unsigned or untrusted scripts.</li>
<li>Monitor PowerShell logs for suspicious activity, such as the use of reflection techniques to load assemblies from unusual locations.</li>
<li>Consult the references provided, specifically the Microsoft .NET API documentation and the Palantir article on event tracing, to deepen your understanding of the attack techniques and potential mitigations.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>powershell</category><category>reflection</category><category>dotnet</category><category>memory-injection</category><category>attack.execution</category><category>attack.t1059.001</category></item><item><title>PowerShell Obfuscation via Backtick-Escaped Variable Expansion</title><link>https://feed.craftedsignal.io/briefs/2024-01-powershell-backtick-obfuscation/</link><pubDate>Tue, 02 Jan 2024 10:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-powershell-backtick-obfuscation/</guid><description>PowerShell scripts use backtick-escaped characters inside `${}` variable expansion to reconstruct strings at runtime, enabling attackers to split keywords, hide commands, and evade static analysis and AMSI.</description><content:encoded><![CDATA[<p>This rule detects PowerShell scripts employing backtick-escaped characters within <code>${}</code> variable expansion, a technique used to reconstruct strings at runtime. Attackers leverage variable-expansion obfuscation to split keywords, conceal commands, and bypass static analysis and AMSI (Antimalware Scan Interface). This obfuscation method involves inserting multiple backticks between word characters inside <code>${}</code> blocks. Detecting this behavior is crucial as it signifies attempts to evade security measures and potentially execute malicious code on compromised systems. The rule focuses on identifying scripts with a length exceeding 500 characters to minimize false positives and targets PowerShell event code 4104.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains initial access to a Windows system, potentially through phishing or exploiting a software vulnerability.</li>
<li>The attacker uploads or creates a PowerShell script on the target system.</li>
<li>The PowerShell script employs backtick-escaped variable expansion (e.g., <code>$env:use``r``na``me</code>) to obfuscate its contents.</li>
<li>The obfuscated script is executed using powershell.exe.</li>
<li>The script dynamically reconstructs commands and strings by evaluating the backtick-escaped variables.</li>
<li>The reconstructed commands perform malicious activities, such as downloading additional payloads or modifying system configurations.</li>
<li>The script attempts to evade detection by AMSI and other security tools.</li>
<li>The attacker achieves persistence and control over the compromised system, potentially leading to data exfiltration or further lateral movement.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation can lead to arbitrary code execution, system compromise, and data theft. While the number of victims is unknown, PowerShell is a common attack vector on Windows environments. The sectors most affected are organizations relying on Windows infrastructure without adequate PowerShell monitoring and security controls. Failure to detect and prevent this technique allows attackers to bypass security measures and gain unauthorized access to sensitive data.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Enable PowerShell Script Block Logging to generate event code 4104. (Reference: Setup section)</li>
<li>Deploy the Sigma rule <code>Detect PowerShell Backtick Variable Obfuscation</code> to identify scripts using backtick-escaped variable expansion.</li>
<li>Investigate any alerts generated by the Sigma rule, focusing on scripts with a high <code>Esql.script_block_pattern_count</code> value.</li>
<li>Monitor for process creation events where powershell.exe executes obfuscated commands as detected by the Sigma rule <code>Detect Suspicious PowerShell Encoded Commands</code>.</li>
<li>Review PowerShell logs for event code 4104 and examine <code>powershell.file.script_block_text</code> for suspicious patterns.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>powershell</category><category>obfuscation</category><category>defense-evasion</category><category>variable-expansion</category><category>windows</category></item></channel></rss>