Skip to content

Commit bb550f2

Browse files
committed
Last minute updates to documentation
1 parent c7ec9e4 commit bb550f2

27 files changed

+381
-166
lines changed

README.md

+24-36
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Endgame
22

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 😈
44

55
[![continuous-integration](https://github.com/salesforce/endgame/workflows/continuous-integration/badge.svg?)](https://github.com/salesforce/endgame/actions?query=workflow%3Acontinuous-integration)
66
[![Documentation Status](https://readthedocs.org/projects/endgame/badge/?version=latest)](https://endgame.readthedocs.io/en/latest/?badge=latest)
@@ -12,7 +12,7 @@ An AWS Pentesting tool that lets you use one-liner commands to backdoor an AWS a
1212
<img src="docs/images/endgame.gif">
1313
</p>
1414

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.
1616

1717
# Endgame: Creating Backdoors in AWS
1818

@@ -23,7 +23,7 @@ Endgame abuses AWS's resource permission model to grant rogue users (or the Inte
2323

2424
Endgame was created to:
2525
* 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.
2727
* Help red teams to demonstrate impact of their access.
2828

2929
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
112112
brew install endgame
113113
```
114114

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`.
116116

117117
### Shell Completion
118118

@@ -128,15 +128,6 @@ eval "$(_ENDGAME_COMPLETE=source endgame)"
128128
eval "$(_ENDGAME_COMPLETE=source_zsh endgame)"
129129
```
130130

131-
# Tutorial
132-
133-
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-
140131
## Step 1: Setup
141132

142133
* 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
245236

246237
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. 😊
247238

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.
249240

250241
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)
252243
* Create GuardDuty rules that detect anomalous exposure of resources outside your AWS Organization.
253244
* 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))
254245
* 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).
255246
* 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`.
256248

257249
## Recommendations to Blue Teams
258250

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:
269-
270-
```
271-
fields eventTime, eventSource, eventName, userIdentity.arn, userAgent
272-
| filter userAgent='HotDogsAreSandwiches'
273-
```
251+
### Detection
274252

275-
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.
254+
1. [User Agent Detection (Endgame specific)](https://endgame.readthedocs.io/en/latest/detection/#user-agent-detection)
255+
2. [API call detection](https://endgame.readthedocs.io/en/latest/detection/#api-call-detection)
256+
3. [Behavioral-based detection](https://endgame.readthedocs.io/en/latest/detection/#behavioral-based-detection)
257+
4. [AWS Access Analyzer](https://endgame.readthedocs.io/en/latest/detection/#aws-access-analyzer)
276258

277-
#### API Call Detection
259+
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.
278260

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
280262

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.
282264

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)
266+
2. [Leverage Strong Resource-based policies](https://endgame.readthedocs.io/en/latest/prevention/#leverage-strong-resource-based-policies)
267+
3. [Trusted Accounts Only](https://endgame.readthedocs.io/en/latest/prevention/#trusted-accounts-only)
268+
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)
270+
6. [Prevent AWS RAM External Principals](https://endgame.readthedocs.io/en/latest/prevention/#prevent-aws-ram-external-principals)
284271

285-
#### Further Blue Team Reading
272+
### Further Blue Team Reading
286273

287274
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).
288275

@@ -439,6 +426,7 @@ Note that the `expose` command will not expose the resources to the world - it w
439426

440427
# References
441428

429+
* [Example Splunk Dashboard for AWS Resource Exposure](https://kmcquade.github.io/rick/)
442430
* [AWS Access Analyzer Supported Resources](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-resources.html)
443431
* [AWS Exposable Resources](https://github.com/SummitRoute/aws_exposable_resources)
444432
* [Moto: A library that allows you to easily mock out tests based on AWS Infrastructure](http://docs.getmoto.org/en/latest/docs/moto_apis.html)

docs/appendices/faq.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# FAQ
22

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.
12+
313
## Related Tools in the Ecosystem
414

515
### Attack tools

docs/detection.md

+32-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# Detection
22

3-
## User Agent Detection
3+
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
426

527
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.
628

@@ -13,12 +35,16 @@ fields eventTime, eventSource, eventName, userIdentity.arn, userAgent
1335

1436
This query assumes that your CloudTrail logs are being sent to CloudWatch and that you have selected the correct log group.
1537

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).
1739

18-
## API Call Detection
40+
### AWS Access Analyzer
1941

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.
2147

22-
## Behavioral-based detection
48+
## Further Reading
2349

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

Comments
 (0)