Lambda SQL injection to access secrets
Exploit a Lambda function's SQL injection vulnerability to grant yourself privileges that let you access a secret from Secrets Manager you shouldn't have access to. Inspired by CloudGoat's Vulnerable Lambda scenario but slightly modified.
- 2 guided tasks
- Capture the flag
- Terminal in the browser

Scenario
This is a capture-the-flag challenge. It is based on a real privilege-escalation scenario from a Pacu and CloudGoat course, but we changed it slightly so you can prove your understanding and capture the flag without a step-by-step guide. You start as a low-privilege IAM user, and somewhere in the account a Lambda function attaches managed policies to users. Your goal is to escalate your access and read a protected secret. You can use either Pacu or the AWS CLI. You capture the flag when you can read the vault-password value in plaintext from AWS Secrets Manager. This runs in a real AWS account, so take your time to explore.
What you will learn
- Configure the AWS CLI with the low-privilege credentials the lab gives you
- Enumerate the permissions and resources your IAM user can reach
- Find the SQL injection flaw in the policy-applier Lambda function
- Exploit the flaw to attach a privileged policy to your own user
- Read the protected secret in Secrets Manager and capture the flag