Mythic Implant Development Skill
When to Use
Use this skill when developing a new agent (implant/payload) for the Mythic C2 framework. This includes:
- "Build a new Mythic agent in Go/Rust/C/C#/Python"
- "Create a Mythic implant that supports HTTP C2"
- "Port this agent to work with Mythic"
- "Add a new command to my Mythic payload type"
When NOT to Use
Do not use this skill for:
- General Mythic server administration or installation
- Developing standalone tools unrelated to Mythic
- Working with other C2 frameworks (Cobalt Strike, Sliver, etc.)
Initial Requirements Gathering
CRITICAL: Before writing any code, you MUST ask the user the following clarification questions. Do not assume defaults. Each answer significantly impacts the architecture.
C2 Channel: What communication channel should the agent use?
- Egress: HTTP, HTTPS, DNS, WebSocket, custom
- P2P: TCP, SMB named pipes, custom
- Multiple channels in a single agent?
Target Platforms: What operating systems will the agent support?
- Windows, macOS, Linux, or a combination
- Architecture: x64, ARM64, both
Agent Language: What language or framework should the agent be written in?
- Go, C, C++, C#/.NET, Rust, Python, Nim, etc.
- This is the language of the agent itself (runs on target)
- The Mythic container definitions (server-side) can be in Python or GoLang independently of the agent language
Commands: What commands should the agent support initially?
- Common starting set: shell execution, file upload/download, process listing, directory listing, change directory, exit
- Any specialized capabilities needed?
Encryption: What key exchange / encryption model?
- Plaintext (testing only)
- Static AES256 pre-shared key
- RSA encrypted key exchange (recommended for production)
- Custom EKE via translation container
Mythic Container Language: Should the server-side definitions (commands, build logic) be written in Python or GoLang?
OPSEC Requirements
OPSEC is the highest priority throughout all development. Every piece of code produced must adhere to the following:
Mandatory OPSEC Rules
No hardcoded attributable strings - Never embed tool names, author names, framework identifiers, or any string that would allow attribution to the agent, its developer, or the C2 framework. This includes:
- User-Agent strings that identify the framework
- Mutex names containing tool/framework names
- Registry key names or values containing identifiable strings
- Named pipe names with identifiable prefixes
- Window class names or window titles
No embedded debug messages - Never include debug print statements, logging calls, or verbose error messages in production agent code. Debug output must be:
- Gated behind a compile-time flag that is OFF by default
- Completely stripped from release builds
- Never contain function names, file paths, or developer-identifiable information
String handling - All strings that could be signatured should be:
- Constructed at runtime where possible
- Obfuscated or encrypted at rest in the binary
- Never stored as plaintext string literals in the final binary
Network indicators - Minimize network-level signatures:
- Randomize or make configurable: callback intervals, jitter, URI paths, headers
- Do not use default or well-known URI patterns
- Support configurable HTTP headers and request formatting
Build artifacts - Ensure clean builds:
- Strip debug symbols in release builds
- Remove or obfuscate Go build paths (if using Go)
- Avoid leaving compiler metadata that reveals the build environment
Mythic OPSEC hooks - Implement opsec_pre and opsec_post checks on commands that create detectable artifacts (process creation, file writes, network connections). See OPSEC Checking.
When Generating Code
- Always ask: "Would this string/pattern be signaturable?"
- Always ask: "Does this leave unnecessary artifacts?"
- If a user requests something that conflicts with OPSEC (e.g., hardcoded debug output), warn them explicitly and suggest the OPSEC-safe alternative.
Development Workflow
Follow these steps in order. Each step references documentation pages that should be loaded for detailed specifications.
Step 1: Project Layout
Create the Mythic-compatible project structure. This is critical - Mythic expects a specific folder layout for the container to sync properly.
Read: Project Layout
Key deliverables:
Dockerfile using appropriate Mythic base image
main.py or main.go entry point for the Mythic container
- Agent source code directory
- Proper folder naming (lowercase, no capitals - Docker limitation)
The project should follow the External Agent template format:
your-agent/
Payload_Type/
your_agent_name/
Dockerfile
main.py (or main.go + Makefile)
your_agent_name/
mythic/
agent_functions/
builder.py (or agentfunctions/*.go)
command1.py
command2.py
...
agent_code/
<your agent source code in whatever language>
Step 2: Build Dependencies
Set up the build environment within the Docker container.
CRITICAL: The build() function runs INSIDE the container. Docker is NOT available inside the container. All compilers and tools your agent needs must be installed in the Dockerfile. You cannot use docker build, docker run, or any Docker-in-Docker commands from the build function.
Select the appropriate Mythic base image for your container language:
itsafeaturemythic/mythic_python_base:latest - Python definitions
itsafeaturemythic/mythic_go_base:latest - Go definitions
itsafeaturemythic/mythic_python_go:latest - Python definitions + Go compiler
itsafeaturemythic/mythic_go_macos:latest - Go definitions + macOS SDK
itsafeaturemythic/mythic_python_macos:latest - Python definitions + macOS SDK
itsafeaturemythic/mythic_go_dotnet:latest - Go definitions + .NET SDK
Install any additional build tools in the Dockerfile via RUN commands (Rust toolchain, cross-compilers, MinGW, etc.)
For Go-based containers, create a Makefile with build and run targets
The agent code is compiled inside this container when the build() function calls compilers/tools via subprocess (Python) or os/exec (Go)
Step 3: Agent-to-Mythic Communication
This is the core of the agent. Implement the message protocol in the agent's language.
Read these references in order:
- Agent Message Format - The base wire format:
Base64(UUID + EncBlob(JSON))
- Initial Checkin - How the agent registers with Mythic
- Get Tasking - How the agent requests tasks
- Post Response - How the agent returns task output
- File Downloads - Agent -> Mythic file transfer
- File Uploads - Mythic -> Agent file transfer
Implementation order within the agent:
- Message encoding/decoding - Base64, JSON serialization, UUID handling
- Encryption layer - AES256-CBC with PKCS7 padding, HMAC-SHA256 (if using encrypted comms). Format:
IV (16 bytes) + Ciphertext + HMAC
- HTTP/transport layer - The actual network communication matching the C2 profile
- Checkin - First contact with Mythic, exchange payload UUID for callback UUID
- Key exchange - If using RSA EKE: generate 4096-bit RSA keypair, send public key, receive AES session key
- Task loop -
get_tasking on interval, process commands, post_response with results
- File transfer - Chunked upload/download protocol with file UUID tracking
Step 4: Commands and Features
Add the commands the user requested. Each command has two parts:
- Agent-side: The code in the agent that executes the command
- Mythic-side: The Python/Go definition that tells Mythic about the command
Read: Commands and Create Tasking
For each command:
- Define
CommandBase / command struct with metadata (name, description, MITRE ATT&CK mapping, help text)
- Define
TaskArguments / argument struct with parameters
- Implement
create_go_tasking for any server-side preprocessing
- Implement the agent-side execution logic
- Add
opsec_pre/opsec_post checks where the command creates detectable artifacts
For additional features, consult:
Step 5: Mythic-Side Python/Go Scripts
Create the server-side container code that defines the agent to Mythic.
Read: Payload Type Definition
Key deliverables:
- Payload Type class - Name, supported OS, C2 profiles, build parameters, file extension
- Python field names:
name, supported_os, c2_profiles (NOT supported_c2_profiles), build_parameters, mythic_encrypts
- Go struct fields:
Name, SupportedOS, SupportedC2Profiles, BuildParameters, MythicEncryptsData
- Build function - Takes user-selected options and compiles/assembles the agent binary
- Runs INSIDE the container - only tools installed in the Dockerfile are available
- Read C2 profile parameters and stamp them into agent config
- Call compilers via
subprocess (Python) or os/exec (Go)
- Handle command selection (if
supports_dynamic_loading)
- Return
BuildResponse with the final payload bytes
- Command definitions - One file per command with
CommandBase and TaskArguments
- Build steps - Define progress indicators for the build process
See also:
Reference Index
For detailed documentation on each topic, consult the following pages. Load only the pages you need to conserve context.
Full index: Reference Index
Quick Reference
1---2name: mythic-implant-development3description: Provides guidance and documentation for building Mythic C2 framework agents/implants from scratch4license: MIT5---67# Mythic Implant Development Skill89## When to Use1011Use this skill when developing a new agent (implant/payload) for the Mythic C2 framework. This includes:1213- "Build a new Mythic agent in Go/Rust/C/C#/Python"14- "Create a Mythic implant that supports HTTP C2"15- "Port this agent to work with Mythic"16- "Add a new command to my Mythic payload type"1718## When NOT to Use1920Do not use this skill for:2122- General Mythic server administration or installation23- Developing standalone tools unrelated to Mythic24- Working with other C2 frameworks (Cobalt Strike, Sliver, etc.)2526## Initial Requirements Gathering2728**CRITICAL**: Before writing any code, you MUST ask the user the following clarification questions. Do not assume defaults. Each answer significantly impacts the architecture.29301. **C2 Channel**: What communication channel should the agent use?31 - Egress: HTTP, HTTPS, DNS, WebSocket, custom32 - P2P: TCP, SMB named pipes, custom33 - Multiple channels in a single agent?34352. **Target Platforms**: What operating systems will the agent support?36 - Windows, macOS, Linux, or a combination37 - Architecture: x64, ARM64, both38393. **Agent Language**: What language or framework should the agent be written in?40 - Go, C, C++, C#/.NET, Rust, Python, Nim, etc.41 - This is the language of the agent itself (runs on target)42 - The Mythic container definitions (server-side) can be in Python or GoLang independently of the agent language43444. **Commands**: What commands should the agent support initially?45 - Common starting set: shell execution, file upload/download, process listing, directory listing, change directory, exit46 - Any specialized capabilities needed?47485. **Encryption**: What key exchange / encryption model?49 - Plaintext (testing only)50 - Static AES256 pre-shared key51 - RSA encrypted key exchange (recommended for production)52 - Custom EKE via translation container53546. **Mythic Container Language**: Should the server-side definitions (commands, build logic) be written in Python or GoLang?5556## OPSEC Requirements5758**OPSEC is the highest priority throughout all development.** Every piece of code produced must adhere to the following:5960### Mandatory OPSEC Rules61621. **No hardcoded attributable strings** - Never embed tool names, author names, framework identifiers, or any string that would allow attribution to the agent, its developer, or the C2 framework. This includes:63 - User-Agent strings that identify the framework64 - Mutex names containing tool/framework names65 - Registry key names or values containing identifiable strings66 - Named pipe names with identifiable prefixes67 - Window class names or window titles68692. **No embedded debug messages** - Never include debug print statements, logging calls, or verbose error messages in production agent code. Debug output must be:70 - Gated behind a compile-time flag that is OFF by default71 - Completely stripped from release builds72 - Never contain function names, file paths, or developer-identifiable information73743. **String handling** - All strings that could be signatured should be:75 - Constructed at runtime where possible76 - Obfuscated or encrypted at rest in the binary77 - Never stored as plaintext string literals in the final binary78794. **Network indicators** - Minimize network-level signatures:80 - Randomize or make configurable: callback intervals, jitter, URI paths, headers81 - Do not use default or well-known URI patterns82 - Support configurable HTTP headers and request formatting83845. **Build artifacts** - Ensure clean builds:85 - Strip debug symbols in release builds86 - Remove or obfuscate Go build paths (if using Go)87 - Avoid leaving compiler metadata that reveals the build environment88896. **Mythic OPSEC hooks** - Implement `opsec_pre` and `opsec_post` checks on commands that create detectable artifacts (process creation, file writes, network connections). See [OPSEC Checking](./references/opsec-checking.md).9091### When Generating Code9293- Always ask: "Would this string/pattern be signaturable?"94- Always ask: "Does this leave unnecessary artifacts?"95- If a user requests something that conflicts with OPSEC (e.g., hardcoded debug output), warn them explicitly and suggest the OPSEC-safe alternative.9697## Development Workflow9899Follow these steps in order. Each step references documentation pages that should be loaded for detailed specifications.100101### Step 1: Project Layout102103Create the Mythic-compatible project structure. This is critical - Mythic expects a specific folder layout for the container to sync properly.104105**Read**: [Project Layout](./references/project-layout.md)106107Key deliverables:108- `Dockerfile` using appropriate Mythic base image109- `main.py` or `main.go` entry point for the Mythic container110- Agent source code directory111- Proper folder naming (lowercase, no capitals - Docker limitation)112113The project should follow the External Agent template format:114```115your-agent/116 Payload_Type/117 your_agent_name/118 Dockerfile119 main.py (or main.go + Makefile)120 your_agent_name/121 mythic/122 agent_functions/123 builder.py (or agentfunctions/*.go)124 command1.py125 command2.py126 ...127 agent_code/128 <your agent source code in whatever language>129```130131### Step 2: Build Dependencies132133Set up the build environment within the Docker container.134135**CRITICAL**: The `build()` function runs INSIDE the container. Docker is NOT available inside the container. All compilers and tools your agent needs must be installed in the Dockerfile. You cannot use `docker build`, `docker run`, or any Docker-in-Docker commands from the build function.136137- Select the appropriate Mythic base image for your container language:138 - `itsafeaturemythic/mythic_python_base:latest` - Python definitions139 - `itsafeaturemythic/mythic_go_base:latest` - Go definitions140 - `itsafeaturemythic/mythic_python_go:latest` - Python definitions + Go compiler141 - `itsafeaturemythic/mythic_go_macos:latest` - Go definitions + macOS SDK142 - `itsafeaturemythic/mythic_python_macos:latest` - Python definitions + macOS SDK143 - `itsafeaturemythic/mythic_go_dotnet:latest` - Go definitions + .NET SDK144145- Install any additional build tools in the Dockerfile via `RUN` commands (Rust toolchain, cross-compilers, MinGW, etc.)146- For Go-based containers, create a `Makefile` with `build` and `run` targets147- The agent code is compiled inside this container when the `build()` function calls compilers/tools via `subprocess` (Python) or `os/exec` (Go)148149### Step 3: Agent-to-Mythic Communication150151This is the core of the agent. Implement the message protocol in the agent's language.152153**Read these references in order**:1541. [Agent Message Format](./references/agent-message-format.md) - The base wire format: `Base64(UUID + EncBlob(JSON))`1552. [Initial Checkin](./references/initial-checkin.md) - How the agent registers with Mythic1563. [Get Tasking](./references/get-tasking.md) - How the agent requests tasks1574. [Post Response](./references/post-response.md) - How the agent returns task output1585. [File Downloads](./references/file-downloads.md) - Agent -> Mythic file transfer1596. [File Uploads](./references/file-uploads.md) - Mythic -> Agent file transfer160161Implementation order within the agent:1621. **Message encoding/decoding** - Base64, JSON serialization, UUID handling1632. **Encryption layer** - AES256-CBC with PKCS7 padding, HMAC-SHA256 (if using encrypted comms). Format: `IV (16 bytes) + Ciphertext + HMAC`1643. **HTTP/transport layer** - The actual network communication matching the C2 profile1654. **Checkin** - First contact with Mythic, exchange payload UUID for callback UUID1665. **Key exchange** - If using RSA EKE: generate 4096-bit RSA keypair, send public key, receive AES session key1676. **Task loop** - `get_tasking` on interval, process commands, `post_response` with results1687. **File transfer** - Chunked upload/download protocol with file UUID tracking169170### Step 4: Commands and Features171172Add the commands the user requested. Each command has two parts:173- **Agent-side**: The code in the agent that executes the command174- **Mythic-side**: The Python/Go definition that tells Mythic about the command175176**Read**: [Commands](./references/commands.md) and [Create Tasking](./references/create-tasking.md)177178For each command:1791. Define `CommandBase` / command struct with metadata (name, description, MITRE ATT&CK mapping, help text)1802. Define `TaskArguments` / argument struct with parameters1813. Implement `create_go_tasking` for any server-side preprocessing1824. Implement the agent-side execution logic1835. Add `opsec_pre`/`opsec_post` checks where the command creates detectable artifacts184185For additional features, consult:186- [SOCKS](./references/socks.md) - SOCKS5 proxy tunneling through the agent187- [Reverse Port Forward](./references/rpfwd.md) - Reverse port forwarding through the agent188- [Translation Containers](./references/translation-containers.md) - Custom message formats / crypto189- [P2P Connections](./references/p2p-connections.md) - Peer-to-peer mesh networking190- [OPSEC Checking](./references/opsec-checking.md) - Pre/post task OPSEC gates191192### Step 5: Mythic-Side Python/Go Scripts193194Create the server-side container code that defines the agent to Mythic.195196**Read**: [Payload Type Definition](./references/payload-type-definition.md)197198Key deliverables:1991. **Payload Type class** - Name, supported OS, C2 profiles, build parameters, file extension200 - **Python field names**: `name`, `supported_os`, `c2_profiles` (NOT `supported_c2_profiles`), `build_parameters`, `mythic_encrypts`201 - **Go struct fields**: `Name`, `SupportedOS`, `SupportedC2Profiles`, `BuildParameters`, `MythicEncryptsData`2022. **Build function** - Takes user-selected options and compiles/assembles the agent binary203 - Runs INSIDE the container - only tools installed in the Dockerfile are available204 - Read C2 profile parameters and stamp them into agent config205 - Call compilers via `subprocess` (Python) or `os/exec` (Go)206 - Handle command selection (if `supports_dynamic_loading`)207 - Return `BuildResponse` with the final payload bytes2083. **Command definitions** - One file per command with `CommandBase` and `TaskArguments`2094. **Build steps** - Define progress indicators for the build process210211See also:212- [C2 Profile Definition](./references/c2-profile-definition.md) - If building a custom C2 profile213- [Container Syncing](./references/container-syncing.md) - How containers register with Mythic214215## Reference Index216217For detailed documentation on each topic, consult the following pages. Load only the pages you need to conserve context.218219**Full index**: [Reference Index](./references/index.md)220221### Quick Reference222223| Topic | Reference | When to Use |224|-------|-----------|-------------|225| Project structure | [Project Layout](./references/project-layout.md) | Setting up the repo/container |226| Agent definition | [Payload Type Definition](./references/payload-type-definition.md) | Defining the agent class and build |227| Wire format | [Agent Message Format](./references/agent-message-format.md) | Implementing message encoding |228| First contact | [Initial Checkin](./references/initial-checkin.md) | Implementing checkin + key exchange |229| Fetch tasks | [Get Tasking](./references/get-tasking.md) | Implementing the task loop |230| Return output | [Post Response](./references/post-response.md) | Sending task results |231| Download files | [File Downloads](./references/file-downloads.md) | Agent -> Mythic file transfer |232| Upload files | [File Uploads](./references/file-uploads.md) | Mythic -> Agent file transfer |233| Command defs | [Commands](./references/commands.md) | Defining commands and parameters |234| Task processing | [Create Tasking](./references/create-tasking.md) | Server-side task preprocessing |235| OPSEC gates | [OPSEC Checking](./references/opsec-checking.md) | Pre/post task OPSEC checks |236| Custom format | [Translation Containers](./references/translation-containers.md) | Non-JSON / custom crypto |237| C2 profiles | [C2 Profile Definition](./references/c2-profile-definition.md) | Building a custom C2 profile |238| SOCKS proxy | [SOCKS](./references/socks.md) | SOCKS5 tunneling through agent |239| Reverse port fwd | [Reverse Port Forward](./references/rpfwd.md) | Reverse port forwarding through agent |240| P2P mesh | [P2P Connections](./references/p2p-connections.md) | Peer-to-peer agent linking |241| Sync lifecycle | [Container Syncing](./references/container-syncing.md) | Understanding container registration |