// threat brief
Microsoft Semantic Kernel (Python) runs InMemoryVectorStore filter conditions as code
- CVSS
- 9.9 CRITICAL
- CISA KEV
- Not listed
- Weakness
- CWE-94
- Topics
- AI security
Human review 2026-09-23Command tests: none yetReproduced: not yetVerification record ↓
Semantic Kernel turns the filter an AI model writes for a search plugin into Python code and runs it; prompt injection can make that run any code on the server.
| Who is affected | Applications using the Python semantic-kernel before 1.39.4 that hand InMemoryVectorStore to the model as a search plugin (function calling) with the default filter settings. The .NET and Java versions are not listed as affected. |
|---|---|
| What happens | An attacker may be able to run code on the host with the application's permissions, read keys, tamper with data, or use it as a stepping stone. |
| What to do now | Upgrade semantic-kernel to 1.39.4 or later. Don't use InMemoryVectorStore in production.View evidence(4)
|
| Affected versions | All versions before 1.39.4View evidence(4)
|
| Fixed versions | 1.39.4 or laterView evidence(3)
|
| CVSS vector | Show full vectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H |
| Timeline |
|
| CISA KEV | Not listed(Not being in KEV does not mean it has not been exploited)View evidence(2)
|
Blue team playbook
Check, fix / mitigate, respond, harden. Matching the affected versions does not mean you were compromised, and a check that finds nothing does not prove you are safe; each item says what it can and cannot show. Tagged steps point to where the attack flow below can be stopped.
- 01Check your semantic-kernel version
The Python semantic-kernel before 1.39.4 is affected; 1.39.4 or later is fixed. The .NET and Java versions are not listed as affected in the official advisory.
Read-only checkpip show semantic-kernel - 02Find out whether InMemoryVectorStore is handed to the model
Search your code for InMemoryVectorStore or InMemoryCollection. The affected setup hands it to the model as a search plugin (function calling) with the default filter settings; other vector database connectors are not listed as affected in the official advisory.
- 03Look back for suspicious child processes spawned by the AI application
Microsoft recommends looking back over the period "between deploying an affected version and upgrading" for suspicious child processes spawned by the AI application.
- 01Upgrade to 1.39.4 or later
1.39.4 keeps the existing syntax-node and function restrictions and adds a block on 44 dangerous internal attribute names. The library itself still runs the filter string with a restricted eval.
Changes your environmentpip install -U "semantic-kernel>=1.39.4" - 02Don't use InMemoryVectorStore in production
This is the mitigation given in the official advisory; InMemoryVectorStore was designed for development and testing in the first place.
- 01If you find suspicious activity, treat it as a potential host compromise and review the host
Microsoft's advice is to treat it as a "potential" host compromise, review the affected host, and investigate what data or systems that host could reach.
- 02Rotate the credentials and tokens accessible to the agent
This is part of Microsoft's advice. An attacker may be able to read keys with the application's permissions.
- 03If you can't rule it out, also rotate the other keys on the host
PlainCVE's own suggestion (not Microsoft's advice). If you can't rule out exploitation, play it safe and rotate the other keys on that host too.
- 01Give the tools the model can call only the minimum permissions
The model can be manipulated by prompt injection, so the fewer permissions its tools have, the less damage it can do when that happens.
- 02Handle untrusted content separately from system instructions
Malicious instructions could be typed by a user, or hidden in a document or web page the model reads (indirect prompt injection).
- 03Don't let model output become executable code
In your own application, represent filter conditions as structured data, with no eval involved.
- 04Run AI applications under a low-privilege account and inside a container
Even if code does run on the host, it only gets limited permissions. Also monitor for unusual child processes spawned by the AI application.
Full remediation steps and notes
- Upgrade.
pip install -U "semantic-kernel>=1.39.4". - Don’t use
InMemoryVectorStorein production. This is the mitigation given in the official advisory; it was designed for development and testing in the first place. - Check whether you were exploited. Microsoft recommends looking back over the period “between deploying an affected version and upgrading” for suspicious child processes spawned by the AI application. Microsoft’s advice: if you find suspicious activity, treat it as a potential host compromise, review the affected host, rotate the credentials and tokens accessible to the agent, and investigate what data or systems that host could reach. PlainCVE additionally suggests: if you can’t rule it out, play it safe and rotate the other keys on that host too.
- General principles. Give the tools the model can call only the minimum permissions; run AI applications under a low-privilege account and inside a container.
Attack flow
Read left to right: this is the order the attack happens in. A blue shield means the step can be stopped; the earlier, the better. Click an icon for details.
- Attacker
Hides instructions in text the model will read
This could be typed directly by a user, or come from a document or web page the model reads (indirect prompt injection).
Defense: Give the tools the model can call the least privilege possible; handle untrusted content separately from system instructions.
- Your system
The model calls the search plugin and chooses the filter parameters itself
The parameters are shaped by the text from the previous step, so they are no longer the simple keywords the developer expected.
- Your system
The parameters are spliced into a Python lambda string
Older versions built the filter function as a string, checked its syntax tree, and then ran it. Early versions used a blocklist of dangerous names; from 1.39.2 the check allowed only specific syntax nodes and function calls, but did not limit which attributes could be accessed.
Defense: Upgrade to 1.39.4+, which adds blocking of dangerous internal attribute names on top of the existing syntax-node and function restrictions.
- Your system
Code that slips past the checks runs on the host
Python's dynamic nature makes it very hard for this kind of check to catch everything; an attacker can reach dangerous functionality through the internal attributes of objects.
Defense: Monitor for unusual child processes spawned by the AI application; run it under a low-privilege account and isolate it in a container.
Who is affected
| Condition | Affected? |
|---|---|
Python semantic-kernel before 1.39.4 + using the InMemoryVectorStore search plugin + callable by the model (function calling) + default filter settings | Affected |
Python semantic-kernel 1.39.4 or later | Fixed |
| Using a different vector database connector (not InMemory) | Not listed as affected in the official advisory |
| .NET / Java versions of Semantic Kernel | Not listed as affected in the official advisory |
Check your version with pip show semantic-kernel, then search your code for InMemoryVectorStore or InMemoryCollection.
How it works
Semantic Kernel lets developers wrap features like “search the data” as plugins and hand them to an AI model, which decides on its own when to call them and with what parameters. The problem lies in how the InMemory vector database handles “filter conditions.”
Older versions assembled the filter condition into a string of Python code (a lambda function) and then had Python run it. When the model filled in the plugin’s parameters, the text it produced was spliced right into that code.
The flawed approach (conceptual illustration, not the original source code):
Show code example(python)
# Parameters chosen by the model are spliced directly into a code string
expr = f"lambda record: record.category == '{model_argument}'"
filter_fn = eval(expr) # the string becomes real codeThe developers did put up defenses: older versions first parsed the string into a syntax tree, allowed only a lambda, and blocked dangerous names such as eval, exec, and open. But Microsoft’s research article points out that in a highly dynamic language like Python, a blocklist is “inherently fragile”: by digging through an object’s internal attributes layer by layer, you can reach dangerous functionality without ever writing a blocked name. From 1.39.2, the check switched to an allowlist (only specific syntax nodes and function calls), but it did not limit attribute names, so every version before 1.39.4 is still affected.
This is CWE-94 (improper control of generation of code): a filter value that should only ever be “data” becomes “code.” And the one feeding in that data is an AI model, which can itself be manipulated by prompt injection, so the whole chain becomes “a piece of text → the server runs code.”
An alternative design (a conceptual illustration for your own application, not the actual 1.39.4 fix):
Show code example(python)
# Represent the filter condition as structured data, with no eval involved
filter_spec = {"field": "category", "op": "eq", "value": model_argument}
results = [r for r in records if getattr(r, filter_spec["field"]) == filter_spec["value"]]Note that the semantic-kernel library itself still runs the filter string with a restricted eval in 1.39.4; it did not switch to the approach above. The 1.39.4 fix keeps the existing syntax tree check (only specific node types and function calls are allowed) and adds a block on 44 dangerous internal attribute names. For your own code, the more fundamental rule is: don’t let model output become executable code.
Timeline
| Date | Event |
|---|---|
| 2026-02-03 | Fix PR #13505 opened |
| 2026-02-10 | PR merged, python-1.39.4 released |
| 2026-02-19 | GitHub security advisory and CVE published |
| 2026-03-10 | Included in Microsoft’s March Security Update Guide |
| 2026-05-07 | Microsoft publishes its research article on RCE in AI agent frameworks |
Further reading
- The same Microsoft research also disclosed CVE-2026-25592: a file download feature that the AI can call, which lets the sandbox write files to the host.
- Related weakness types: CWE-94 improper control of generation of code, prompt injection (LLM01 in the OWASP LLM Top 10).
- Scoring differences: GitHub / NVD rate it CVSS 9.9 Critical; MSRC rates it Important with CWE-749. This page uses the scores from the CNA (GitHub) and NVD.
Verification Reviewed and checked against sources; not yet reproduced in our lab
| Reviewed | 2026-09-23 |
|---|
Verification records describe the environment and the result only, never reproduction steps or code that could attack other people’s systems. See our policy.
Sources
- Othersemantic-kernel 1.34.0 released with text filters · pypi.org · accessed 2026-09-24
- AdvisoryGHSA-xjw9-4gw8-4rqx — InMemoryVectorStore filter functionality vulnerable to remote code execution · Microsoft (GitHub), 2026-02-19 · accessed 2026-09-23
- CVE / NVD / OSVCVE-2026-26030 Record · CVE Program, 2026-02-19 · accessed 2026-09-23
- CVE / NVD / OSVNVD - CVE-2026-26030 · NIST · accessed 2026-09-23
- VendorMSRC Security Update Guide — CVE-2026-26030 · Microsoft, 2026-03-10 · accessed 2026-09-23MSRC lists the CWE as CWE-749 and rates the severity Important; GitHub / NVD list CWE-94 and 9.9 Critical.
- Patch / releasePython: refinement of filtering (PR #13505) · Microsoft (GitHub), 2026-02-10 · accessed 2026-09-23
- Patch / releasepython-1.39.4 release · Microsoft (GitHub), 2026-02-10 · accessed 2026-09-23
- Otherin_memory.py at python-1.39.3 (filter allowlist before the fix) · Microsoft (GitHub) · accessed 2026-09-24
- Patch / releasein_memory.py at python-1.39.4 (fixed version, still uses restricted eval) · Microsoft (GitHub) · accessed 2026-09-24
- ResearchWhen prompts become shells: RCE vulnerabilities in AI agent frameworks · Microsoft Security Blog, 2026-05-07 · accessed 2026-09-23
Press brief
In one sentence
The Python version of Semantic Kernel, Microsoft's open-source framework for building AI applications, had a vulnerability: parameters that the AI model fills in for a search feature were run as code. An attacker who manages to get the model to read specially crafted text could take control of the server. Microsoft released the fixed version 1.39.4 in February 2026, and there are currently no public reports of it being exploited.
Quotable line
When an AI model's output turns directly into code, prompt injection is no longer just about making a chatbot say the wrong thing. It's about making the server carry out someone else's commands.
Images
Download the share image (PNG) · Attack flow diagram (downloadable)
Please credit "PlainCVE" and link to this page. Full citation format is under "How to cite" below. Found a factual error? Report it.
Microsoft Semantic Kernel (Python) runs InMemoryVectorStore filter conditions as code The Python version of Semantic Kernel, Microsoft's open-source framework for building AI applications, had a vulnerability: parameters that the AI model fills in for a search feature were run as code. An attacker who manages to get the model to read specially crafted text could take control of the server. Microsoft released the fixed version 1.39.4 in February 2026, and there are currently no public reports of it being exploited. 「When an AI model's output turns directly into code, prompt injection is no longer just about making a chatbot say the wrong thing. It's about making the server carry out someone else's commands.」— PlainCVE https://plaincve.date/en/vulns/cve-2026-26030-semantic-kernel-filter-rce
How to cite this page
This article is CC BY 4.0. Please keep the attribution and link when republishing.
PlainCVE Team (2026). "Microsoft Semantic Kernel (Python) runs InMemoryVectorStore filter conditions as code". PlainCVE. https://plaincve.date/en/vulns/cve-2026-26030-semantic-kernel-filter-rce (accessed YYYY-MM-DD)BibTeX
@misc{cve202626030semantickernelfilterrce2026,
title = {Microsoft Semantic Kernel (Python) runs InMemoryVectorStore filter conditions as code},
author = {PlainCVE Team},
year = {2026},
howpublished = {PlainCVE},
url = {https://plaincve.date/en/vulns/cve-2026-26030-semantic-kernel-filter-rce},
note = {Updated 2026-09-24}
}