low severityCurated advisory

Token cost amplification via context flooding

Attackers can craft content that causes AI agents to consume excessive tokens — by inserting large files, repetitive instructions, or recursive prompts that bloat the context window. This inflates API costs and can cause rate-limit denial of service.

Key facts

Token cost amplification via context flooding is a low-severity AI agent security threat targeting context window, model API costs, rate limits, agent response time. Keep Guard enabled for supported risky actions that can introduce unnecessary content, but do not rely on Guard as a token meter or context-window limiter. Use model-provider or harness token and context controls where those controls exist.

4 affected surfacesLast updated Jun 26, 2026
Affected surfacescontext windowmodel API costsrate limitsagent response time
The attack

What happens

An attacker crafts content that causes the agent to consume excessive tokens — by embedding large base64 blobs, repetitive instructions, or recursive prompts that cause the agent to re-read the same files. This inflates API costs and can trigger rate limits.

Step by step

How the attack unfolds

1Attacker creates a file or issue with a large base64-encoded blob.
2Agent reads the file, causing the context window to fill with the blob data.
3Agent attempts to process the large content, consuming many tokens for the response.
4Each subsequent turn re-sends the large context, amplifying token costs.
5API costs spike and rate limits may be triggered.
Example

What it looks like in practice

Scenario

A developer asks Claude Code to review a file that contains a 500KB base64-encoded "image". Claude reads the file, and the entire base64 blob enters the context window. On every subsequent turn, the blob is re-sent to the API, consuming 125K tokens per turn. After 10 turns, the developer has spent $50 on a single session.

Detection

Detection and Guard coverage

Guard can warn or block supported risky file reads and other supported actions before side effects, but that is not the same as measuring LLM token consumption.
Current Guard product evidence does not establish per-session token metering, a high-entropy file detector, or a repetitive-content detector as shipped controls.
Use model-provider or harness usage telemetry for token consumption and context-budget evidence where available.
Mitigation

How to stop it

Recommended action

Keep Guard enabled for supported risky actions that can introduce unnecessary content, but do not rely on Guard as a token meter or context-window limiter. Use model-provider or harness token and context controls where those controls exist.

Guard configuration
Use Protection Center to review which Guard controls are active on this device.
Use `hol-guard command controls status` and `hol-guard command controls list` to inspect the active local control catalog.
Guard coverage is action- and harness-specific. Do not treat an advisory label as a configurable Guard setting unless it appears in the current control catalog.

Related threat guides

Use the protections Guard supports here

Guard can review or block supported actions for this threat. The advisory above calls out what Guard covers and where other controls are still needed.