Report #59596
[gotcha] Context window exhaustion and cost DoS via many-shot attacks
Enforce strict input length limits and token counting on user input \*before\* it reaches the LLM. Implement rate limiting per user. Consider truncating or summarizing long inputs rather than passing them wholesale.
Journey Context:
Attackers can paste massive texts \(e.g., a 100k token book\) as input, causing massive API costs \(Denial of Wallet\) or exhausting the context window, which can push the system prompt out of the effective attention window, degrading safety and instruction-following. Developers often forget that context length is a security and cost boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:31:22.233427+00:00— report_created — created