LLM Security: Discovering and Mitigating Repeated Token Attacks in Production Models

dropbox · Tech · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: LLM application security

Dropbox needed to understand and mitigate repeated-token attacks against ChatGPT-family models used in AI-powered product features, including attacks that could bypass provider-side filtering, extract memorized training data, and create expensive long-running requests.

Constraints:

Architecture

Dropbox treated repeated-token behavior as an adversarial security-testing problem: researchers reproduced prior single-token divergence attacks, searched for multi-token repeat sequences that still induced model divergence, validated training-data extraction on GPT-3.5 and GPT-4, measured long-running request behavior, disclosed the findings to OpenAI, and translated the results into practical mitigations such as broader repeated-token filtering, prompt-input sanitization, max_tokens limits, server-side timeouts, and a planned LangChain-compatible detector.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  A["Repeated-token prompt generator"] --> B["OpenAI chat-completion models"]
  B --> C["Divergence output analyzer"]
  C --> D["Training-data match verifier"]
  B --> E["Resource-exhaustion probe"]
  C --> F["Provider mitigation channel"]
  F --> G["Repeated-token detector"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Repeated-token prompt generator Constructs adversarial prompts with repeated single-token or multi-token sequences for security testing. OpenAI chat-completion models, Divergence output analyzer
OpenAI chat-completion models Target GPT-3.5 and GPT-4 model endpoints tested for divergence, training-data extraction, and long-running responses. Repeated-token prompt generator, Divergence output analyzer, Resource-exhaustion probe
Divergence output analyzer Inspects model responses for ignored instructions, hallucinations, and memorized training-data snippets. OpenAI chat-completion models, Training-data match verifier, Provider mitigation channel
Training-data match verifier Compares model outputs against source documents such as jq documentation and Bible passages to assess memorization. Divergence output analyzer
Resource-exhaustion probe Measures long-running repeat requests, timeout behavior, and token-stream length for denial-of-service risk. OpenAI chat-completion models
Provider mitigation channel Carries responsible disclosure to OpenAI and receives confirmation and remediation behavior. Repeated-token detector
Repeated-token detector Planned LangChain-compatible mitigation component for detecting repeated-token attacks in internal LLM applications. Provider mitigation channel

Data flow

Researchers constructed prompts containing repeated token or multi-token sequences, sent them through OpenAI chat-completion models, inspected the outputs for divergence, hallucination, memorized-data matches, or timeout behavior, compared extracted text against public source material, disclosed confirmed findings to OpenAI, and updated mitigation guidance and tooling around repeated-token detection and resource limits.

4 supporting quotes
“Dropbox used repeated multi-token (>1) sequences to induce divergence in ChatGPT models and demonstrated extraction of memorized training data from both GPT-3.5 and GPT-4.”article, stated
“This blog will discuss the steps taken to execute the repeated token attack on ChatGPT models at various points from October 2023 through March 2024”article, stated
“Given it is extremely unlikely that GPT-3.5 would randomly generate output matching over 100 sequential cl100k_base tokens”article, stated
“Following the discovery and documentation of the ChatGPT training data extraction vulnerability, we formally shared our results with OpenAI via disclosure@openai.com on January 24, 2024.”article, stated

Why this architecture

The research architecture mirrors the attack surface: repeated-token sequences had to be generated at the tokenizer/prompt layer, responses had to be evaluated against memorization and resource-exhaustion criteria, and mitigations had to live both at provider-side filters and at application-side input controls because Dropbox could not assume third-party model security was complete.

4 supporting quotes
“The security of OpenAI’s models are of particular importance to Dropbox, as we currently use them to provide AI-powered features to our customers.”article, stated
“Further Dropbox security research conducted internally in October 2023 suggested that the repeated character sequence attack was due to the presence of repeated tokens within the textual ChatGPT model prompt”article, stated
“OpenAI implemented filtering of prompt inputs containing repeated single tokens.”article, stated
“Organizations that choose to adopt internally-hosted LLMs will need to assume and address the risks that go along with maintaining bespoke solutions.”article, stated

Models used: GPT-3.5 · GPT-4 · gpt-4-32k

Scale

Alternatives considered (roads not taken)

Rely only on provider-side single-token repetition filtering

Rejected because: Dropbox showed that the single-token filter left multi-token repeats able to induce divergence and extract memorized data.

“The OpenAI filtering strategy focused on the repetition of single tokens, which reflected the emphasis of the Scalable Extraction paper”article, stated
“However, Dropbox discovered that multi-token repeats can also elicit model divergence and training data extraction from GPT-3.5.”article, stated

Treat repeated-token behavior as only hallucination or prompt-injection weirdness

Rejected because: The research connected divergence to memorized training-data extraction and resource exhaustion, requiring security controls rather than merely prompt-tuning.

“This divergence can yield hallucinatory responses—similar to those previously discovered by Dropbox—and can even contain memorized ChatGPT training data.”article, stated

Depend on proxy timeouts for long-running repeat requests

Rejected because: Dropbox recommended application-side sanitization and max_tokens limits because requests could still consume substantial model-side work before timing out.

“It is necessary to mitigate prompt inputs that might inadvertently incur expensive computational workloads, or allow an attacker to execute a denial of service or resource exhaustion attack.”article, stated

Patterns

safety-policy-enforcement (security)

Dropbox turned repeated-token research into concrete safety controls: broader provider-side filters for multi-token repeats, application-side input sanitization, and a planned detector for internal model assets.

“OpenAI updated their filtering strategy to block prompts with multi-token repeats on January 29, 2024”article, stated
“Dropbox plans to publicly release its internal repeated tokens detector, which we hope will assist AI/ML practitioners in mitigating prompt injection and data extraction attacks”article, stated

eval-driven-development (evaluation)

The team used adversarial experiments as an evaluation harness for model-security behavior, repeatedly probing GPT-3.5 and GPT-4 before and after provider mitigations.

“This blog will discuss the steps taken to execute the repeated token attack on ChatGPT models at various points from October 2023 through March 2024”article, stated
“The repeated tokens script in our Github repository can be used to find additional combinations of tokens that can produce similar results for GPT-4”article, stated

privacy-preserving-processing (security)

Training-data extraction was treated as a privacy risk because divergence could reveal memorized content including PII, making leakage prevention part of the deployment threat model.

“The paper goes on to demonstrate a model training data extraction attack using the repetition of a single token to induce GPT-3.5 to reveal non-trivial stretches of memorized training data, including PII”article, stated

guardrails-io-filtering (security)

The mitigation path moved from narrow single-token filtering to broader repeated-sequence controls and application-level sanitization of prompt inputs.

“This was the first observed security control deployed by OpenAI to mitigate the effect of repeated tokens within ChatGPT model prompts.”article, stated
“It is necessary to mitigate prompt inputs that might inadvertently incur expensive computational workloads, or allow an attacker to execute a denial of service or resource exhaustion attack.”article, stated

Tradeoffs

Use adversarial security probing against third-party model endpoints

Chose Directly test provider-hosted GPT-3.5 and GPT-4 behavior with repeated-token prompts over Assuming provider alignment and filtering controls fully covered the risk.

Rationale: Direct testing revealed both GPT-3.5 and GPT-4 extraction paths after the initial provider-side single-token mitigation.

“Dropbox discovered other avenues still remained to execute the divergence attack—and also extract memorized ChatGPT training data for both GPT-3.5 and GPT-4.”article, stated

Mitigate both content leakage and resource exhaustion

Chose Input sanitization and max_tokens limits alongside repeated-token filtering over Treating the vulnerability only as a data-extraction issue.

Rationale: The same family of repeated-token prompts could cause long-running expensive requests, so production controls needed cost and availability protections too.

“Dropbox believes the potential for long-running requests is another security consideration when building ML-powered applications using ChatGPT models.”article, stated
“It is necessary to mitigate prompt inputs that might inadvertently incur expensive computational workloads, or allow an attacker to execute a denial of service or resource exhaustion attack.”article, stated

Coordinate disclosure before publication

Chose Responsible disclosure to OpenAI with a requested disclosure window over Immediate public release of vulnerability details.

Rationale: The approach let OpenAI confirm the vulnerabilities and deploy broader filtering before Dropbox published the research.

“OpenAI requested a 90-day disclosure period to confirm and, if necessary, address the security gaps we disclosed.”article, stated
“They soon confirmed our GPT-3.5 and GPT-4 findings were indeed training data extraction vulnerabilities.”article, stated

Gotchas (what bit them)

A mitigation copied from published research can miss nearby attack variants.

Root cause: OpenAI's first repeated-token filter focused on repeated single tokens, while Dropbox found repeated multi-token sequences could still trigger divergence.

Resolution: Extend filtering to multi-token repeats and keep adversarial regression tests around the broader class of token-repetition attacks.

“The OpenAI filtering strategy focused on the repetition of single tokens, which reflected the emphasis of the Scalable Extraction paper”article, stated
“OpenAI updated their filtering strategy to block prompts with multi-token repeats on January 29, 2024”article, stated

Prompt-injection anomalies may hide a training-data-extraction vulnerability.

Root cause: Repeated tokens can make chat models diverge from aligned dialogue behavior and revert toward lower-level language-modeling behavior.

Resolution: Evaluate suspicious prompt behaviors for memorized-data leakage, not only for instruction-following or hallucination failures.

“The curious and unexpected LLM responses described in previous Dropbox research—and originally thought to be hallucinations—appear to be a similar phenomenon as the model "divergence" detailed by Nasr, Carlini, et. al.”article, stated

Short adversarial prompts can become expensive resource-exhaustion requests.

Root cause: Certain repeat instructions caused GPT-4 requests to run for ten minutes and stream thousands of tokens before timing out.

Resolution: Sanitize prompt input and set max_tokens limits so applications do not rely solely on upstream proxy or server timeouts.

“requests for GPT-4 to repeat certain phrases timed out after ten minutes.”article, stated
“It is necessary to mitigate prompt inputs that might inadvertently incur expensive computational workloads, or allow an attacker to execute a denial of service or resource exhaustion attack.”article, stated

Third-party model security does not remove the application owner's security-testing responsibility.

Root cause: Dropbox depended on OpenAI models for customer-facing AI features, but vulnerabilities still existed in the provider model behavior.

Resolution: Run internal LLM security research and threat modeling even when using well-resourced external model providers.

“The security of OpenAI’s models are of particular importance to Dropbox, as we currently use them to provide AI-powered features to our customers.”article, stated
“Even when using models from well-resourced providers like OpenAI, security vulnerabilities can exist and persist. Organizations must conduct their own security testing.”summary, stated

Evaluation

Dropbox evaluated repeated-token attacks by executing controlled prompts against GPT-3.5 and GPT-4, checking whether model outputs diverged from expected chat behavior, matching generated spans against known source documents, recording timeout and token-stream behavior, and verifying whether provider filtering changed after disclosure.

Metrics: Number of repeated tokens or token pairs needed to induce divergence · Sequential cl100k_base token matches against source material · Presence of memorized training-data excerpts in model output · Request timeout duration and streamed token count · Provider filtering behavior before and after mitigation

3 supporting quotes
“These are numbered as in the figure above and contain non-trivial stretches of identical text—the number of matching tokens is shown in parentheses.”article, stated
“Given the 32K token window for this GPT-4 model—and that only one-third of the streamed response was obtained—the full request might have taken a total of thirty minutes on the OpenAI server side”article, stated
“We found that OpenAI updated their filtering strategy to block prompts with multi-token repeats on January 29, 2024, as shown below.”article, stated

Outcomes

The strongest operating-scale signals are in the attack parameters: thousands of repeated tokens, 32K-token GPT-4 context windows, more than 10,700 streamed tokens before timeout, and a 90-day disclosure process.

3 supporting quotes
“OpenAI updated their filtering strategy to block prompts with multi-token repeats on January 29, 2024”article, stated
“OpenAI also implemented a server-side timeout for long running ChatGPT requests, which now returns a server message.”article, stated
“Being worthy of our customers’ trust remains at the core of everything we do. Dropbox plans to publicly release its internal repeated tokens detector”article, stated