Skip to content

get_tasking items not bundled for same p2p agent destination when using get_delegate_tasks #484

@save196

Description

@save196

Description:

When get_delegate_tasks is set to True (this is also the default behavior), tasks intended for delegation that have the same agent as the destination are being issued as separate get_tasking requests. This results in multiple delegate items instead of bundling them into a single request.

Current Behavior:

Tasks to delegate are issued as separate requests:

  1. Task 1:

    {
      "action": "get_tasking",
      "tasks": [
        {
          "timestamp": 1759492528,
          "command": "whoami",
          "parameters": "",
          "id": "16c235f8-5770-4e10-a99f-77b4bec758ce",
          "token": 0
        }
      ]
    }
  2. Task 2:

    {
      "action": "get_tasking",
      "tasks": [
        {
          "timestamp": 1759492530,
          "command": "ls",
          "parameters": "{\"1\": \".\", \"2\": \"\"}",
          "id": "ba25aa22-9ae5-42b9-9c89-f2f742d1356d",
          "token": 0
        }
      ]
    }

These are converted to separate delegate items with the same destination UUID:

{
  "action": "get_tasking",
  "delegates": [
    {
      "message": "NTY3OTc4OWQtNjY2NS00OGYxLTkyMTMtNzYxMjBmNzQ5NmQ38deki1/pGm9UcdC1lNz5dn7BLUO9hTxfiVALqhsbGZRihWcscrG+3J4SGNrU20hUW/0V43PtUFhIoSKkX/j33ufC8ATs/O4uzSUlmkzrLSUV/jfi0AyowqkIKaeYFz/I",
      "uuid": "5679789d-6665-48f1-9213-76120f7496d7",
      "c2_profile": "tcp"
    },
    {
      "message": "NTY3OTc4OWQtNjY2NS00OGYxLTkyMTMtNzYxMjBmNzQ5NmQ3pNt7md20BZDj+FANUocoVkBiraRxn8ZF5WuoFkgF7RLAkppYiVfwVrSwvp8lTfJ16q0fsJO49A4q4oYHbiotDRzlFTznqBfXbBrIG9P1vJ4eFgBuGW99sfWyjpU13+dJ",
      "uuid": "5679789d-6665-48f1-9213-76120f7496d7",
      "c2_profile": "tcp"
    }
  ],
  "tasks": []
}

Expected Behavior:

Items with the same destination UUID should be bundled into a single get_tasking request to optimize the delegation process.

Steps to Reproduce:

  1. Set get_delegate_tasks to True (or not set it at all as True is the default).
  2. Create multiple tasks for a p2p agent before the parent issues a get_tasking.
  3. Observe the separate get_tasking requests and delegate items.

Environment:

  • Mythic C2 version: v3.3.1-rc94

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions