
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) は、バイト配列を渡してシェルコードを呼び出すために使用できます。
動的生成 - スクリプトはシステムコール名をハッシュするためのランダムシードを生成します
ElephantSe4l のテクニックを使用してシステムコール番号を取得するコードが含まれています(SysWhispers2 から移植されたコード)。
SharpASM に依存
ASM を使用してシステムコールを動的に実行するコードが含まれています。
システムコールのラッパーも含まれています(例: Syscall.NtAllocateVirtualMemory)(動的生成)
動的生成
SharpWhispers の出力ファイルは C# プロジェクトで直接使用できます。必要なデータ型は、DInvoke プロジェクト で定義されているデータ型のサブセットです(一部のデータ型は、実際には Rastamouse の最小化プロジェクト から借用されています)。これは検出面を減らすためです。データ型は、DInvoke の定義と重複しないように、SharpWhisper.Data 名前空間で定義されています。
注: データ型は、検出面を最小化するために、必要な場合にのみ生成されます(つまり、システムコールがデータ型を必要とする場合)。
必要なデータ型を生成するために、次のテンプレートが使用されます: