You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+24-36
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Endgame
2
2
3
-
An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS account's resources with a rogue AWS account - or to the entire Internet 😈
3
+
An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS account's resources with a rogue AWS account - or share the resources with the entire internet 😈
@@ -12,7 +12,7 @@ An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS a
12
12
<imgsrc="docs/images/endgame.gif">
13
13
</p>
14
14
15
-
**TL;DR**: `endgame smash --service all` to create backdoors across your entire AWS account - either to a rogue IAM user/role or to the entire Internet.
15
+
**TL;DR**: `endgame smash --service all` to create backdoors across your entire AWS account - by sharing resources either with a rogue IAM user/role or with the entire Internet.
16
16
17
17
# Endgame: Creating Backdoors in AWS
18
18
@@ -23,7 +23,7 @@ Endgame abuses AWS's resource permission model to grant rogue users (or the Inte
23
23
24
24
Endgame was created to:
25
25
* Push [AWS](https://endgame.readthedocs.io/en/latest/recommendations-to-aws/) to improve coverage of AWS Access Analyzer so AWS users can protect themselves.
26
-
* Show [blue teams](https://endgame.readthedocs.io/en/latest/recommendations-to-blue-teams/) and developers what kind of damage can be done by overprivileged/leaked accounts.
26
+
* Show [blue teams](#recommendations-to-blue-teams) and developers what kind of damage can be done by overprivileged/leaked accounts.
27
27
* Help red teams to demonstrate impact of their access.
28
28
29
29
Endgame demonstrates (with a bit of shock and awe) how simple human errors in excessive permissions (such a granting `s3:*` access instead of `s3:GetObject`) can be abused by attackers. These are not new attacks, but AWS's ability to **detect**_and_**prevent** these attacks falls short of what customers need to protect themselves. This is what inspired us to write this tool. Follow the [Tutorial](#tutorial) and observe how you can expose resources across **17 different AWS services** to the Internet in a matter of seconds.
@@ -112,7 +112,7 @@ brew tap salesforce/endgame https://github.com/salesforce/endgame
112
112
brew install endgame
113
113
```
114
114
115
-
Now you should be able to execute Endgame from the command line by running `endgame --help`.
115
+
Now you should be able to execute Endgame from command line by running `endgame --help`.
The prerequisite for an attacker running Endgame is that they have access to AWS API credentials for the victim account which have privileges to update resource policies.
134
-
135
-
Endgame can run in two modes, `expose` or `smash`. The less-destructive `expose` mode is surgical, updating the resource policy on a single attacker-defined resource to include a back door to a principal they control (or the Internet if they're mean).
136
-
137
-
`smash`, on the other hand, is more destructive (and louder). `smash` can run on a single service or all supported services. In either case, for each service it enumerates a list of resources in that region, reads the current resource policy on each, and applies a new policy which includes the "evil principal" the attacker has specified. The net effect of this is that depending on the privileges they have in the victim account, an attacker can insert dozens of back doors which are not controlled by the victim's IAM policies.
138
-
139
-
140
131
## Step 1: Setup
141
132
142
133
* First, authenticate to AWS CLI using credentials to the victim's account.
@@ -245,44 +236,40 @@ While [Cloudsplaining](https://opensource.salesforce.com/cloudsplaining/) (a Sal
245
236
246
237
At the time of this writing, [AWS Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-resources.html) does **NOT** support auditing **11 out of the 18 services** that Endgame attacks. Given that Access Analyzer is intended to detect this exact kind of violation, we kindly suggest to the AWS Team that they support all resources that can be attacked using Endgame. 😊
247
238
248
-
The lack of preventative tooling makes this issue more difficult for customers. Ideally, customers should be able to say, "Nobody in my AWS Organization is allowed to share **any** resources that can be exposed by Endgame outside of the organization, unless that resource is in an exemption list." This **should** be possible, but it is not. It is not even possible to use [AWS Service Control Policies (SCPS)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html) - AWS's preventative guardrails service - to prevent `sts:AssumeRole` calls from outside your AWS Organization. The current SCP service limit of 5 SCPs per AWS account compounds this problem.
239
+
The lack of preventative tooling makes this issue more difficult for customers. Ideally, customers should be able to say, _"Nobody in my AWS Organization is allowed to share **any** resources that can be exposed by Endgame outside of the organization, unless that resource is in an exemption list."_ This **should** be possible, but it is not. It is not even possible to use [AWS Service Control Policies (SCPS)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html) - AWS's preventative guardrails service - to prevent `sts:AssumeRole` calls from outside your AWS Organization. The current SCP service limit of 5 SCPs per AWS account compounds this problem.
249
240
250
241
We recommend that AWS take the following measures in response:
251
-
* Increase Access Advisor Support to cover the resources that can be exposed via Resource-based Policy modification, AWS RAM resource sharing, and resource-specific sharing APIs (such as RDS snapshots, EBS snapshots, and EC2 AMIs)
242
+
* Increase Access Analyzer Support to cover the resources that can be exposed via Resource-based Policy modification, AWS RAM resource sharing, and resource-specific sharing APIs (such as RDS snapshots, EBS snapshots, and EC2 AMIs)
252
243
* Create GuardDuty rules that detect anomalous exposure of resources outside your AWS Organization.
253
244
* Expand the current limit of 5 SCPs per AWS account to 200. (for comparison, the Azure equivalent - Azure Policies - has a limit of [200 Policy or Initiative Assignments per subscription](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-policy-limits))
254
245
* Improve the AWS SCP service to support an "Audit" mode that would record in CloudTrail whether API calls would have been denied had the SCP not been in audit mode. This would increase customer adoption and make it easier for customers to both pilot and roll out new guardrails. (for comparison, the Azure Equivalent - Azure Policies - already [supports Audit mode](https://docs.microsoft.com/en-us/azure/governance/policy/concepts/effects#audit).
255
246
* Support the usage of `sts:AssumeRole` to prevent calls from outside your AWS Organization, with targeted exceptions.
247
+
* Add IAM Condition Keys to all the IAM Actions that are used to perform Resource Exposure. These IAM Condition Keys should be used to prevent these resources from (1) being shared with the public **and** (2) being shared outside of your `aws:PrincipalOrgPath`.
256
248
257
249
## Recommendations to Blue Teams
258
250
259
-
There are three general methods that blue teams can use to detect the usage of this tool:
260
-
1. User Agent Detection
261
-
2. API call detection
262
-
3. Behavioral-based detection
263
-
264
-
#### User Agent Detection
265
-
266
-
Endgame uses the user agent `HotDogsAreSandwiches` by default. While this can be overriden using the `--cloak` flag, defense teams can still use it as an IOC.
267
-
268
-
The following CloudWatch Insights query will expose events with the `HotDogsAreSandwiches` user agent in CloudTrail logs:
This query assumes that your CloudTrail logs are being sent to CloudWatch and that you have selected the correct log group.
253
+
There are three general methods that blue teams can use to **detect** AWS Resource Exposure Attacks. See the links below for more detailed guidance per method.
While (1) User Agent Detection is specific to the usage of Endgame, (2) API Call Detection, (3) Behavioral-based detection, and (4) AWS Access Analyzer are strategies to detect Resource Exposure Attacks, regardless of if the attacker is using Endgame to do it.
278
260
279
-
Further documentation on how to query for specific API calls made to each service by endgame is available in the [risks documentation](docs/risks).
261
+
### Prevention
280
262
281
-
#### Behavioral-based detection
263
+
There are 6 general methods that blue teams can use to **prevent** AWS Resource Exposure Attacks. See the links below for more detailed guidance per method.
282
264
283
-
Behavioral-based detection is currently being researched and developed by [Ryan Stalets](https://twitter.com/RyanStalets). [GitHub issue #46](https://github.com/salesforce/endgame/issues/46) is being used to track this work. We welcome all contributions and discussion!
265
+
1.[Use AWS KMS Customer-Managed Keys to encrypt resources](https://endgame.readthedocs.io/en/latest/prevention/#use-aws-kms-customer-managed-keys)
4.[Inventory which IAM Principals are capable of Resource Exposure](https://endgame.readthedocs.io/en/latest/prevention/#inventory-which-iam-principals-are-capable-of-resource-exposure)
269
+
5.[AWS Service Control Policies](https://endgame.readthedocs.io/en/latest/prevention/#aws-service-control-policies)
Additional information on AWS resource policies, how this tool works in the victim account, and identification/containment suggestions is [here](docs/resource-policy-primer.md).
288
275
@@ -439,6 +426,7 @@ Note that the `expose` command will not expose the resources to the world - it w
439
426
440
427
# References
441
428
429
+
*[Example Splunk Dashboard for AWS Resource Exposure](https://kmcquade.github.io/rick/)
Copy file name to clipboardexpand all lines: docs/appendices/faq.md
+10
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
1
1
# FAQ
2
2
3
+
## Where does AWS Access Analyzer fall short?
4
+
5
+
[AWS Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) analyzes new or updated resource-based policies within 30 minutes of policy updates (triggered by CloudTrail log entries), and during periodic scans (every 24 hours). If an attacker leverages the `expose` or `smash` commands but quickly rolls back the changes with `--undo`, you might not find out about the attack with Access Analyzer until 30 minutes later.
6
+
7
+
However, Access Analyzer can still be especially useful in ensuring that if attacks do gain a foothold in your infrastructure. If the attacker ran Endgame or perform resource exposure attacks without the tool, you can still use Access Analyzer to alert on those changes so you can respond to the issue, instead of allowing a persistent backdoor.
8
+
9
+
The primary drawback with AWS Access Analyzer is that it does not support 11/17 resource types currently supported by Endgame. It also does not support AWS RAM Resource sharing outside of your trust zone, or resource-specific sharing APIs (such as RDS snapshots, EBS snapshots, and EC2 AMIs).
10
+
11
+
See the [Recommendations to AWS](../recommendations-to-aws.md) section for more details.
There are three general methods that blue teams can use to **detect** AWS Resource Exposure Attacks:
4
+
1. User Agent Detection (Endgame specific)
5
+
2. API call detection
6
+
3. Behavioral-based detection
7
+
4. AWS Access Analyzer
8
+
9
+
While (1) User Agent Detection is specific to the usage of Endgame, (2) API Call Detection, (3) Behavioral-based detection, and (4) AWS Access Analyzer are strategies to detect Resource Exposure Attacks, regardless of if the attacker is using Endgame to do it.
10
+
11
+
AWS Access Analyzer helps, but will not
12
+
13
+
## Detecting Resource Exposure Attacks
14
+
15
+
### API Call Detection
16
+
17
+
Further documentation on how to query for specific API calls made to each service by endgame is available in the [risks documentation](./risks).
18
+
19
+
### Behavioral-based detection
20
+
21
+
Behavioral-based detection is currently being researched and developed by [Ryan Stalets](https://twitter.com/RyanStalets). [GitHub issue #46](https://github.com/salesforce/endgame/issues/46) is being used to track this work. We welcome all contributions and discussion!
22
+
23
+
## Detecting Endgame
24
+
25
+
### User Agent Detection
4
26
5
27
Endgame uses the user agent `HotDogsAreSandwiches` by default. While this can be overriden using the `--cloak` flag, defense teams can still use it as an IOC.
This query assumes that your CloudTrail logs are being sent to CloudWatch and that you have selected the correct log group.
15
37
16
-
Further documentation on how to query for specific API calls made to each service by endgame is available in the risks documentation.
38
+
Further documentation on how to query for specific API calls made to each service by endgame is available in the [risks documentation](risks).
17
39
18
-
##API Call Detection
40
+
### AWS Access Analyzer
19
41
20
-
Further documentation on how to query for specific API calls made to each service by endgame is available in the [risks documentation](./risks).
42
+
[AWS Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html) analyzes new or updated resource-based policies within 30 minutes of policy updates (triggered by CloudTrail log entries), and during periodic scans (every 24 hours). If an attacker leverages the `expose` or `smash` commands but quickly rolls back the changes with `--undo`, you might not find out about the attack with Access Analyzer until 30 minutes later.
43
+
44
+
However, Access Analyzer can still be especially useful in ensuring that if attacks do gain a foothold in your infrastructure. If the attacker ran Endgame or perform resource exposure attacks without the tool, you can still use Access Analyzer to alert on those changes so you can respond to the issue, instead of allowing a persistent backdoor.
45
+
46
+
Consider leveraging `aws:PrincipalOrgID` or `aws:PrincipalOrgPaths` in your Access Analyzer filter keys to detect access from IAM principals outside your AWS account. See [Access Analyzer Filter Keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-filter-keys.html) for more details.
21
47
22
-
## Behavioral-based detection
48
+
## Further Reading
23
49
24
-
Behavioral-based detection is currently being researched and developed by [Ryan Stalets](https://twitter.com/RyanStalets). [GitHub issue #46](https://github.com/salesforce/endgame/issues/46) is being used to track this work. We welcome all contributions and discussion!
50
+
Additional information on AWS resource policies, how this tool works in the victim account, and identification/containment suggestions is [here](resource-policy-primer.md).
0 commit comments