Execute Abilities Over REST API #2215
Replies: 2 comments 4 replies
-
Hi, thanks for using CALDERA! These are some good points. The documentation for the original v1 REST api can be improved upon, and I will try to open a ticket for this. For the exploit endpoint, abilities are added to the agent link chain where they wait to execute. I believe the reason "complete" is returned is to indicate that they have successfully been added to the chain, rather than indicating that they have finished execution (depending on the ability, this can take some time). I'm not sure if there are currently any plans on updating the plugins to the new v2 API. We've been working on rolling out a v2 API with included Swagger documentation for a lot of the first class objects (operations, abilities, agents, etc). Some of these endpoints have already been merged into the master branch. The documentation for the completed endpoints can be seen by appending One workaround to the problem you are running into (although one that requires a few requests) could be the following:
This isn't the cleanest method, but I'm not sure if there are plans to update the access REST API as of now. Thank you for the feedback! |
Beta Was this translation helpful? Give feedback.
-
I also vote for @BIGdeadLock's suggestion. Directly returning the link is cleaner than having to parse the entire "result" JSON object. That way it is possible to directly process the last action's results. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Really love the tool. There are some amazing features that I did not imagined an open source threat simulator will had.
The REST API is a really important feature of the tool and in my opinion still a little lacking in its documentation.
From what I see in the source code there are a lot of endpoints that are not mentioned in the documentation, for example:
the POST index="result" endpoint, the agent_configuration endpoint etc.
The one I use the most is the access/exploit endpoint to run a single ability against a single agent.
The documentation about how to use the facts in lacking because the example shown is not representive of how the facts are coded. For example showing an example of {trait: remote.host.ip ,value: 127.0.0.1} is more informative than {trait: username, value: "admin"}.
In addition in the access_api.py in the access plugin:
Every ability will return "complete" without any information if it was successfully completed or not.
I added the following code instead of returning "complete":
If the ability was ran it will return the link_id. With the link_id I can query the result endpoint and if no link_id was return I know that the ability failed to run. It is a nice workaround for now. Hope you can do even do something more advanced for that purpose like returning the status of the attack so that the user will not have to query the result endpoint in addition to fetch the status of the attack.
Beta Was this translation helpful? Give feedback.
All reactions