Several techniques exists to execute custom payloads in environments where you gained first access.

Local vs Remote

Local techniques means executing payload in the process, thread or program actually in execution. You make a program do what you want. Remote techniques means injectiong custom code in a remote process, e.g. a process running in the background.

Local Payload Execution

Remote Payload Execution