/

CVE-2026-25592

Severity:

CRITICAL RISK

(9.9)

Path Traversal File Write in Semantic Kernel

CVE-2026-25592

Awaiting Analysis

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-22

Impact:

Arbitrary File Write on Host System

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

A path traversal flaw in the SessionsPythonPlugin of Microsoft's Semantic Kernel .NET SDK allows arbitrary file writes when file paths passed to DownloadFileAsync or UploadFileAsync are not properly constrained.

If an attacker can influence the localFilePath argument for these functions, they may be able to write files to unexpected locations on the host system, potentially leading to data corruption, privilege escalation, or code execution depending on the environment.

Affected context

This vulnerability affects applications built with the Semantic Kernel .NET SDK that:

  • Use the SessionsPythonPlugin integration, and
  • Expose or indirectly use the DownloadFileAsync or UploadFileAsync methods, and
  • Accept localFilePath values that can be influenced by external input (e.g., user prompts, tool calls, or other agent-to-agent interactions).

The risk is higher in deployments where the Semantic Kernel process runs with broad filesystem permissions or where writing to specific directories (such as application, configuration, or script paths) can alter runtime behavior.

Exploit preconditions

  • Attack surface: Any code path where DownloadFileAsync or UploadFileAsync is invoked with a localFilePath derived from user input, AI-generated content, external services, or cross-agent communication.
  • Required access: Ability to control or significantly influence the localFilePath argument, directly or indirectly (e.g., via prompt injection, plugin/tool invocation, or API parameters).
  • Trigger point: Invocation of the vulnerable file operations in SessionsPythonPlugin without robust validation or allow-listing of the target path.
  • Why exploitation is possible: The file APIs accept and act on arbitrary paths without enforcing a safe base directory, canonicalization, or allow-list checks, enabling path traversal and writes outside the intended storage location.

Why this happens

The core issue is inadequate validation and normalization of filesystem paths supplied to the SessionsPythonPlugin's file operations.

By treating the localFilePath parameter as trusted and writing directly to the filesystem, the implementation allows an attacker-controlled path to escape the intended storage directory or target sensitive locations.

This pattern aligns with CWE-22: Path Traversal, where insufficient restriction of a path used in file operations can lead to access or modification of unintended files.

Within the Semantic Kernel context, complex data flows (e.g., AI-generated tool arguments, multi-agent orchestration) make it easy for untrusted input to reach these file APIs unless there is an explicit allow-list or boundary check.

Potential impact

  • Attackers could write arbitrary files to directories accessible by the Semantic Kernel process.
  • Malicious files could be placed where they might later be executed or interpreted (e.g., scripts, configuration files, or dynamic plugins).
  • Existing application or configuration files could be overwritten, causing denial of service or unexpected behavior.
  • Log, cache, or data files could be manipulated, leading to data tampering or integrity loss.
  • In environments where written files are later executed or loaded by higher-privileged components, this could contribute to privilege escalation.

General mitigation guidance

Effective mitigation focuses on strictly constraining file paths and minimizing implicit trust in arguments passed to file-related APIs:

  • Implement centralized allow-listing for file operations, ensuring localFilePath is restricted to a well-defined set of directories or patterns.
  • Normalize and canonicalize paths before use, rejecting any that attempt to traverse outside an approved root (e.g., via "../" segments or absolute paths).
  • Encapsulate file access behind higher-level abstractions that expose only safe operations (e.g., "store session file" by identifier) instead of raw paths.
  • Run Semantic Kernel processes with least-privilege filesystem permissions, limiting the damage if a write escapes containment.
  • Treat AI-generated or user-supplied arguments as untrusted data; apply the same validation to agent/tool parameters as to traditional web inputs.

Function Invocation Filters or equivalent interception layers can be used to enforce these patterns consistently across all plugin calls.

How teams detect issues like this

Detection typically combines code-centric and behavior-centric approaches:

  • Static analysis: Flag direct use of user-controlled or AI-influenced data in file path parameters to DownloadFileAsync, UploadFileAsync, or similar APIs, especially when used without validation or allow-lists.
  • Code review: Look for:
  • Any plumbing that passes prompt or tool arguments straight into localFilePath.
  • Absence of centralized path validation or a dedicated file access service.
  • Use of absolute paths or concatenation of user input into paths without normalization.
  • Runtime monitoring: Log and alert on unusual write patterns, such as writes to system directories, application binaries, or configuration locations from Semantic Kernel processes.
  • Policy enforcement: Use pre-commit hooks or CI checks to prevent direct filesystem access from plugins without going through a vetted file service or filter.

Automated SAST and dependency scanning tools can help identify risky path usage and track plugin integrations that expose filesystem operations.

Sources

SourceLink
github.comgithub.com/microsoft/semantic-kernel/blob/main/dotnet/samples/Demos/CodeInterpreterPlugin/Program.cs#L61-L64
github.comgithub.com/microsoft/semantic-kernel/pull/13478/changes#diff-88d3cacba2bfa84eef8f2aa171b34f9940338cbb784a3ffc49f5fe3af1b8943d
github.comgithub.com/microsoft/semantic-kernel/security/advisories/GHSA-2ww3-72rp-wpp4

Frequently asked

questions

It can be, if remote users, external services, or AI-driven inputs can control or influence the localFilePath passed into SessionsPythonPlugin's file operations. In such setups, a remote actor could cause arbitrary file writes on the host where Semantic Kernel runs.

The attacker needs the ability to shape parameters that eventually reach DownloadFileAsync or UploadFileAsync, which may come from API calls, chat/prompt input, or other agents. They do not necessarily need direct filesystem access; controlling the path argument is sufficient.

Introduce a robust validation layer (e.g., a Function Invocation Filter) that enforces strict allow-listing and canonicalization for all file paths, and ensure that plugins interact with a constrained file service rather than arbitrary filesystem paths.

Treat all path-like data as untrusted, design plugins and tools around logical resource identifiers rather than raw paths, apply least-privilege to runtime identities, and enforce consistent security reviews and static analysis rules for any filesystem access in AI agent tooling.

Find out what's already
exploitable in your codebase.