/

CVE-2026-26030

Severity:

CRITICAL RISK

(9.9)

Code Injection in Semantic Kernel InMemoryVectorStore Filter

CVE-2026-26030

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Semantic Kernel's Python SDK contains a code injection vulnerability in the InMemoryVectorStore filter logic that can lead to remote code execution in affected versions before 1.39.4.

When untrusted data is allowed to influence filter expressions evaluated by the in-memory store, an attacker may execute arbitrary code in the context of the consuming application.

Affected context

The vulnerability exists in applications that embed Semantic Kernel's Python SDK and make use of the InMemoryVectorStore filter functionality, particularly where filter expressions or predicates can be derived from user-controlled or otherwise untrusted data.

It is most relevant in deployments where Semantic Kernel is exposed behind web APIs, bots, or agent-style services that dynamically construct or apply filters to in-memory vector searches, and where the application process has access to sensitive data or powerful execution privileges.

Exploit preconditions

  • Attack surface: Application endpoints, agents, or integrations that accept external input and translate it into InMemoryVectorStore filter expressions or query parameters.
  • Required access: Ability to supply or influence filter criteria, query objects, or any dynamic expression that flows into the InMemoryVectorStore filter mechanism (e.g., via HTTP APIs, chat inputs, or orchestration prompts).
  • Trigger point: Execution of a vector search or filtering operation in InMemoryVectorStore where the vulnerable filter logic processes attacker-influenced data.
  • Why exploitation is possible: The filter implementation performs evaluation of expressions in a way that treats data as executable code rather than as inert values, enabling crafted input to escape intended query semantics and trigger arbitrary code execution.

Why this happens

This issue stems from a classic CWE-94: Improper Control of Generation of Code ('Code Injection') pattern.

The InMemoryVectorStore filter functionality constructs or evaluates filter logic in a manner that does not reliably separate code from data, allowing untrusted values to be interpreted as part of an executable expression.

Instead of treating filter components as strictly structured data (e.g., parsed into a safe AST, or evaluated via a constrained DSL), the implementation permits dynamic evaluation without robust sanitization or strict binding, making it susceptible to injection of arbitrary operations when attacker-controlled content is incorporated.

Potential impact

  • Execution of arbitrary Python code within the Semantic Kernel host process.
  • Full compromise of the application that embeds Semantic Kernel, including access to its configuration, in-memory secrets, and connected resources.
  • Unauthorized access to or modification of data handled by the application, such as vector embeddings, documents, and external connectors.
  • Use of the compromised process as a pivot point for further lateral movement inside the hosting environment.
  • Interference with or manipulation of AI agent behavior, including poisoning of retrieval results or orchestration flows.

General mitigation guidance

Effective mitigation focuses on eliminating code-like evaluation of filters and hardening how filter logic is constructed:

  • Prefer query and filter APIs that treat all input as data, not as executable expressions, using strongly-typed parameters and structured predicates.
  • Introduce a constrained, non-Turing-complete filter language or schema where all operators are predefined and values are strictly validated against expected types and ranges.
  • Apply rigorous input validation and encoding on any externally-supplied filter components, rejecting or normalizing unexpected operators, symbols, or constructs.
  • Isolate Semantic Kernel workloads with least-privilege execution: minimize filesystem, network, and secret access for processes that evaluate user-controlled filters.
  • Avoid using in-memory stores intended for development or experimentation as the primary search backend in untrusted, internet-facing, or multi-tenant environments.
  • Adopt a defense-in-depth approach: combine safe filter handling with process sandboxing, containerization, and strict runtime permissions.

How teams detect issues like this

Organizations can approach detection of this class of issue through several complementary techniques:

  • Static analysis: Configure rules to flag use of dynamic expression evaluation, reflection, or unsafe parsing within filtering and query-building code paths, particularly where untrusted data flows into evaluators.
  • Code review heuristics: During review, scrutinize any logic that builds filter strings, lambdas, or expressions from external input; require clear separation of operators and values and explicit parameterization.
  • Automated policy checks: Integrate CI pipelines with security linters or SAST tools to detect patterns resembling code generation or dynamic exec/eval in query or filter utilities.
  • Runtime monitoring: Instrument logging around filter application, capturing suspicious patterns such as unexpected operators or unusually complex filter expressions, and set alerts for anomalous query shapes.
  • Architecture governance: Maintain guidelines that prohibit dynamic code evaluation in query layers and periodically audit SDK integration points (like vector stores) for adherence to these constraints.

Sources

SourceLink
github.comgithub.com/microsoft/semantic-kernel/pull/13505
github.comgithub.com/microsoft/semantic-kernel/releases/tag/python-1.39.4
github.comgithub.com/microsoft/semantic-kernel/security/advisories/GHSA-xjw9-4gw8-4rqx

Frequently asked

questions

It can be remotely exploitable when an attacker can influence filter expressions over a network interface—such as via a web API or conversational agent that passes user input into the InMemoryVectorStore filter logic without strict validation.

The attacker needs the ability to control or significantly influence the filter parameters or expressions processed by the vulnerable in-memory vector store. Direct code execution access is not required; the risk arises when user input flows into filter construction or evaluation.

The safest pattern is to eliminate dynamic code evaluation in filter handling: move to structured, parameterized filter APIs or a restricted DSL where operators are fixed and all values are treated as data, with strong type checking and validation before any evaluation.

To prevent similar vulnerabilities, adopt secure design principles that avoid treating user input as executable code, perform thorough data flow analysis on any expression-building logic, enforce coding standards that ban unsafe evaluation primitives, and use automated static analysis and code review checklists focused on injection and dynamic evaluation risks.

Find out what's already
exploitable in your codebase.