Dynamic-Link Library Injection

Adversaries may inject dynamic-link libraries (DLLs) into processes in order to evade process-based defenses as well as possibly elevate privileges. DLL injection is a method of executing arbitrary code in the address space of a separate live process.
DLL injection is commonly performed by writing the path to a DLL in the virtual address space of the target process before loading the DLL by invoking a new thread. The write can be performed with native Windows API calls such as VirtualAllocEx and WriteProcessMemory, then invoked with CreateRemoteThread (which calls the LaodLibrary API responsible for loading the DLL).
Variations of this method such as reflective DLL injection (writing a self-mapping DLL into a process) and memory module (map DLL when writing into process) overcome the address relocation issue as well as the additional APIs to invoke execution (since these methods load and execute the files in memory by manually performing the function of LoadLibrary).
Running code in the context of another process may allow access to the process's memory, system/network resources, and possibly elevated privileges. Execution via DLL injection may also evade detection from security products since the execution is masked under a legitimate process.
Example:
From the tool InjectAllTheThings we are capable of injecting DLL files into processes and hide our actions as long is within reason of a process communicating with the internet. We have 7 different methods here:
I won't explain this as this is way beyond beginner level but in simple terms it uses those API calls to inject DLLs into legitimate processes to hide its intentions.
Will choose option 1 and fill the needed parameters.
I will take a look using Process Explorer and see what happened.
We see above that rundll32.exe is now a child process of notepad.exe And it is using a Network connection with the port 4444
Check the TaskManager
A bunch of Subprocesses running under Notepad, and even when closing these we still have notepad running in the background and stays available for us still to see in the Process Explorer Application.
A great technique for evading since we are hiding under the legitimacy of another process and maybe even escalating privileges.