Skip to content

Repository files navigation

ReflectiveDLLInjection

Stephen Fewer created the original ReflectiveDLLInjection. I decided to learn how to do it myself, with a cleaner codebase and added features.

shellcode RDI

I rewrote the sRDI project, but did not push it. The same goes for pe_to_shellcode. These projects are not that different from Stephen Fewer's one.

Some interesting facts stem from the way the executable code is extracted. The former makes use of a function link order while the latter make use of the masm_shc utility for producing shellcode.

Schemas

Here are some schemas to understand PE parsing (there may be some errors).

[!] Images should be viewed in light mode.

getDllAddr

The getDllAddr function retrieves a process-loaded DLL based on the PEB.

alt text

getFunctionFromDll

The getFunctionFromDll function parses the Export Address Table (EAT) to retrieve a function from a DLL.

alt text

copyHeaders

The copyHeaders function copies the headers from the unloaded DLL to a previously allocated virtual memory region.

alt text

copySections

The copySections function copies the sections from the unloaded DLL to a previously allocated virtual memory region.

alt text

initializeIAT

The initializeIAT function parses the Import Address Table (IAT) to update function pointer addresses.

alt text

performRelocations

The performRelocations function resolves relocations.

alt text

Improvements

A non-exhaustive list:

  • Use HRESULT for cleaner error handling.
  • Manage Delay Load Imports (not that important I think).
  • Manage the Exception Table the way Rhadamanthys does.
  • ...

Evasion

There are no evasion features in this code.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages