Skip to main content
Artifacts Generated: Process Inject

Summary

High-level wrapper for injecting Apollo agent shellcode into remote processes. Automatically handles payload selection, generation, and injection orchestration through the shinject command. Supports both egress and peer-to-peer (P2P) payloads with automatic callback linking for P2P communications.
  • Needs Admin: False (depends on target process and injection technique)
  • Version: 2
  • Author: @djhohnstein

Arguments

  • pid (Number, Required) - Target process ID for injection
  • template (Choice, Required) - Apollo payload template to inject
  • regenerate (Boolean, Optional) - Generate new payload instance (default: false)

Usage

args Output:

Detailed Summary

Agent Execution Flow

1. Payload Discovery and Selection

  • Queries Mythic for available Apollo shellcode payloads
  • Filters payloads to only include shellcode format (“Raw” output type)
  • Excludes auto-generated payloads to show only operator-created templates
  • Presents payloads in format: “filename - description”

2. Parameter Processing and Validation

  • Requires JSON parameter format (no raw command line)
  • Validates PID is provided and non-zero
  • Supports alternative “process_id” parameter name for compatibility
  • Performs early validation before payload processing

3. Payload Resolution and Retrieval

  • Parses template selection into filename and description components
  • Searches for exact payload match using filename and description
  • Ensures payload is Apollo type with shellcode output format
  • Validates payload exists and is accessible

4. Payload Generation and Build Management

  • Supports generating new payload instances from templates
  • Creates descriptive payload names including operator and target PID
  • Implements polling mechanism for build completion
  • Handles build failures with appropriate error messages

5. C2 Profile Detection and P2P Handling

  • Detects C2 profile type to determine injection strategy
  • Handles egress payloads (HTTP/HTTPS) with simple injection
  • Manages P2P payloads (SMB/TCP) with connection linking
  • Prepares connection information for automatic callback linking

6. Subtask Orchestration and Delegation

  • Creates subtask for actual shellcode injection
  • Delegates to shinject command for low-level injection
  • Passes resolved payload file ID and target PID
  • Maintains parent-child task relationship

7. P2P Callback Completion Handling

  • Handles completion of injection subtask
  • Copies all responses from subtask to parent task
  • Automatically creates link subtask for P2P payloads
  • Manages connection information for callback linking
  • Handles completion of link subtask for P2P connections
  • Aggregates all responses from both injection and linking
  • Provides complete operation status to operator

Payload Types and Compatibility

Supported Payload Formats

  • Shellcode Format: Must be position-independent shellcode
  • Architecture: x64 or x86 (must match target process)
  • Payload Type: Apollo agent payloads only
  • Output Type: “Raw” format in Mythic payload builder

C2 Profile Support

Payload Template Management

Advanced Features and Automation

Process Browser Integration

Automated Payload Generation

Callback Linking Automation

Error Handling and Recovery

Payload Build Failure Handling

Recovery Strategies

Security Considerations

Payload Tracking and Management

Operational Security Features

Performance and Resource Management

Payload Caching and Optimization

Resource Usage Monitoring

APIs Used

MITRE ATT&CK Mapping

  • T1055 - Process Injection
  • T1055.001 - Process Injection: Dynamic-link Library Injection
  • T1055.002 - Process Injection: Portable Executable Injection
  • T1129 - Shared Modules
  • T1071 - Application Layer Protocol (for egress payloads)
  • T1090 - Proxy (for P2P payloads)

Security Considerations

  • Payload Management: Centralized payload tracking and generation
  • Operational Security: Automated unique payload generation per injection
  • Callback Linking: Automatic P2P callback establishment
  • Audit Trail: Complete logging of payload usage and injection targets
  • Technique Flexibility: Leverages configurable injection techniques
  • Error Handling: Comprehensive error reporting and recovery
  • Resource Management: Efficient payload caching and resource usage

Limitations

  1. Payload Format: Only supports shellcode format payloads
  2. Apollo Specific: Limited to Apollo agent payloads
  3. Architecture Matching: Payload must match target process architecture
  4. C2 Profile Dependencies: P2P payloads require additional linking steps
  5. Build Dependencies: Requires functioning Mythic payload builder
  6. Network Connectivity: Depends on reliable Mythic communication
  7. Process Permissions: Subject to target process access restrictions

Error Conditions

  • No Payloads Available: No matching Apollo shellcode payloads found
  • Payload Build Failed: Template payload failed to build
  • Build Timeout: Payload build took too long to complete
  • Injection Failed: Underlying shinject command failed
  • Link Failed: P2P callback linking failed (P2P payloads only)
  • Permission Denied: Insufficient access to target process
  • Invalid Template: Selected template is not shellcode format
  • Network Error: Communication with Mythic failed

Best Practices

  1. Template Management: Maintain variety of payload templates for different scenarios
  2. Payload Regeneration: Use regenerate option for unique payloads per target
  3. Process Selection: Choose appropriate target processes for injection
  4. C2 Profile Awareness: Understand egress vs P2P payload differences
  5. Error Monitoring: Monitor subtask completion and handle failures
  6. Resource Management: Be aware of payload build and injection overhead
  7. OPSEC Considerations: Rotate payloads and techniques for stealth
  8. Testing: Validate payload templates in lab environments first