references/profile-development.md
GitHubMythic C2 Profile Development Reference
Profile package anatomy
A Mythic C2 profile normally includes:
- profile definition code containing the
C2Profilemetadata and parameters - container build material such as Dockerfile or project metadata
- server binary/script for egress profiles
- server folder files such as config templates, redirect rules, static assets, or scripts
- optional profile icon and documentation
For repositories modeled like MythicC2Profiles, inspect the existing profile folders first and follow their language/container conventions.
Egress profile data flow
agent transport message
-> profile listener/server
-> extract Mythic agent message
-> POST to Mythic /agent_message
-> receive Mythic response
-> wrap/encode response for transport
-> agent
Implementation notes:
- Keep the transport parsing layer separate from Mythic forwarding code.
- Make bind host, bind port, callback host, URI paths, headers, and TLS material explicit parameters.
- Fail closed on malformed messages; log enough for debugging without printing keys or full task data.
- Add clear startup validation for missing config values, invalid ports, or inaccessible certificate/key files.
P2P profile data flow
P2P profiles usually do not run a listener container. They define operator parameters and agent-side routing metadata for links such as TCP, SMB, or custom peer channels.
Implementation notes:
- Set
is_p2p=True. - Keep parameters focused on peer addressing, pipe names, listen/connect mode, and routing labels.
- Validate that agent code emits delegate messages with the correct
c2_profilename.
Parameter design checklist
- Stable
namevalues; changing names can break payload builders and saved configs. - Useful
descriptiontext for operators. - Safe
default_valuevalues; avoid environment-specific secrets. verifier_regexfor URLs, ports, UUIDs, pipe names, and profile-specific syntax.required=Truefor values needed at build or runtime.randomized=Trueplusformat_stringfor per-payload identifiers.crypto_type=Trueonly for parameters Mythic should use to generate/store crypto material.- Dictionary parameters for HTTP headers or metadata maps.
- Array parameters for lists of URIs, domains, or failover hosts.
Validation checklist
- Container builds successfully.
- Container starts and syncs profile metadata into Mythic.
- Profile is selectable in payload build UI.
- Payload type declares support for the profile.
- Payload build receives selected parameter values.
- Agent can check in through the profile.
- Agent can get tasking and post responses.
- File upload/download paths work if supported by the agent/profile transport.
- Restarting the profile container preserves expected config behavior.
- Error logs are actionable and do not expose secrets.
Common mistakes
- Using a profile
namethat does not match payload type supported C2 entries. - Forgetting
server_binary_pathfor egress profiles. - Marking a listener profile as
is_p2p=True. - Logging full encrypted/decrypted messages or generated keys.
- Embedding operator-selected C2 parameters in the agent with mismatched field names.
- Adding profile parameters but not updating the payload build function to consume them.