AWS - Secrets Manager Enum
Reading time: 3 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.
AWS Secrets Manager
AWS Secrets Manager is designed to eliminate the use of hard-coded secrets in applications by replacing them with an API call. This service serves as a centralized repository for all your secrets, ensuring they are managed uniformly across all applications.
The manager simplifies the process of rotating secrets, significantly improving the security posture of sensitive data like database credentials. Additionally, secrets like API keys can be automatically rotated with the integration of lambda functions.
The access to secrets is tightly controlled through detailed IAM identity-based policies and resource-based policies.
For granting access to secrets to a user from a different AWS account, it's necessary to:
- Authorize the user to access the secret.
- Grant permission to the user to decrypt the secret using KMS.
- Modify the Key policy to allow the external user to utilize it.
AWS Secrets Manager integrates with AWS KMS to encrypt your secrets within AWS Secrets Manager.
Enumeration
aws secretsmanager list-secrets #Get metadata of all secrets
aws secretsmanager list-secret-version-ids --secret-id <secret_name> # Get versions
aws secretsmanager describe-secret --secret-id <secret_name> # Get metadata
aws secretsmanager get-secret-value --secret-id <secret_name> # Get value
aws secretsmanager get-secret-value --secret-id <secret_name> --version-id <version-id> # Get value of a different version
aws secretsmanager get-resource-policy --secret-id --secret-id <secret_name>
Privesc
Post Exploitation
AWS - Secrets Manager Post Exploitation
Persistence
AWS - Secrets Manager Persistence
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.