π What Is It?
Denial of Service & Financial Resource Exhaustion is what happens when the two properties that make serverless attractive-it scales automatically and you pay per use-are turned against you. Because functions scale out on demand, an attacker can exhaust the finite concurrency your account is allowed and starve legitimate traffic (a classic DoS). Because every invocation and millisecond is billed, that same flood becomes a financial attack-the platform keeps scaling and keeps charging, and the bill is the damage. This serverless-specific variant is called Denial of Wallet (DoW). The root cause is the accumulated absence of limits: no concurrency caps, no rate limiting, oversized timeouts/memory, self-triggering event loops, and no cost controls.
β οΈ Common Exploits
- Unthrottled Public Endpoint: Anonymous, no API key, no WAF-replayed as fast as bandwidth allows
- Maximally Expensive Invocation: Inputs that drive the long timeout & max memory
- Recursive Loop: S3 write triggers a function that writes back to the same bucket
- Fan-Out Amplification: One message expands into many via SNS/EventBridge
- Retry/Poison Message: Fails after expensive work; re-billed on every redelivery
- Downstream Exhaustion: Drains a DB connection pool or metered API
- Neighbour Starvation: Flooding one uncapped function throttles the whole account
π΄ Attack Flow
(public endpoint, writable event source, self-loop)
β
2. Make each unit expensive
(large payloads, long timeouts, big memory)
β
3. Amplify - recursion, fan-out, retry storms
(invocations multiply for you)
β
4. Let auto-scaling do the damage
(concurrency drains AND the bill climbs)
β
5. IMPACT: Every function throttled (DoS) + bill explodes (DoW)!
β Vulnerable Code
β Secure Code
β Prevention Checklist
- Set per-function reserved concurrency caps
- Know your account/region concurrency limit & headroom
- Throttle + quota public endpoints (API Gateway)
- Add a WAF rate-based rule at the edge
- Use short timeouts; right-size memory
- Enforce payload size & pagination limits
- Separate input/output prefixes; recursion guards
- Cap retries; use dead-letter queues (DLQs)
- Timeout & circuit-break downstream calls; pool connections
- Set AWS Budgets + Cost Anomaly Detection
- Alarm on invocation count & estimated charges
- Require auth on non-public functions
π Detection & Tools
Limits & Edge Controls:
Cost & Observability:
How to Test:
- Confirm each function has a
reservedConcurrencycap - Check public endpoints for throttle, quota, and WAF rules
- Audit timeouts/memory for "just in case" oversizing
- Trace event topologies for self-triggering loops
- Verify DLQs and finite
maxReceiveCounton queues - Confirm Budgets + invocation/billing alarms exist and page
π Real-World
Described as incident classes-patterns repeatedly observed and documented across the industry; no dollar amounts or invocation counts are asserted, the lesson is the mechanism:
- Denial-of-Wallet Cost Spike: A public function with no rate limiting, no reserved concurrency, and no cost alerting; automated abuse drives invocations up by orders of magnitude and the impact accrues unnoticed until it appears on the invoice. Developers have repeatedly reported unexpectedly large bills from this class of abuse.
- Concurrency-Exhaustion DoS: With no per-function cap, one flooded or looping function consumes the entire shared pool and throttles unrelated functions-"noisy neighbour" starvation.
- Recursive Event-Source Loop (Self-Inflicted): The classic S3βLambdaβsame-bucket loop; a single event self-amplifies. Cloud providers now explicitly warn about it and offer built-in recursive-invocation detection.
π Quick Tips
- DO NOT deploy public functions with no concurrency cap
- DO NOT write output back into a trigger source
- DO NOT max out timeout/memory "just in case"
- DO throttle at the edge and API layer
- DO cap retries and use DLQs
- DO bound cost with Budgets & alarms
- DO remember alerts notify - caps enforce
π Compliance
Related Standards:
- OWASP API Top 10 - Unrestricted Resource Consumption
- NIST 800-53 SC-5 - Denial of Service Protection
- CIS AWS Foundations Benchmark
- AWS Well-Architected - Cost & Reliability
- SOC 2 A1.1 - Availability