Skip to content

Agent IDs are inconsistent #3119

@mssalvatore

Description

@mssalvatore

Describe the bug

get_agent_id() is declared to be a global singleton. As a result, when plugins (which are running in different processes) call get_agent_id(), they do not receive the "cached" value, but instead receive a new value. This means that all agents which are spawned by a plugin exploiter will have the wrong parent ID.

To Reproduce

Steps to reproduce the behavior:

  1. Configure the Monkey to exploit a hadoop machine
  2. Run the monkye
  3. Examine the agent log on the attacker's machine. Note the AgentID in the log.
  4. Examine the agent log on the victim's machine. Note that what is passed as the parent ID does not match the attacker's agent ID.

Expected behavior

The parent ID sent to child agents should match the ID of parent agents.

Machine version (please complete the following information):

  • OS: Windows or Linux

Recommended Solution

The agent ID should be passed from monkey.py down to any components that need it.

Tasks

  • Pass the ID down to components that require it (0d) @cakekoa
    • Pass the agent ID to Heart.__init__()
    • Pass the agent ID to network scanners
      • Ping scanner
      • TCP scanner
    • Pass the agent ID to credentials collectors
      • SSH
      • Mimikatz
    • Pass the agent ID to ransomware
    • Pass the agent ID to the plugin registry
  • Pass agent ID to exploiters (0d) - @shreyamalviya
    • Construct plugins (PluginLoader) with the agent ID not needed, all of this is handled in the plugin registry
    • Modify exploiters (and exploiter wrapper?) to accept the agent ID in their constructors
    • Modify infection_monkey.utils.commands to receive agent ID as a parameter
      • Pass AgentID as a parameter from all callers
  • Simplify get_agent_id() (the caching is no longer necessary) (0.25d) @cakekoa

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions