7. fill with 'nop' and the payload for the
bind shell.
The payload for the shell
Puts the payload in multiple places
with a 'nop slide' between to hope
that the execution flow at one point
will land on the injected payload
8. Invoke the util.printf() function with a
large 'num' value to overflow and
then control of code will eventually
be passed to the payload injected on
the heap so it executes
12. Condition 1: We have code execution in host process. Reflective DLL Injection works as follows:
1. Execution is passed, either via CreateRemoteThread() or a tiny bootstrap shellcode, to the library's
ReflectiveLoader function which is an exported function found in the library's export table.
2. As the library's image will currently exists in an arbitrary location in memory the ReflectiveLoader will first calculate
its own image's current location in memory so as to be able to parse its own headers for use later on.
3. The ReflectiveLoader will then parse the host processes kernel32.dll export table in order to calculate the
addresses of three functions required by the loader, namely LoadLibraryA, GetProcAddress and VirtualAlloc.
4. The ReflectiveLoader will now allocate a continuous region of memory into which it will proceed to load its own
image. The location is not important as the loader will correctly relocate the image later on.
5. The library's headers and sections are loaded into their new locations in memory.
6. The ReflectiveLoader will then process the newly loaded copy of its image's import table, loading any additional
library's and resolving their respective imported function addresses.
7. The ReflectiveLoader will then process the newly loaded copy of its image's relocation table.
8. The ReflectiveLoader will then call its newly loaded image's entry point function, DllMain with
DLL_PROCESS_ATTACH. The library has now been successfully loaded into memory.
9. Finally the ReflectiveLoader will return execution to the initial bootstrap shellcode which called it, or if it was called
via CreateRemoteThread, the thread will terminate.