AMSI
Memory Patch
1. Ret Memory Patch
创建一个powershell进程,然后通过ret硬编码让AmsiScanBuffer返回 代码和etwpatch处相似 不过这种方法容易被杀软查杀
1 |
|
2. AmsiOpenSession Memory Patch
C++ https://github.com/TheD1rkMtr/AMSI_patch/blob/main/AmsiOpenSession/AmsiOpenSession.cpp
这里直接把代码贴过来 学习下
1 |
|
AmsiOpenSession() 将74 je 改为 75 jne
通过NtProtectVirtualMemory 向指定的powershell进程写入内存补丁
3.AmsiScanBuffer Patch
通过IDA、Windbg查看AmsiScanBuffer、AmsiScanString 可以发现 80070057h
//static byte[] x64 = new byte[] { 0xB8, 0x57, 0x00, 0x07, 0x80, 0xC3 };
//static byte[] x86 = new byte[] { 0xB8, 0x57, 0x00, 0x07, 0x80, 0xC2, 0x18, 0x00 };
可参考 C# (之前C#没咋写过不太熟悉 后面再搞 顺便抽时间实现下P/Invoke)
https://aq.mk/index.php/archives/88.html
https://txluck.github.io/2022/03/26/bypass-AMSI/
https://www.cyberark.com/resources/threat-research-blog/amsi-bypass-redux
In-Process Patchless ASMI Bypass[待实现]
主要通过硬件断点
参考项目:
https://gist.github.com/CCob/fe3b63d80890fafeca982f76c8a3efdf
https://ethicalchaos.dev/2022/04/17/in-process-patchless-amsi-bypass/
https://github.com/VoldeSec/PatchlessInlineExecute-Assembly
https://gist.github.com/susMdT/360c64c842583f8732cc1c98a60bfd9e
ETW
Ret Memory Patch
1 | #include <Windows.h> |
将call处代码替换为0x90 然后直接ret返回
1 |
|
将call xxx 处的9个字节替换为90 nop 直接ret