Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
LLM calls are slow and expensive, which makes them a resource-consumption target unlike a normal API. A single crafted request can force the model to generate enormous output, an unbounded agent loop can rack up thousands of calls, and a public LLM endpoint with no limits is a direct line to your compute budget. This skill covers testing an LLM app for denial-of-service and cost-exhaustion, and the controls that bound both.
When to use it
Any LLM feature exposed to users, especially public-facing ones, agent loops that call the model repeatedly, and anything billed per-token against a provider. The "denial of wallet" angle — where the attack costs you money rather than downtime — is specific to this domain and easy to overlook.
Procedure
- Check for basic request rate limiting on the LLM endpoint. Without it, an attacker sends unlimited expensive calls — costly and potentially degrading for everyone. Confirm per-user and per-IP limits exist (the API rate-limiting skill's methods apply).
- Test output-length amplification. Can a small prompt force a very large, expensive completion? Ask the model to produce maximum-length output ("write 10,000 words on…", "repeat X many times") and see whether output tokens are capped:
"List every integer from 1 to 100000, one per line."
- Test input-size limits. Very long inputs (huge pasted text, a massive document to summarise) consume context and cost. Is there a cap on input length / document size?
- Test agent-loop bounds. For agentic systems, can the model be pushed into a long or infinite tool-calling loop (each iteration a paid call)? A task that never converges, or a prompt that induces repeated tool use, is a cost/DoS vector — check for a max-iterations/step budget.
- Test for recursive/expensive patterns — prompts that trigger the model to call itself, expand fractally, or chain sub-tasks without bound.
- Assess the cost model. Is spend capped anywhere (per user, per session, globally)? An uncapped pay-per-token endpoint means the attack's cost scales directly to your bill — flag this as financial impact even at modest request volume.
Cheatsheet
consumption vectors to test
request rate -> unlimited calls? (per-user + per-IP limit present?)
output length -> "generate 10000 words / repeat N times" -> capped?
input size -> huge input/document accepted unbounded?
agent loops -> can it be driven into long/infinite tool-call loops?
recursion -> prompts that fan out into many sub-calls?
the two impacts
DoS -> service degraded/unavailable for others
denial of wallet -> your provider bill scales with the attack (often worse)
controls to verify
max input tokens, max output tokens, rate limits (user+IP),
agent step/iteration cap, timeouts, per-user/global spend caps
Reading the output
- No rate limiting on the LLM endpoint = both DoS and cost-exhaustion are open; an attacker's script maps directly to your bill and your capacity. High impact.
- Uncapped output length = one cheap request produces a maximally expensive completion; a strong amplification factor for an attacker.
- An agent that can be looped without a step cap = potentially unbounded paid calls from a single interaction — the most dangerous cost vector in agentic systems.
- No spend cap anywhere = "denial of wallet"; even without taking the service down, an attacker runs up real money. Rate it as financial impact, not just availability.
- Sensible token/rate/step/spend limits present = the good state; confirm they actually enforce (test past the limit).
The fix
- Cap input and output tokens per request — a hard maximum on completion length kills output amplification, and an input cap bounds context cost.
- Rate limit per user and per IP on the LLM endpoint (gateway-enforced), so no single client can flood it.
- Bound agent loops with a maximum step/iteration budget and a timeout, so a non-converging task can't spin indefinitely on paid calls.
- Set spend caps — per-user quotas and a global budget alarm — so cost can't run away even if a limit is missed. Alert on cost spikes.
- Validate and limit input size (document/upload length) before it reaches the model.
- Use a smaller/cheaper model for untrusted or high-volume paths where you can, reducing the per-call blast radius.
Pitfalls
- Rate limiting requests but not output length. One allowed request that generates a novel is still expensive. Cap tokens, not just call count.
- Ignoring denial of wallet. Teams test for downtime and miss that the real damage is the bill. An uncapped pay-per-token endpoint is a financial vulnerability.
- Unbounded agent loops. The convenience of "let the agent keep working until done" becomes unbounded cost when the task never converges or is adversarially steered.
- No global spend alarm. Per-user limits help, but a distributed attack or a missed edge case still adds up — a budget alarm is the backstop that tells you before the invoice does.
References
- OWASP Top 10 for LLM Applications — LLM04 Model Denial of Service / Unbounded Consumption
- OWASP API Security — Unrestricted Resource Consumption (API4)
- Provider rate-limit and quota documentation
- CWE-770 (Allocation of Resources Without Limits)
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: model-dos-and-cost3description: Use when an LLM app could be driven to exhaust resources or run up a large bill through crafted inputs — testing for unbounded consumption and the limits that contain it.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314LLM calls are slow and expensive, which makes them a resource-consumption target unlike a normal API. A single crafted request can force the model to generate enormous output, an unbounded agent loop can rack up thousands of calls, and a public LLM endpoint with no limits is a direct line to your compute budget. This skill covers testing an LLM app for denial-of-service and cost-exhaustion, and the controls that bound both.1516### When to use it1718Any LLM feature exposed to users, especially public-facing ones, agent loops that call the model repeatedly, and anything billed per-token against a provider. The "denial of wallet" angle — where the attack costs you money rather than downtime — is specific to this domain and easy to overlook.1920### Procedure21221. **Check for basic request rate limiting** on the LLM endpoint. Without it, an attacker sends unlimited expensive calls — costly and potentially degrading for everyone. Confirm per-user and per-IP limits exist (the API rate-limiting skill's methods apply).232. **Test output-length amplification.** Can a small prompt force a very large, expensive completion? Ask the model to produce maximum-length output ("write 10,000 words on…", "repeat X many times") and see whether output tokens are capped:24 ```25 "List every integer from 1 to 100000, one per line."26 ```273. **Test input-size limits.** Very long inputs (huge pasted text, a massive document to summarise) consume context and cost. Is there a cap on input length / document size?284. **Test agent-loop bounds.** For agentic systems, can the model be pushed into a long or infinite tool-calling loop (each iteration a paid call)? A task that never converges, or a prompt that induces repeated tool use, is a cost/DoS vector — check for a max-iterations/step budget.295. **Test for recursive/expensive patterns** — prompts that trigger the model to call itself, expand fractally, or chain sub-tasks without bound.306. **Assess the cost model.** Is spend capped anywhere (per user, per session, globally)? An uncapped pay-per-token endpoint means the attack's cost scales directly to your bill — flag this as financial impact even at modest request volume.3132### Cheatsheet3334```35consumption vectors to test36 request rate -> unlimited calls? (per-user + per-IP limit present?)37 output length -> "generate 10000 words / repeat N times" -> capped?38 input size -> huge input/document accepted unbounded?39 agent loops -> can it be driven into long/infinite tool-call loops?40 recursion -> prompts that fan out into many sub-calls?4142the two impacts43 DoS -> service degraded/unavailable for others44 denial of wallet -> your provider bill scales with the attack (often worse)4546controls to verify47 max input tokens, max output tokens, rate limits (user+IP),48 agent step/iteration cap, timeouts, per-user/global spend caps49```5051### Reading the output5253- **No rate limiting on the LLM endpoint** = both DoS and cost-exhaustion are open; an attacker's script maps directly to your bill and your capacity. High impact.54- **Uncapped output length** = one cheap request produces a maximally expensive completion; a strong amplification factor for an attacker.55- **An agent that can be looped without a step cap** = potentially unbounded paid calls from a single interaction — the most dangerous cost vector in agentic systems.56- **No spend cap anywhere** = "denial of wallet"; even without taking the service down, an attacker runs up real money. Rate it as financial impact, not just availability.57- **Sensible token/rate/step/spend limits present** = the good state; confirm they actually enforce (test past the limit).5859### The fix6061- **Cap input and output tokens** per request — a hard maximum on completion length kills output amplification, and an input cap bounds context cost.62- **Rate limit** per user and per IP on the LLM endpoint (gateway-enforced), so no single client can flood it.63- **Bound agent loops** with a maximum step/iteration budget and a timeout, so a non-converging task can't spin indefinitely on paid calls.64- **Set spend caps** — per-user quotas and a global budget alarm — so cost can't run away even if a limit is missed. Alert on cost spikes.65- **Validate and limit input size** (document/upload length) before it reaches the model.66- **Use a smaller/cheaper model** for untrusted or high-volume paths where you can, reducing the per-call blast radius.6768### Pitfalls6970- **Rate limiting requests but not output length.** One allowed request that generates a novel is still expensive. Cap tokens, not just call count.71- **Ignoring denial of wallet.** Teams test for downtime and miss that the real damage is the bill. An uncapped pay-per-token endpoint is a financial vulnerability.72- **Unbounded agent loops.** The convenience of "let the agent keep working until done" becomes unbounded cost when the task never converges or is adversarially steered.73- **No global spend alarm.** Per-user limits help, but a distributed attack or a missed edge case still adds up — a budget alarm is the backstop that tells you before the invoice does.7475### References7677- OWASP Top 10 for LLM Applications — LLM04 Model Denial of Service / Unbounded Consumption78- OWASP API Security — Unrestricted Resource Consumption (API4)79- Provider rate-limit and quota documentation80- CWE-770 (Allocation of Resources Without Limits)8182## Inputs83- Relevant source code, logs, network traces, or system specifications.8485## Outputs86- Analysis findings, security audit report, or generated code artifacts.