Menu

I Fed My AI Agent a Poisoned Log Line — It Tried to Hijack Itself in 4 Minutes
📰

I Fed My AI Agent a Poisoned Log Line — It Tried to Hijack Itself in 4 Minutes

DEV Community: security·AheadKit·9 days ago
#XeaS4b43
#devtosecurity#devto#dev#agent#line
Reading 0:00
15s threshold

Last week I read about a lab experiment where a prompt injection was hidden inside an ordinary application log, and several AI models abandoned their task and followed the injected instruction instead. I had two reactions. The first was: that is a neat attack. The second was: I bet my own little agent setup would fall for it too.

So I tested it. On purpose. In a sandbox, against my own code, with nothing real at stake. This is the story of what happened, and the one-line fix that stopped it.

The setup

I have a small coding agent wired up to a toy web app I use for experiments — a fake shop with a product list, a cart, and a log file. The agent's job is simple: read the log, find errors, and suggest fixes. It has one tool that lets it run shell commands to inspect the app.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.