Skip to content
RCE Write-up Advanced

The Lethal Trifecta: How AI Agents With Tool Access Turn Prompt I

A hotel-finding AI agent built on Semantic Kernel passed a model-controlled parameter into a Python lambda that was then run through eval(), allowing crafted input to escape the filter and execute code on the host. A second flaw exposed a file-download helper to the model, letting a prompt write a payload into the host's Startup folder.

Engr. Ishola Follow

Published on medium.com

A Microsoft security researcher typed one sentence into a chatbot in May 2026. The chatbot was a hotel finder — the kind of demo every AI team has built a hundred times.

Engr. Ishola, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the framework built executable Python by string interpolation from model-controlled parameters and then evaluated it, with only a blocklist-style AST scan as protection.

Impact

An attacker could achieve remote code execution on the host running the agent, and in the second case write a payload into the Startup folder so it runs at login.

What the attacker needed

Agent with tool access; attacker-controlled input reaches a tool; agent can read untrusted content

The fix

Tool parameters should be strictly validated at the function signature, dangerous tools removed or gated behind human approval, and agents run with least privilege.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

An AI agent is a chatbot that can also use tools, such as searching a database or writing files. Here the agent built a small piece of Python code from whatever the user typed and then ran it, so a cleverly worded request could make the machine run the attacker's own commands instead of just a search.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.