mitre / caldera

Automated Adversary Emulation Platform
https://caldera.mitre.org
Apache License 2.0
5.67k stars 1.08k forks source link

TransportSocket object has no attribute 'send' #3049

Open ansiballZ opened 2 months ago

ansiballZ commented 2 months ago

Describe the bug When deploying the Manx agent (Windows and Linux), the agent will connect to the C2 and after a while it will show dead although it is still beaconing out. When running Caldera with Debug I receive a transport error. Tested with ragdoll and sandcat agents and those remained "alive."

To Reproduce Steps to reproduce the behavior:

  1. Start the caldera server (python3 server.py --insecure -l DEBUG)
  2. Deploy Manx agent

Expected behavior Agent remains alive and trusted while beaconing.

Screenshots image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

sd-wolf commented 1 month ago

The issue is that the TransportSocket class, which is from the core Python library asyncio and had deprecated a number of methods from trsock.py that were used in contact_tcp.py in Python 3.8. They were then removed from the class in Python 3.11. You can see the changes here. Affected methods that are used by TransportSocket include:

To work around the issue, you can use an older version of Python that is supported by Caldera, such as Python 3.9.

corradoproietti commented 2 weeks ago

I posted a possible workaround for Python3.11+ at: https://github.com/mitre/caldera/issues/3072