Nytro Posted September 8, 2010 Report Posted September 8, 2010 dwtf v1.0 and its Featuresdwtf creates a fake.dll from real.dllFeatures:1- It exports all symbols of real.dll (also Forwarder).2- It imports all exports of real.dll (also Forwarder).3- It creates an area code with a JMP DWORD [ADDRESS] for each export.4- The exports of fake dll is assigned to a JMP area which jumps to original export of real.dll.Working of dwtf v1.0If you are making PEB HOOKING, when the APP calls to fake dll export it jumps to original export, everything works fine:Before PEB HOOKING:APP -> IAT OF APP -> REAL DLL EXPORTAfter PEB HOOKING:APP -> IAT OF APP -> FAKE DLL EXPORT -> IAT OF FAKE DLL -> REAL DLL EXPORTYou can add or remove payloads with any IAT HOOKING in the IAT of the fake dll:APP -> IAT OF APP -> FAKE DLL EXPORT -> IAT OF FAKE DLL -> PAYLOAD STACK -> (or never) REAL DLL EXPORTSyntax: dwtf.exe fake_dll real_dllExample: dwtf.exe k32.dll c:\windows\system32\kernel32.dllAll .exes are in bin folder:You can execute the: Generate fake kernel32.batThis bat executes dwtf creating a fake kernel32.dll called k32.dll from c:\windows\system32\kernel32.dllAfter, you can make a pebhooking executing: PEB hooking poc with fake kernel32.batIMPORTANT: You need the NETCAT for send commands to the console:This bat inject a console.dll in the poc.exe process using InjectorDll.exeThis console listen by default in 127.0.0.1 1234, This console is the interface to doPEB Hooking:Next, the bat connect to 127.0.0.1 1234 using nc command (netcat)In the console with netcat you can write:pebhook kernel32.dll k32.dllresumeexitIn this moment poc.exe is running and it is waiting a user enter:poc.exe try creates files with two APIs of kernel32.dll: CreateFileW and CreateFileAWhen you press enter all works fine (good lucky) and the process exits creating files.In this scenario all works by this way:poc.exe -> IAT of POC.EXE -> k32.dll (fake kernel32.dll) -> IAT of k32.dll -> kernel32.dllLoading payloads dynamically:For this scenario:poc.exe -> IAT of POC.EXE -> k32.dll (fake kernel32.dll) -> IAT of k32.dll -> payload/sRemember: You can add a payload stack with IAT HOOKING over IAT HOOKING ...The payloads can calls to original kernel32.dll export.You need:Generate fake kernel32.batPEB hooking poc with fake kernel32.batcommand: pebhook kernel32.dll k32.dllAdd a payload for CreateFileW, inserting a iat hook in k32.dll:Inject the dll:InjectorDll.exe poc_dll.dll -p PID_OF_POC_EXEIn the POC.EXE you can see:Creating files... press enterDLL INJECTED! ADDR OF OwnCreateFileA: 0x70651030 < --- For EXAMPLEIt is the time of IAT hooking of CreateFileA of k32.dll to OwnCreateFileA of poc_dll.dllExample of searching CreateFileA IAT ADDR in k32:Using peview (google: download peview):Search the oridinal of CreateFileA like this image:Search IAT ADDR in k32 of CreateFileA like this image:In the IMAGE the IAT ADDR is: 0x1000C1A6Change the IAT to payload addr:write_process_memory.exe PID_OF_POC_EXE 0x1000C1A6 0x706510300x70651030 is the addr of OwnCreateFileA of poc_dll.dll injected in POC.exeIn the console with netcat you can write:resumeexitCreditsdwtf 1.0 (MIT License) engine by Dreg, from evil fingers:- making FULL dll (PEB/file) hooking more easy...- Greetz: Lacon 2k9 Spain & Hispasec team.- Note: Use with real DLLs, a lot of bugs in this versioncontact me: dreg@fr33project.orgVideo:http://www.youtube.com/watch?v=t7UXEJieliMDownload:http://rootkitanalytics.com/downloadCounter.php?id=7 Quote