
SysWhispers2 的 C# 移植版。
它使用 SharpASM 来查找用于执行系统调用存根的代码洞。
阅读博客文章了解技术细节:https://www.secforce.com/blog/sharpasm-sharpwhispers/
______ _ ____ _
/ __/ / ___ ________| | /| / / / (_)__ ___ ___ _______
_\ \/ _ \/ _ `/ __/ _ \ |/ |/ / _ \/ (_-</ _ \/ -_) __(_-<
/___/_//_/\_,_/_/ / .__/__/|__/_//_/_/___/ .__/\__/_/ /___/
/_/ /_/
@d_glenx
@SECFORCE_LTD
=============================================================
usage: SharpWhispers.py [-h] [-p PRESET] [-f FUNCTIONS] -o OUT_FILE
optional arguments:
-h, --help show this help message and exit
-p PRESET, --preset PRESET
Preset ("all", "common", "dinvoke")
-f FUNCTIONS, --functions FUNCTIONS
Comma-separated functions
-o OUT_FILE, --out-file OUT_FILE
Output basename (w/o extension)
创建 Visual Studio 项目的说明见此处
基本进程注入示例见此处
目前,json 文件包含生成 33 个系统调用所需的数据。
注意:All 预设仅包含所有系统调用中的一个子集。
==== System Calls Imported ====
==[DInvoke]==
[i] Number of Delegates: 13
NtCreateThreadEx
NtCreateSection
NtUnmapViewOfSection
NtMapViewOfSection
NtQueryInformationProcess
NtOpenProcess
NtAllocateVirtualMemory
NtFreeVirtualMemory
NtQueryVirtualMemory
NtProtectVirtualMemory
NtWriteVirtualMemory
NtReadVirtualMemory
NtOpenFile
==[Additional]==
[i] Number of Delegates: 20
NtOpenThread
NtQueueApcThread
NtOpenSection
NtSuspendThread
NtQueryInformationFile
NtSetContextThread
NtResumeProcess
NtOpenProcessToken
NtWaitForMultipleObjects
NtQueryDirectoryFile
NtAdjustPrivilegesToken
NtQuerySystemInformation
NtDeviceIoControlFile
NtResumeThread
NtCreateProcess
NtSuspendProcess
NtGetContextThread
NtClose
NtQueryInformationThread
NtTestAlert
NtCreateThreadEx
NtCreateSection
NtUnmapViewOfSection
NtMapViewOfSection
NtQueryInformationProcess
NtAllocateVirtualMemory
NtFreeVirtualMemory
NtProtectVirtualMemory
NtWriteVirtualMemory
NtOpenFile
NtReadVirtualMemory
NtQueryVirtualMemory
NtOpenProcess
NtCreateThreadEx
NtCreateSection
NtUnmapViewOfSection
NtMapViewOfSection
NtQueryInformationProcess
NtOpenProcess
NtAllocateVirtualMemory
NtFreeVirtualMemory
NtQueryVirtualMemory
NtProtectVirtualMemory
NtWriteVirtualMemory
NtReadVirtualMemory
NtOpenFile
动态生成
包含待生成的系统调用的委托。
依赖 SharpASM
使用 ASM 获取 PEB 地址的辅助类。
包含在 C# 中动态调用 ASM 的代码。
函数 public static IntPtr callASM(byte[] stub) 可用于通过传递字节数组来调用 shellcode。
动态生成 - 脚本生成随机种子来对系统调用名称进行哈希处理
包含使用 ElephantSe4l 的技术检索系统调用编号的代码(代码移植自 SysWhispers2)。
依赖 SharpASM
包含使用 ASM 动态执行系统调用的代码。
还包含系统调用的包装器(例如 Syscall.NtAllocateVirtualMemory)(动态生成)
动态生成
SharpWhispers 的输出文件可以直接用于 C# 项目。所需的数据类型是 DInvoke 项目 中定义的数据类型的一个子集(部分数据类型实际上借自 Rastamouse 的精简项目),以减小检测面。这些数据类型定义在 SharpWhisper.Data 命名空间中,以避免与 DInvoke 的定义重叠。
注意: 仅在需要时(即某系统调用需要某个数据类型时)生成这些数据类型,以尽可能减小检测面。
以下模板用于生成所需的数据类型: