Skip to content

Commit 8732bf4

Browse files
committed
Add some info on the PoC to the README
1 parent b7c73ba commit 8732bf4

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ of the unloaded target module.
99

1010
## Usage
1111

12+
1. The build environment is Visual Studio 2017.
1213
1. Add `ReflectiveUnloader.c \ ReflectiveUnloader.h` to the desired project.
1314
Once added, call `ReflectiveUnloader()` with a handle to the module to unload
1415
and reconstruct.
@@ -28,8 +29,8 @@ original contents to the writable sections.
2829

2930
If the `.restore` section is not present, the unloader will simply skip this
3031
step. This allows the unloader to perform the same task for arbitrary unpatched
31-
PE files, however **any modifications to segments made at runtime will be present
32-
in the unloaded PE file**.
32+
PE files, however **any modifications to segments made at runtime will be
33+
present in the unloaded PE file**.
3334

3435
#### Visual Studio Build Event
3536
The `pe_patch.py` script can be executed automatically for every build using a
@@ -78,6 +79,22 @@ VOID ReflectiveUnloaderFree(
7879
*dwSize* \[in\]
7980
> Size of the blob returned by ReflectiveUnloader
8081
82+
## Proof of Concept
83+
The proof of concept included in the project is the `Main.c` file. This can be
84+
compiled into a `ReflectiveUnloader.dll` which is compartible with
85+
[Reflective DLL Injection][1]. The resulting executable can then be injected
86+
into an arbitrary process (assuming premissions and architecture constraints are
87+
met) with the [inject.exe][4] utility. Take note of the hash of the DLL file
88+
before proceeding. See the [releases page][5] for pre-built binaries.
89+
90+
Once the DLL is injected into a process, it will display a message box. This is
91+
used to present the user with an opportunity to delete the original DLL from
92+
disk. After the message box is closed, a new and identical copy will be written
93+
to `%USERPROFILE%\\Desktop\\ReflectiveUnloader.dll`.
94+
95+
Finally the user can compare the hashes of the two files to determine that they
96+
are identical.
97+
8198
## License
8299
This project is released under the BSD 3-clause license, for more details see
83100
the [LICENSE][license-url] file.
@@ -90,4 +107,6 @@ the [LICENSE][license-url] file.
90107
[1]: https://github.com/stephenfewer/ReflectiveDLLInjection
91108
[2]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199(v=vs.85).aspx
92109
[3]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx
110+
[4]: https://github.com/stephenfewer/ReflectiveDLLInjection/tree/master/bin
111+
[5]: https://github.com/zeroSteiner/reflective-unloader/releases
93112
[license-url]: https://github.com/zeroSteiner/reflective-unloader/blob/master/LICENSE

ReflectiveUnloader/Main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ VOID ProofOfConcept(HINSTANCE hInstance) {
3333
return;
3434
}
3535

36-
dwChars = ExpandEnvironmentStrings(_T("%USERPROFILE%\\Desktop\\unloaded.dll"), ctPath, MAX_PATH + 1);
36+
#ifdef _WIN64
37+
dwChars = ExpandEnvironmentStrings(_T("%USERPROFILE%\\Desktop\\ReflectiveUnloader.x64.dll"), ctPath, MAX_PATH + 1);
38+
#else
39+
#ifdef _WIN32
40+
dwChars = ExpandEnvironmentStrings(_T("%USERPROFILE%\\Desktop\\ReflectiveUnloader.x86.dll"), ctPath, MAX_PATH + 1);
41+
#endif
42+
#endif
3743
if ((dwChars == 0) || (dwChars > MAX_PATH + 1)) {
3844
MessageBox(NULL, _T("Could not get the file path for writing."), _T("Failed"), MB_OK);
3945
return;

0 commit comments

Comments
 (0)