312-50 Question 440
Single answer▪ Serverless ComputingA company exposes an AWS Lambda function through Amazon API Gateway to process customer image uploads. During an authorized security assessment, an ethical hacker discovers that unauthenticated requests to the endpoint trigger expensive image-processing code and cause a sharp increase in Lambda invocations and downstream S3 access. The function code itself does not appear vulnerable to command injection or code execution. Which action would BEST reduce the immediate security risk while preserving the serverless architecture?
- A
Add authentication and authorization controls at API Gateway, and apply throttling/usage limits to restrict abusive invocation patterns
- B
Increase the Lambda function timeout so legitimate users are less likely to experience failures during heavy traffic
- C
Move the image-processing logic from Lambda to an EC2 instance with a host-based firewall
- D
Store temporary upload metadata in environment variables so the function can reject repeated requests more efficiently
Show answer and explanation
Correct answer: A
Explanation
This question tests practical security assessment knowledge for serverless environments. A common risk in serverless computing is exposing functions through API endpoints without adequate access control, leading to unauthorized invocation, excessive resource consumption, and increased cloud costs. In AWS, Amazon API Gateway supports authentication and authorization mechanisms such as IAM authorization, Lambda authorizers, and integration with Amazon Cognito, along with throttling and usage plans to reduce abuse. AWS Lambda security best practices also emphasize least privilege, event-source control, and protecting public entry points. From a CEH perspective, the ethical hacker should identify that the attack surface here is not a code-execution flaw inside Lambda but insufficient protection of the trigger path. The best mitigation is to secure the API entry point and limit invocation rates rather than changing compute platforms or misusing function configuration features.
- A. Correct.
Correct. In this scenario, the primary issue is uncontrolled invocation of a serverless function via a publicly reachable API. Applying authentication/authorization at API Gateway reduces unauthorized access, while throttling and usage plans/rate limiting help mitigate abuse, excessive cost, and denial-of-wallet style attacks. This is the most direct and practical control that addresses the observed risk without abandoning the serverless design.
- B. Incorrect.
Incorrect. Increasing the Lambda timeout does not address unauthorized or abusive invocation. In fact, allowing functions to run longer can increase cost and resource consumption during abuse. Timeouts are a reliability/performance tuning parameter, not a primary security control for exposed serverless endpoints.
- C. Incorrect.
Incorrect. Moving the workload to EC2 changes the architecture but does not inherently solve the access-control problem. A public EC2-hosted application can still be abused if authentication, authorization, and rate limiting are not implemented. This option also conflicts with the requirement to preserve the serverless architecture.
- D. Incorrect.
Incorrect. Environment variables are intended for configuration, not as a durable or reliable mechanism for tracking repeated requests across Lambda invocations. Lambda execution environments are ephemeral and may be reused unpredictably, so this would not provide dependable abuse prevention. Proper request validation, authentication, and throttling are the correct controls.