Token smuggling is a jailbreak technique in which an attacker disguises a prohibited request by encoding, splitting or transforming its text so that safety filters and the model’s own refusal training do not recognize it, while the model can still reconstruct and act on the hidden meaning. In AI security, it is also called an obfuscation jailbreak, and it targets the gap between what a filter can detect and what a capable large language model can decode.
The name reflects the mechanism: harmful content is moved past inspection in pieces or in disguise, much like contraband hidden in ordinary cargo. The attack exploits the fact that safety behavior is learned mostly from natural-language examples, whereas a strong model can understand many encodings that its safety training never covered.
How token smuggling evades safety controls
Token smuggling works because detection and comprehension are uneven. Keyword filters, safety classifiers and refusal behavior react to recognizable surface patterns, but the model can recover meaning from forms those defenses rarely see, such as encoded strings, fragmented words or text written in a rare script.
The attack usually has two parts. First, the request is transformed into an unfamiliar form. Second, the prompt instructs the model to decode, reassemble or continue the hidden content as part of an apparently harmless task, such as a translation exercise, a programming puzzle or a string concatenation. The harmful instruction exists in readable form only inside the model’s internal processing.
The technique is related to tokenization. A word broken into unusual fragments produces token sequences that differ from the ones seen during safety training, so the learned association between a dangerous topic and a refusal can weaken. This is why the attack is described in terms of tokens rather than words.
Common token smuggling techniques
Token smuggling covers a broad family of obfuscation methods, which can be combined to make detection harder. The table below describes the main categories at a conceptual level, as they appear in red teaming taxonomies.
| Technique | How it hides the request | Why filters miss it |
|---|---|---|
| Encoding | Base64, hexadecimal or ROT13 text | No readable keywords at input |
| Payload splitting | Request divided across variables or turns | Each fragment looks harmless |
| Character substitution | Homoglyphs, leetspeak, inserted spaces | Changes the token sequence |
| Low-resource language | Request translated into a rarely trained language | Safety data is mostly in English |
| Code wrapping | Request built inside a function or string operation | Looks like a programming task |
| Invisible characters | Zero-width or Unicode tag characters | Not visible to human reviewers |
Effectiveness depends strongly on model capability. A smaller model may fail to decode the payload and simply return nonsense, while a more capable model decodes it reliably, which means that stronger models can be more exposed to this class of attack unless safety training keeps pace.
Token smuggling compared with related attacks
Token smuggling is one approach within the wider set of jailbreak and injection attacks, and it is often combined with others. Its defining feature is obfuscation of the payload, not persuasion of the model or abuse of external content.
| Attack | Primary lever | Typical source of the prompt |
|---|---|---|
| Token smuggling | Obfuscated payload | The user |
| DAN jailbreak | Role-play persona overriding rules | The user |
| Multi-turn jailbreak | Gradual escalation across turns | The user |
| Prompt injection | Untrusted data treated as instructions | Documents, web pages, tools |
| Adversarial suffix | Optimized token string | Automated search |
Obfuscation also matters for indirect prompt injection. An attacker can hide encoded or invisible instructions in a web page or document that an agent later reads, so the same evasion methods support data exfiltration via prompt injection when the model has tool access.
Defending against token smuggling
Effective defense relies on layered controls, because no single filter recognizes every encoding. The guiding principle is to inspect content in the form the model actually understands, and to evaluate outputs as well as inputs.
| Control | What it does | Limitation |
|---|---|---|
| Input normalization | Decodes common encodings and strips invisible characters | Cannot anticipate every scheme |
| Safety classifier on outputs | Checks generated text after decoding | Adds latency and cost |
| Adversarial training | Includes obfuscated examples in safety data | New encodings still appear |
| Constitutional classifiers | Model-based screening of inputs and outputs | Needs continuous updates |
| Least privilege for agents | Limits tools available to the model | Does not stop harmful text |
Output-side checks are especially valuable, because the decoded harmful content must eventually appear in plain form if the attack succeeds. Combined with rate limiting, logging and regular red teaming with tools such as garak or PyRIT, they turn a single point of failure into defense in depth.
Risk assessment and common misconceptions
The practical risk of token smuggling depends on what the model can do, not only on what it can say. A chat assistant that reveals restricted text causes a content policy violation, while an agent with code execution, email or database access can turn a smuggled instruction into real actions.
Security teams therefore rate the threat by deployment context. The same obfuscated prompt carries very different consequences depending on the permissions, data and audience connected to the model.
| Deployment | Worst plausible outcome | Priority control |
|---|---|---|
| Public chat assistant | Policy-violating text shown to a user | Output classifier |
| Retrieval assistant | Disclosure of restricted documents | Access control at retrieval |
| Tool-using agent | Unauthorized actions in connected systems | Least privilege and confirmation steps |
| Internal coding assistant | Insertion of unsafe code | Code review and sandboxing |
- Misconception: a keyword blocklist is enough. Encodings bypass it by design.
- Misconception: only English filters need hardening. Low-resource languages are a known gap.
- Misconception: patched once means solved. New obfuscations emerge continually.
- Good practice: map the threat in AI threat modeling and track it against MITRE ATLAS and the OWASP lists for language models.
A plain-language summary
AI chat systems are trained to refuse harmful requests. Token smuggling tries to sneak such a request past them. The attacker hides the words in a code, splits them apart or writes them in an unusual way.
Think of a guard who checks bags for certain items. If the item is taken apart and packed in pieces, the guard may not notice. The AI can still put the pieces back together. The best protection is to check what comes out, not only what goes in.
An example from practice
A software company prepares to launch a customer support assistant that can read order records and issue refunds up to a set limit. Before release, its security team runs a two-week red teaming exercise focused on obfuscation attacks.
Testers find that the input filter blocks plain requests to reveal other customers’ data, but a request that is split across three variables and reassembled by the model passes the filter in about one of every eight attempts. Requests written in a low-resource language succeed more often still, because the filter was evaluated mainly on English text.
The team adds input normalization for common encodings, deploys a classifier that screens every response before it reaches the user, and restricts the refund tool so that it requires an authenticated order identifier. On a repeat test with 500 obfuscated prompts, no attempt leads to a data leak or an unauthorized refund, and the remaining failures are limited to harmless decoded text.