Agent incident database
Semantic Kernel: prompt injection could turn an agent tool into host code execution
6 Feb 2026Microsoft · Semantic Kernel (.NET SDK)unauthorised code executiondisclosed vulnerability
A file-download function in Microsoft's Semantic Kernel agent framework was accidentally exposed to the AI model as a tool, letting it write files anywhere on the host machine. Microsoft showed how injected instructions could use this to plant a script that runs at the next login.
How it unfolded
Each step on its own looked like ordinary agent work. The harm came from the sequence.
- 1
Read content containing injected instructions
- 2
Model chose to call the agent's code tools as instructed
- 3
Ran code in the sandbox that created a malicious script
- 4
Copied the script from the sandbox to the host's Windows Startup folder
harm - 5
Script ran on the host at the next user sign-in
harm
Which policy would have stopped this?
In our reading of the reports, these policies from the open library stop the harmful step before it runs.
- Code execution requires a preceding gate: Running code the injected instructions asked for needs an approval gate first.
- External content taint: high-impact actions require a fresh gate: The instructions came from content the agent read. After reading external content, a high-impact step needs a fresh approval.
Open Code execution requires a preceding gate in the playground and build the path yourself.
This is our reading of public reporting. We haven't run it against the original systems.
What happened
CVE-2026-25592, published on 6 February 2026, affects the SessionsPythonPlugin in the Semantic Kernel .NET SDK before version 1.71.0. The DownloadFileAsync method had been marked with a [KernelFunction] attribute, which advertised it to the model as a callable tool with a model-controlled localFilePath parameter and no path validation. In the attack chain Microsoft described on 7 May 2026, one injected prompt makes the agent use ExecuteCode to create a malicious script inside the code sandbox. A second makes it call DownloadFileAsync to copy that script to the host's Windows Startup folder, where it runs at the next user sign-in. Microsoft disclosed a related flaw, CVE-2026-26030, in which the Python SDK's in-memory vector store built a filter with eval() from model-controlled input.
Outcome
Microsoft fixed it in Microsoft.SemanticKernel.Core 1.71.0 by removing the attribute so the model can no longer call the function, and added path validation; the related Python flaw is fixed in semantic-kernel 1.39.4. Microsoft's post does not say whether either was exploited in the wild.
Sources
- Arbitrary File Write via AI Agent Function Calling in .NET SDK (CVE-2026-25592, GHSA-2ww3-72rp-wpp4), GitHub Security Advisory (microsoft/semantic-kernel), 2026-02-06
- When prompts become shells: RCE vulnerabilities in AI agent frameworks, Microsoft Security Blog, 2026-05-07
A summary of public reporting. The step-by-step timeline is our reading of those sources; where they differ, we say so above.
Your agents
Could this happen to yours?
For developers
Build a path yourself
Recreate a sequence in the playground and see how policies treat it.