its-a-feature / Mythic

A collaborative, multi-platform, red teaming framework
Other
3.29k stars 432 forks source link

[Feature Request] Privileged Container #407

Closed charnim closed 2 months ago

charnim commented 2 months ago

I have a custom agent that relies on a Docker Inside Docker architecture. Having the ability to install the custom agent with /mythic-cli install folder ./MyAgent -f --privileged or something of the sort would be a neat upgrade.

its-a-feature commented 2 months ago

I don't publicize this much because it doesn't happen very often, but you can actually already do that. In your config.json that's part of your repo / folder that's used when you install, you can include the following:

"docker-compose": {
        "privileged": true
    }

^ the docker-compose key and then a key-value dictionary of what things you need set in docker compose for which fields. Hermes actually does something similar so that it could use some kernel components for running Darling within Docker:

https://github.com/MythicAgents/hermes/blob/main/config.json#L7-L9

charnim commented 2 months ago

Ok thats useful to know, thank you. Another thing with the install, How can I get rid of the automatic CPU: 1 line in the docker-compose? I want to use all cores.

Edit: I used { "exclude_payload_type": false, "exclude_c2_profiles": true, "exclude_documentation_payload": true, "exclude_documentation_c2": true, "exclude_agent_icons": true, "docker-compose": { "privileged": true, "cpus": 1000 } } which is a bit hacky to override the cpus:1 but it does the job(Compose will just use the lower: either system's max CPU or 1000 )