Exploiting Lambda Command Injection to access DynamoDB
Exploit a Lambda function's command injection vulnerability to compromise a web application, gaining unauthorized access to a DynamoDB database and its data. Capture the flag by retrieving an administrator's token and decoding it.
- 10 guided tasks
- Capture the flag

Scenario
Even though you can use AWS Lambda to create and run serverless functions, those Lambda functions are still running code. That code can be vulnerable to the same types of vulnerabilities that can affect web application code. (If you're not familiar with web vulnerabilities, [OWASP Top 10](https://owasp.org/www-project-top-ten/) or our [Introduction to Application Security course](https://cybr.com/courses/introduction-to-application-security-appsec/) are great places to start)
In this lab, we'll learn how to find a command injection vulnerability in code running in a public Lambda function that's powering an e-newspaper serverless web application. We'll exploit this vulnerability to access AWS credentials, and then we'll access data stored within DynamoDB, which is one of AWS' database offerings used by customers all over the world to store all sorts of data.
Basic knowledge of command injections is recommended. Refresh your memory with OWASP's resource, or learn about command injections in our Introduction to OS Command Injections course.
What you will learn
- Access a public Lambda function URL that serves a web application
- Find and exploit a command injection flaw in the app's path parameter
- Read the Lambda function's environment to steal its temporary AWS credentials
- Use the stolen credentials to enumerate and scan a DynamoDB table
- Decode the administrator's token to capture the flag
Exploiting Lambda Command Injection to access DynamoDB
Included in Cybr Premium.