CCSP Cloud Application Security Practice Question
A company is adopting a serverless architecture using AWS Lambda. The security team is concerned about potential injection attacks via event payloads. Which practice is most effective at mitigating such attacks?
⚠ Common exam trap
ISC2 often tests the misconception that perimeter controls (like WAFs) or IAM permissions are sufficient to prevent application-layer attacks, but the trap here is that injection vulnerabilities are code-level flaws that only input validation can directly remediate.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Validate and sanitize all input data from event sources
Serverless functions like AWS Lambda are directly invoked by event payloads, and without input validation and sanitization, an attacker can inject malicious code (e.g., SQL, NoSQL, OS commands) that the function executes. This is the most effective mitigation as it addresses the root cause at the application layer, regardless of any perimeter controls.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a web application firewall (WAF) in front of the API Gateway
Why it's wrong here
A WAF filters HTTP traffic at the API Gateway boundary, so it cannot inspect or sanitise the event payload once Lambda receives it; injection via direct invocation, SQS or S3 events bypasses it entirely. It is tempting because WAFs genuinely defend web-facing APIs against SQL injection and cross-site scripting at layer 7.
- ✗
Assign the least privilege IAM role to each Lambda function
Why it's wrong here
Least-privilege IAM limits which AWS resources the function can reach after compromise, but it does not neutralise malicious content inside the event payload itself. It is tempting because IAM roles are the primary blast-radius control for Lambda, and would be the right answer for containing credential or permission abuse.
- ✓
Validate and sanitize all input data from event sources
Why this is correct
Validating and sanitising event payloads strips or rejects malicious content before Lambda processes it, breaking the injection path regardless of event source. This addresses the stem's concern directly, since serverless functions cannot rely on network-layer defences to inspect event data.
- ✗
Encrypt environment variables containing sensitive configuration
Why it's wrong here
Encrypting environment variables protects configuration secrets at rest with KMS, yet the injection payload arrives through the event and is processed by code regardless of how configuration is stored. It is tempting because environment-variable encryption is a genuine Lambda hardening measure for credentials, not for untrusted input.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
Courseiva writes every CCSP question from scratch — 934 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CCSP practice question is part of Courseiva's free ISC2 certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCSP exam.