Xenos, is Greek for stranger.
AWSXenos will assess the trust relationships in all the IAM roles, and resource policies for several AWS services in an AWS account and give you a breakdown of all the accounts that have trust relationships to your account. It will also highlight whether the trusts have an external ID or not.
https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html
This tool reports against the Trusted Relationship Technique and parts of the Valid Accounts: Cloud Accounts of the ATT&CK Framework.
- For the "known" accounts list AWSXenos uses a modified version of known AWS Accounts.
- For the Org accounts list, AWSXenos will query AWS Organizations.
- AWS Services are classified separately.
- Everything else falls under unknown account
- For regional services, e.g. KMS, you'll need to run AWSXenos per region.
- You can configure which services you'd like to assess by providing a config.yaml file.
Access Analyzer falls short because:
-
You need to enable it in every region.
-
Identified external entities might be known entities. E.g. a trusted third party vendor or a vendor you no longer trust. An Account number is seldom useful.
-
Zone of trust is a fixed set of the AWS organisation. You won’t know if a trust between sandbox->prod has been established.
-
Does not identify AWS Service principals. This is mainly important because of Wiz's AWSConfig, et al vulnverabilities
Comparison based on AWS Documentation 1 and 2, including services or resources outside of docs, e.g. VPC endpoints.
Service | AWSXenos | Access Analyzer |
---|---|---|
S3 Bucket | ✅ | ✅ |
S3 Directory Buckets | ❌ | ✅ |
S3 Access Points | ❌ | ✅ |
S3 Bucket ACLs | ✅ | ✅ |
S3 Glacier | ✅ | ❌ |
IAM | ✅ | ✅ |
KMS | ✅ | ✅ |
Secrets Manager | ✅ | ✅ |
Lambda | ✅ | ✅ |
SNS | ❌ | ✅ |
SQS | ✅ | ✅ |
RDS Snapshots | ❌ | ✅ |
RDS Cluster Snapshots | ❌ | ✅ |
ECR | ❌ | ✅ |
EFS | ✅ | ✅ |
DynamoDB streams | ❌ | ✅ |
DynamoDB tables | ❌ | ✅ |
EBS Snapshots | ❌ | ✅ |
EventBridge | ✅ | ❌ |
EventBridge Schema | ❌ | ❌ |
Mediastore | ❌ | ❌ |
Glue | ❌ | ❌ |
Kinesis Data Streams | ❌ | ❌ |
Lex v2 | ❌ | ❌ |
Migration Hub Orchestrator | ❌ | ❌ |
OpenSearch | ❌ | ❌ |
AWS PCA | ❌ | ❌ |
Redshift Serverless | ❌ | ❌ |
Serverless Application Repository | ❌ | ❌ |
SES v2 | ❌ | ❌ |
Incident Manager | ❌ | ❌ |
Incident Manager Contacts | ❌ | ❌ |
VPC endpoints | ❌ | ❌ |
pip install AWSXenos
awsxenos --reporttype HTML -w report.html
awsxenos --reporttype JSON -w report.json
You will get an HTML and JSON report.
See example report
You can configure the services you care about by using your own config.
from awsxenos.scan import PreScan
from awsxenos.report import Report
from awsxenos.s3 import S3
#from awsxenos.iam import IAM
# To run everything based on your config.
prescan = PreScan()
results = load_and_run(config_path, prescan.accounts)
r = Report(results, prescan.known_accounts)
# Per service
prescan = PreScan()
aws_service = S3()
findings = aws_service.fetch(prescan.accounts)
r = Report(s.findings, s.known_accounts)
json_summary = r.JSON_report()
html_summary = r.HTML_report()
Permissions required.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"elasticfilesystem:DescribeFileSystemPolicy",
"elasticfilesystem:DescribeFileSystems",
"events:ListEventBuses",
"glacier:GetVaultAccessPolicy",
"glacier:ListVaults",
"iam:ListRoles",
"organizations:ListAccounts",
"kms:GetKeyPolicy",
"kms:ListKeys",
"lambda:GetPolicy",
"lambda:ListFunctions",
"s3:GetBucketAcl",
"s3:GetBucketPolicy",
"s3:ListAllMyBuckets",
"secretsmanager:GetResourcePolicy",
"secretsmanager:ListSecrets",
"sqs:GetQueueAttributes",
"sqs:ListQueues"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
python3 -m env venv
source /env/bin/activate
pip install -r requirements.txt
- Create a file with the name of the service.
- Create a class with the name of the resource that you want from that service
- Your class must inherit from
Service
and returnFindings
Example:
class S3(Service):
def fetch(self, accounts: DefaultDict[str, Set] ) -> Findings:
self._buckets = self.list_account_buckets()
self.policies = self.get_bucket_policies()
return super().collate(accounts, self.policies)
- Add your filename and class to the config
conditions
, will not be taken into account, therefore resulting in false positives.
This could be fairly common in KMS Customer Managed Keys created by AWS Services.
AWSXenos findings are per IAM statement on an IAM policy.
Create a PR or raise an issue. Contributions are welcome.
- Use as library
- HTML and JSON output