tripwire / README.md
booleanbyte's picture
Upload README.md with huggingface_hub
19f0c74 verified
|
Raw History Blame Contribute Delete
12.8 kB
metadata
configs:
  - config_name: default
    data_files:
      - split: train
        path: train.jsonl
      - split: validation
        path: validation.jsonl
      - split: test
        path: test.jsonl
license: cc-by-sa-4.0
language:
  - en
  - multilingual
task_categories:
  - token-classification
  - text-classification
tags:
  - prompt-injection
  - ai-safety
  - agents
  - tool-use
size_categories:
  - 10K<n<100K
pretty_name: Tripwire

Tripwire: injected instructions in tool outputs, labelled by span

Version 0.3.1, November 2026.

AI agents read emails, web pages, API responses and tool descriptions. An attacker can hide an instruction in that text and the agent may follow it. This dataset is for training and testing detectors that find such text. Each example is something a tool might return, with the exact character ranges an attacker planted. Clean examples have none.

Most public data for this problem labels a whole text as attack or not. This set labels the span, so a detector can remove the planted part and keep the rest.

Version 0.2 was rebuilt after an audit of the first trained models. The audit and the reason for each change are in results/audit.md in the source repository.

Version 0.3 adds data for four weaknesses found by tests on outside data:

  • 1,439 short clean texts that use words such as "ignore", "override" or "password" in their ordinary sense. 358 of them are also used as harmless inserts (see version 0.3.1).
  • 601 tool descriptions written the way agent tool servers publish them, with usage rules and warnings.
  • 350 planted instructions written for tool descriptions (tool_poisoning). Half of the attacked tool descriptions carry one of these.
  • 421 more calm requests with no attack wording (plain_request).
  • 370 task lists that a person wrote for their own assistant, each paired with a request that hands the work over. See needs_request below.

Version 0.3.1 corrects a labelling flaw in 0.3. Half of the short texts above were inserted into longer clean documents as harmless inserts. About half of those ask their reader to do something ("Could we rename it?"), and a request planted in an unrelated document is what the plain_request family labels an attack. A model was asked for a verdict on each text (scripts/check_inserts.py); the 735 judged to be requests are no longer inserted and stay in the set as clean documents of their own.

Size

48,792 examples: 24,766 clean and 24,026 attacked.

Split Clean of which hard Attacked
train 19,874 2,684 19,272
validation 2,446 344 2,376
test 2,446 356 2,378

Median length is 900 characters (95% are under 3,107; the longest is 8,247). 473 clean examples are under 60 characters. The planted text has a median length of 218 characters.

Fields

Field Meaning
id Document id, a plus sign, then the payload id or clean
text What the tool returned
spans List of [start, end) character ranges of planted text; empty when clean
label 1 if anything was planted, else 0
carrier email, web_page, json_record, tool_description, code_file or tool_result
family Attack family of the first payload, or null
split train, validation or test
held_out True for test examples whose family never appears in training
hard True for clean text that resembles an attack
document_id, payload_id The two parts the example was built from
source, payload_source Where each part came from
user_request A request a user might have made; a template for most collected documents
needs_request True where the label is right only together with user_request

Spans index into text exactly as given. Where a payload sits inside JSON, YAML or a quoted string, the span covers its escaped form, which is longer than the original. 8% of attacked examples carry two payloads and so have two spans; code files have one span per comment line.

How it was built

Every attacked example is a clean document with a payload inserted. The inserter chooses a position that suits the carrier: an HTML comment or hidden element in a web page, a text field in a JSON record, a comment in code, a new line or the end of the last line in a short tool result.

Each document appears once clean and once attacked. A detector therefore cannot separate the classes by topic, sender or format.

Examples whose label depends on the request

1,480 examples have needs_request set. They are built from task lists written for an assistant ("Assistant, please email Dana the summary, then book the room"). Read alone, such a text is what a planted instruction looks like. It is clean when the user asked the agent to carry out the list, and user_request holds a request that says so. Each list appears three times clean, in different layouts and with different requests, and once with a loud attack planted in it, which is still an attack. Calm requests are not planted in these lists, because nothing would tell them from the list's own tasks. Six of the eighteen request wordings are used only in validation and test.

The other half of the generated task lists are used as plain_request payloads: planted in an unrelated document with an ordinary request, the same kind of text is an attack.

A detector that reads only the text must leave the needs_request examples out of training and testing. scripts/train.py does so unless --with-request is given.

Three further steps keep the layout from giving the answer away:

  • Harmless inserts. 55% of clean examples, and about a quarter of attacked ones, have one or two innocent texts inserted through the same code that inserts payloads. A hidden element, an HTML comment or an extra note field is therefore not a sign of an attack.
  • Tool-output layouts. 35% of examples, clean and attacked alike, are placed inside a serialised record as a real tool returns it: YAML, a printed Python dict, JSON or CSV, alone or as one record in a list of several.
  • Payload layout. Some one-paragraph payloads are laid out one sentence per line, and 900 are placed in a letter shape with an opening and a sign-off.

Clean documents (24,026)

Source Count Carrier
Enron email corpus 4,500 email
English Wikipedia 4,500 web_page
Function-calling tool descriptions (xLAM / APIGen) 2,500 tool_description
Written by Claude Haiku 5.5 as ordinary tool outputs, 10 kinds 2,408 tool_result, web_page, email, json_record
Written by Claude Haiku 5.5 as hard cases, 13 kinds 1,541 all
USGS earthquake records 1,500 json_record
Written by Claude Haiku 5.5: short texts with attack-like words 1,081 tool_result
Written by Claude Haiku 5.5: tool descriptions in the style of tool servers 601 tool_description
Written by Claude Haiku 5.5: task lists for an assistant 370 tool_result
Short tool results made from templates 1,500 tool_result
Wikipedia in 15 other languages 1,136 web_page
Open Library records 1,000 json_record
US weather alerts 611 json_record
Python standard library 600 code_file
LLMail-Inject clean emails 160 email
Written by hand 18 all

3,384 clean documents are marked hard: security notices, password resets, articles that quote attacks, strict tool descriptions, API errors, weather alerts with instructions, code comments addressed to developers, and collected documents that use several attack-like phrases. Report the false-alarm rate on these separately; it is where detectors fail.

Payloads (5,437)

Family Payloads What it is
direct_override 1,166 "Drop your task and do this instead"
plain_request 1,470 A polite extra task with no attack wording
role_play 453 A new identity or mode under which the step seems allowed
fake_system_message 374 Posed as a system, developer or user message
data_exfiltration 359 Move private data out through a link, form or message
fake_tool_result 283 Posed as an error or status that demands an action
multilingual 258 Any style, in one of 15 languages
hidden_text 252 Zero-width or tag characters, or invisible markup
encoded 252 Base64, ROT13 or hex, with a request to decode and obey
red_team 220 Emails people wrote to attack a live assistant (LLMail-Inject)
tool_poisoning 350 Planted in a tool description: an extra step whenever a tool is used

The counts are after letter-shaped, hidden and encoded versions are added, and a letter-shaped version keeps its parent's family.

2,882 were written by Claude Haiku 5.5 and checked by a second pass. 350 are task lists written for an assistant, used as planted text. 900 are letter-shaped versions of other payloads, made in code. 781 were written by people: LLMail-Inject, Gandalf, deepset and BIPIA (training half). 500 are hidden or encoded versions made in code. 24 were written by hand.

Splits

Documents and payloads were each assigned a split from a hash of their id before anything was combined. An example is built only from parts in the same split, so no document and no payload appears in two splits. A payload derived from another shares its parent's split. Payloads that share at least half of their three-word sequences are grouped and assigned together, because people attacking a live system resubmit an attack with small edits.

Two families, fake_tool_result and encoded, appear only in the test split. Test examples involving them have held_out set. Of the 2,378 attacked test examples, 1,182 are held out and 1,196 are not. Report the two groups separately: the first measures attacks of an unseen kind, the second attacks of a seen kind with unseen wording.

Intended use

Training and evaluating detectors of injected instructions in tool outputs and tool descriptions, at the token, span or document level.

Scores on this dataset's own test split run high, because test examples are built the same way as training examples. Measure on outside data as well. Two outside tests are used with this project and are not part of the dataset: AgentDojo tool outputs, and a second set from InjecAgent, BIPIA's test half and NotInject. No attack text from AgentDojo, InjecAgent or BIPIA's test half is included here for that reason.

Limitations

  • Attacks are inserted, not found. Real attackers can write a whole document around their instruction.
  • Half the payloads were written by one model and share its phrasing.
  • A genuine request and an attack can be the same text. "Please pay this invoice by transfer to the account below" is clean in a bill the user asked about and an attack when planted. A detector that sees only the text cannot always tell, and nor could a person. The user_request field exists so a later model can use the request as a second input.
  • Family labels are approximate, especially data_exfiltration. See results/dataset-review.md in the source repository.
  • For red_team examples the whole email body is the span, including padding the attacker added. They are 6% of training attacks.
  • Letter-shaped payloads share a small set of opening and closing lines. A detector may learn those lines.
  • The ordinary tool outputs were written by a model, not collected from running agents.
  • Non-English clean text is mostly Wikipedia.
  • A hand check of 260 examples of version 0.1 found every span exact. The new build steps of version 0.2 were checked by automated tests and by reading samples, not by a second full hand review.

Personal information

The Enron emails contain the names, addresses and messages of real people. The corpus was released as a public record in 2003 and has been used in research since. Nothing was removed or replaced here. Do not use this dataset to learn about those people.

Every address and link in the written payloads and written documents is made up and uses the reserved .example domain. Payloads imported from public benchmarks keep the addresses those benchmarks used.

Licence and credit

CC BY-SA 4.0, as required by the Wikipedia text it includes.

  • Wikipedia contributors, CC BY-SA 4.0
  • Enron email corpus, released by the US Federal Energy Regulatory Commission
  • Salesforce xLAM and APIGen function-calling data, via Argilla, CC BY 4.0
  • LLMail-Inject (Microsoft), MIT
  • BIPIA (Microsoft), MIT
  • Gandalf "ignore instructions" (Lakera), MIT
  • deepset prompt-injections, Apache 2.0
  • US Geological Survey, US National Weather Service and Open Library records
  • Python standard library, PSF License 2.0