.. / AMSI-Bypass-amsiContext
Star

One-liner to bypass the AMSI in a Powershell. Done by overwriting the amsiContext header by copying data (four zeros) from managed to unmanaged memory. When the context structure header is overwritten, this should force AmsiOpenSession to error out. The additional code is Rasta Mouse’s memory patch to bypass AMSI, run the one-liner and the additional code to disable AMSI in powershell.

Command Reference:

loop the GetTypes method, searching for all types containing the string “iUtils” in its name

GetFields accepts filtering modifiers, we’ll apply the NonPublic and Static filters to help narrow the results

loop through all the fields, searching for a name containing “Context”, as this does not be marked as malicious looking for the amsiContext

use Copy to overwrite the amsiContext header by copying data (four zeros) from managed to unmanaged memory
Command: Copy Extra code: Copy References:

https://gist.github.com/D3Ext/bf57673644ba08e729f65892e0dae6c4