-
Notifications
You must be signed in to change notification settings - Fork 807
Closed
Labels
BugAn error, flaw, misbehavior or failure in the Monkey or Monkey Island.An error, flaw, misbehavior or failure in the Monkey or Monkey Island.Complexity: MediumImpact: Medium
Description
Describe the bug
There is some issue in the /api/telemetry endpoint that leads to a stack trace. Mongo is then queried for a monkey ID and the record is not found.
10.2.2.43 - - [2021-03-26 13:38:47] "POST /api/bootloader/windows HTTP/1.1" 200 125 0.005158
10.2.2.19 - - [26/Mar/2021 13:38:47] "POST /windows HTTP/1.1" 200 -
174.60.145.36 - - [2021-03-26 13:38:48] "POST /api/auth HTTP/1.1" 200 408 0.010843
2021-03-26 13:38:48,829 - auth.py:51 - post() - DEBUG - Created access token for user 55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d20628d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557 that begins with eyJ0
2021-03-26 13:38:49,613 - app.py:1892 - log_exception() - ERROR - Exception on /api/telemetry [POST]
Traceback (most recent call last):
File "/monkey/lib/python3.7/site-packages/mongoengine/queryset/base.py", line 260, in get
result = next(queryset)
File "/monkey/lib/python3.7/site-packages/mongoengine/queryset/base.py", line 1590, in __next__
raw_doc = next(self._cursor)
File "/monkey/lib/python3.7/site-packages/pymongo/cursor.py", line 1215, in next
raise StopIteration
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/monkey/monkey_island/cc/models/monkey.py", line 66, in get_single_monkey_by_guid
return Monkey.objects.get(guid=monkey_guid)
File "/monkey/lib/python3.7/site-packages/mongoengine/queryset/base.py", line 263, in get
raise queryset._document.DoesNotExist(msg)
monkey_island.cc.models.monkey.DoesNotExist: Monkey matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/monkey/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/monkey/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/monkey/lib/python3.7/site-packages/flask_restful/__init__.py", line 468, in wrapper
resp = resource(*args, **kwargs)
File "/monkey/lib/python3.7/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/monkey/lib/python3.7/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
resp = meth(*args, **kwargs)
File "/monkey/monkey_island/cc/resources/test/utils/telem_store.py", line 35, in decorated_function
return f(*args, **kwargs)
File "/monkey/monkey_island/cc/resources/telemetry.py", line 53, in post
Monkey.get_single_monkey_by_guid(telemetry_json['monkey_guid']).renew_ttl()
File "/monkey/monkey_island/cc/models/monkey.py", line 68, in get_single_monkey_by_guid
raise MonkeyNotFoundError("info: {0} | guid: {1}".format(ex, str(monkey_guid)))
monkey_island.cc.models.monkey.MonkeyNotFoundError: info: Monkey matching query does not exist. | guid: 175244320299440
2021-03-26 13:38:49,788 - auth.py:51 - post() - DEBUG - Created access token for user 55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d20628d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557 that begins with eyJ0
2021-03-26 13:38:50,260 - auth.py:51 - post() - DEBUG - Created access token for user 55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d20628d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557 that begins with eyJ0
2021-03-26 13:38:50,304 - connectionpool.py:943 - _new_conn() - DEBUG - Starting new HTTPS connection (1): 10.2.2.43:5000
To Reproduce
Steps to reproduce the behavior:
- Run monkey island from a docker container
- Run the blackbox tests (mssql exploiter seems to reliably trigger this)
- Keep an eye on the monkey island logs
Machine version (please complete the following information):
- OS: Linux (docker)
Metadata
Metadata
Assignees
Labels
BugAn error, flaw, misbehavior or failure in the Monkey or Monkey Island.An error, flaw, misbehavior or failure in the Monkey or Monkey Island.Complexity: MediumImpact: Medium