Hinweis: Dies ist ein Arbeitsprototyp. Behandeln Sie ihn bitte als solche. Pull -Anfragen sind willkommen! Sie können Ihre Füße mit guten ersten Problemen nass machen
Eine benutzerfreundliche Bibliothek zum Nachahmung von Code in Minidump-Dateien. Hier sind einige Links zu Posts/Videos mit Dumpulator:
Senden Sie eine Pull -Anfrage, um Ihren Artikel hier hinzuzufügen!
Das folgende Beispiel öffnet StringEncryptionFun_x64.dmp (hier herunterladen), verteilt einen Speicher und ruft die Entschlüsselungsfunktion unter 0x140001000 auf, um die Zeichenfolge unter 0x140017000 zu entschlüsseln:
from dumpulator import Dumpulator
dp = Dumpulator ( "StringEncryptionFun_x64.dmp" )
temp_addr = dp . allocate ( 256 )
dp . call ( 0x140001000 , [ temp_addr , 0x140017000 ])
decrypted = dp . read_str ( temp_addr )
print ( f"decrypted: ' { decrypted } '" ) Die StringEncryptionFun_x64.dmp wird am Einstiegspunkt des Beispiels für tests/StringEncryptionFun gesammelt. Sie können die kompilierten Binärdateien für StringEncryptionFun hier erhalten
from dumpulator import Dumpulator
dp = Dumpulator ( "StringEncryptionFun_x64.dmp" , trace = True )
dp . start ( dp . regs . rip ) Dadurch wird StringEncryptionFun_x64.dmp.trace mit einer Liste der ausgeführten Anweisungen und einigen hilfreichen Anzeichen beim Schalten von Modulen usw. erstellt
from dumpulator import Dumpulator
dp = Dumpulator ( "my.dmp" )
buf = dp . call ( 0x140001000 )
dp . read_str ( buf , encoding = 'utf-16' )Sagen Sie, Sie haben die folgende Funktion:
00007FFFC81C06C0 | mov qword ptr [rsp+0x10],rbx ; prolog_start
00007FFFC81C06C5 | mov qword ptr [rsp+0x18],rsi
00007FFFC81C06CA | push rbp
00007FFFC81C06CB | push rdi
00007FFFC81C06CC | push r14
00007FFFC81C06CE | lea rbp,qword ptr [rsp-0x100]
00007FFFC81C06D6 | sub rsp,0x200 ; prolog_end
00007FFFC81C06DD | mov rax,qword ptr [0x7FFFC8272510]
Sie möchten nur den Prolog ausführen und einige Register einrichten:
from dumpulator import Dumpulator
prolog_start = 0x00007FFFC81C06C0
# we want to stop the instruction after the prolog
prolog_end = 0x00007FFFC81C06D6 + 7
dp = Dumpulator ( "my.dmp" , quiet = True )
dp . regs . rcx = 0x1337
dp . start ( begin = prolog_start , end = prolog_end )
print ( f"rsp: { hex ( dp . regs . rsp ) } " ) Das quiet Flag unterdrückt die Protokolle über geladene DLLs und Speicherregionen ein (zur Verwendung in Skripten, in denen Sie das Protokollspam reduzieren möchten).
Sie können (neu) Syscalls mit dem @syscall -Dekorator implementieren:
from dumpulator import *
from dumpulator . native import *
from dumpulator . handles import *
from dumpulator . memory import *
@ syscall
def ZwQueryVolumeInformationFile ( dp : Dumpulator ,
FileHandle : HANDLE ,
IoStatusBlock : P [ IO_STATUS_BLOCK ],
FsInformation : PVOID ,
Length : ULONG ,
FsInformationClass : FSINFOCLASS
):
return STATUS_NOT_IMPLEMENTEDAlle SYSCall -Funktionsprototypen finden Sie in NTSYScalls.py. Es gibt auch viele Beispiele zur Verwendung der API.
So können Sie Folgendes durchführen:
import dumpulator . ntsyscalls as ntsyscalls
@ syscall
def ZwOpenProcess ( dp : Dumpulator ,
ProcessHandle : Annotated [ P [ HANDLE ], SAL ( "_Out_" )],
DesiredAccess : Annotated [ ACCESS_MASK , SAL ( "_In_" )],
ObjectAttributes : Annotated [ P [ OBJECT_ATTRIBUTES ], SAL ( "_In_" )],
ClientId : Annotated [ P [ CLIENT_ID ], SAL ( "_In_opt_" )]
):
process_id = ClientId . read_ptr ()
assert process_id == dp . parent_process_id
ProcessHandle . write_ptr ( 0x1337 )
return STATUS_SUCCESS
@ syscall
def ZwQueryInformationProcess ( dp : Dumpulator ,
ProcessHandle : Annotated [ HANDLE , SAL ( "_In_" )],
ProcessInformationClass : Annotated [ PROCESSINFOCLASS , SAL ( "_In_" )],
ProcessInformation : Annotated [ PVOID , SAL ( "_Out_writes_bytes_(ProcessInformationLength)" )],
ProcessInformationLength : Annotated [ ULONG , SAL ( "_In_" )],
ReturnLength : Annotated [ P [ ULONG ], SAL ( "_Out_opt_" )]
):
if ProcessInformationClass == PROCESSINFOCLASS . ProcessImageFileNameWin32 :
if ProcessHandle == dp . NtCurrentProcess ():
main_module = dp . modules [ dp . modules . main ]
image_path = main_module . path
elif ProcessHandle == 0x1337 :
image_path = R"C:Windowsexplorer.exe"
else :
raise NotImplementedError ()
buffer = UNICODE_STRING . create_buffer ( image_path , ProcessInformation )
assert ProcessInformationLength >= len ( buffer )
if ReturnLength . ptr :
dp . write_ulong ( ReturnLength . ptr , len ( buffer ))
ProcessInformation . write ( buffer )
return STATUS_SUCCESS
return ntsyscalls . ZwQueryInformationProcess ( dp ,
ProcessHandle ,
ProcessInformationClass ,
ProcessInformation ,
ProcessInformationLength ,
ReturnLength
) Da v0.2.0 es gibt, wird es unterstützt, Ihre eigenen Strukturen leicht zu deklarieren:
from dumpulator . native import *
class PROCESS_BASIC_INFORMATION ( Struct ):
ExitStatus : ULONG
PebBaseAddress : PVOID
AffinityMask : KAFFINITY
BasePriority : KPRIORITY
UniqueProcessId : ULONG_PTR
InheritedFromUniqueProcessId : ULONG_PTR Um diese Strukturen zu instanziieren, müssen Sie eine Dumpulator -Instanz verwenden:
pbi = PROCESS_BASIC_INFORMATION ( dp )
assert ProcessInformationLength == Struct . sizeof ( pbi )
pbi . ExitStatus = 259 # STILL_ACTIVE
pbi . PebBaseAddress = dp . peb
pbi . AffinityMask = 0xFFFF
pbi . BasePriority = 8
pbi . UniqueProcessId = dp . process_id
pbi . InheritedFromUniqueProcessId = dp . parent_process_id
ProcessInformation . write ( bytes ( pbi ))
if ReturnLength . ptr :
dp . write_ulong ( ReturnLength . ptr , Struct . sizeof ( pbi ))
return STATUS_SUCCESS Wenn Sie einen Zeigerwert als zweites Argument übergeben, wird die Struktur aus dem Speicher gelesen. Sie können Zeiger mit myptr: P[MY_STRUCT] deklarieren und sie mit myptr[0] Derferen ergeben.
Es gibt ein einfaches X64DBG -Plugin namens Minidumpplugin Der Befehl minidump wurde seit 2022-10-10 in X64DBG integriert. Um eine Müllkippe zu erstellen, pausieren Sie die Ausführung und führen Sie den Befehl MiniDump my.dmp aus.
Von PYPI (neueste Veröffentlichung):
python -m pip install dumpulator
Aus Quelle installieren:
python setup.py install
Installieren Sie für eine Entwicklungsumgebung:
python setup.py develop
Was den Dumpulator von Sandboxen wie Speakeasy und Qiling unterscheidet, ist, dass der vollständige Prozessspeicher verfügbar ist. Dies verbessert die Leistung, da Sie große Teile der Malware nachahmen können, ohne das Einhorn jemals zu verlassen. Darüber hinaus müssen nur Systeme emuliert werden, um eine realistische Windows -Umgebung zu bieten (da alles tatsächlich eine legitime Prozessumgebung ist ).