Session Passing
Cobalt Strike’s Beacon started out as a stable lifeline to keep access to a compromised host. From day one, Beacon’s primary purpose was to pass accesses to other Cobalt Strike listeners.
Use the spawn command to spawn a session for a listener. The spawn command accepts an architecture (e.g., x86, x64) and a listener as its arguments.
By default, the spawn command will spawn a session in rundll32.exe. An alert administrator may find it strange that rundll32.exe is periodically making connections to the internet. Find a better program (e.g., Internet Explorer) and use the spawnto command to state which program Beacon should spawn for its sessions.
The spawnto command requires you to specify an architecture (x86 or x64) and a full path to a program to spawn, as needed. Type spawnto by itself and press enter to instruct Beacon to go back to its default behavior.
Type inject followed by a process id and a listener name to inject a session into a specific process. Use ps to get a list of processes on the current system. Use inject [pid] x64 to inject a 64-bit Beacon into an x64 process.
The spawn and inject commands both inject a payload stage into memory. If the payload stage is an HTTP, HTTPS, or DNS Beacon and it can’t reach you—you will not see a session. If the payload stage is a bind TCP or SMB Beacon, these commands will automatically try to link to and assume control of these payloads.
Use dllinject [pid] to inject a Reflective DLL into a process.
Use the shinject [pid] [architecture] [/path/to/file.bin] command to inject shellcode, from a local file, into a process on target. Use shspawn [architecture] [/path/to/file.bin] to spawn the “spawn to” process and inject the specified shellcode file into that process.
Use dllload [pid] [c:\path\to\file.dll] to load an on-disk DLL in another process.