๐ What Is It?
Unbounded Consumption occurs when an app lets clients drive a model to perform inference - and spend compute, memory, time, and money - without effective limits. The 2025 edition merges the old Model DoS and Model Theft entries: both share one root cause, inference proceeding without bounds. Exploitation needs no jailbreak and often no authentication - only the ability to send requests. LLM economics make it potent: a short prompt can command an enormous, expensive response (asymmetric cost), and transformer attention scales roughly with the square of sequence length (superlinear).
โ๏ธ Three Harm Axes
- Denial of Service (DoS): resource exhaustion degrades/halts the service for real users.
- Denial of Wallet (DoW): on metered/autoscaling infra the attack wins even while the service stays up - it just generates a ruinous bill.
- Model theft / extraction: unlimited querying lets an attacker distill a "student" clone or infer training-data facts - no weight file stolen.
โ ๏ธ Top Attack Vectors
- Long-input / context stuffing: few requests, each a max-length prompt โ superlinear GPU cost.
- Unbounded output: "count to 1,000,000",
max_tokens: null. - Agentic fan-out: one request spawns thousands of sub-agent inferences.
- Sponge examples: inputs crafted for worst-case compute; defeat request-count limits.
- Concurrency abuse: stay under req/min but fire all in parallel to saturate workers.
- Model extraction: harvest I/O pairs at scale to train a functional clone.
๐ด Attack Flow
โ
2. Pick a lever - the unbounded dimension with the best cost-amplification ratio
โ
3. Amplify - volume ร cost-per-request ร concurrency
โ
4. Evade - spread across keys/IPs, or make few requests maximally expensive
โ
5. IMPACT: outage (DoS), ruinous bill (DoW), or a model clone (Theft)!
โ Vulnerable Code (FastAPI gateway)
โ Secure Code (bounded gateway)
โ Prevention Checklist
- Cap input size - byte cap at the edge and token count on the whole prompt (history + RAG)
- Server-enforced
max_tokenson every generation; clamp the client's value, never trust it - Rate limit per identity (user/key/tenant), not just per IP
- Token and spend quotas - request count alone doesn't bound cost
- Cap concurrency (per-identity and global); timeouts + circuit breaker on every call
- Per-tenant cost budget checked before the call, behind a provider hard billing cap
- Bound agent/tool fan-out: hard step, depth, and shared-token budgets
- Require auth so usage is attributable and boundable per identity
- Meter actual tokens/cost; detect extraction sweeps; withhold logprobs from untrusted callers
- Degrade gracefully - shed load with clear 429/402/503, never collapse or overspend