AI agent security
Kaggle, AI Agent Security: Multi-Step Tool Attacks. Solo entry, bronze medal, 260th of 4,186 teams, 2026.
The problem
An AI agent that can read pages and send email can be misled in steps. Something it reads early on can shape an action it takes later. The competition asked for an algorithm that finds these failures in a sandbox with synthetic data and no real targets.
Every failure was run again from scratch, and only the ones that repeated counted. The final score used a defence that nobody could see.
What I did
- Read the scoring code first. Speed of replay mattered as much as severity, which changed what a good attack looked like.
- Built a set of plausible defences from the public one, and tested which attacks worked across all of them.
- Ranked strategies by a cautious estimate of score per second, so one lucky run couldn't dominate.
- Sized each submission from measured response times rather than a fixed count.
The final version ran as a loop under a fixed time budget. Every attack it kept had to work again from scratch.
- Probe
Try each attack strategy briefly.
- Measure
Which attacks score, and how long each takes to replay.
- Rank
By a cautious estimate of score per second.
- Size
Fit the batch to the time budget, using slow-case replay times.
- Generate
A varied set, so attacks don't all fail the same way.
- Replay
Each attack runs again from scratch. Only repeats count.
- Python
The real defence was hidden, so I built five plausible versions of it and replayed every attack against each, on both models.
| Attack | Content onlyNo tracking of where data came from | Last 5 stepsRecent untrusted reads count | Whole sessionAny untrusted read counts | Data flowTracks what was derived from what | Whole session + exact contactsPlus a strict recipient list |
|---|---|---|---|---|---|
| Direct email to a known contact | Scores | Scores | Scores | Scores | Scores |
| Web page then HTTP post | Scores | Blocked | Blocked | Blocked | Blocked |
| Web page then shell command | Scores | Blocked | Blocked | Blocked | Blocked |
| Web page then file write | Scores | Blocked | Blocked | Blocked | Blocked |
| Web page then email | Scores | Blocked | Blocked | Blocked | Blocked |
| Send secrets out | Blocked | Blocked | Blocked | Blocked | Blocked |
| Destructive write | Blocked | Blocked | Blocked | Blocked | Blocked |
Only the direct email survived all five, so the entry was built around it. These five defences are my reconstruction of the hidden one.
What I found
Defences that look for words such as "send" or "run" are easy to switch on or off by rephrasing. Tracking where data came from, all the way through a session, was the strongest control in the benchmark. It still missed one case: a single harmless-looking outgoing action with nothing suspicious before it.
What didn't work
An early version sent messages to made-up recipients. Under a strict contact list every one would be refused, so I switched to contacts already in the test data. I also settled on single actions too early and had to go back to packing several together.
Each version tested one idea about what makes an attack count. The public board was a development signal; the final ranking used a hidden defence.
Final private score: 12.54, 260th of 4,186, bronze. It was scored against the hidden defence, so it can't be compared with the public scores.
Limits
This was an offline benchmark. My view of the hidden defence was an informed guess, and the real one could have been stricter than anything I tested.