/

CVE-2026-44881

Severity:

CRITICAL RISK

(9.9)

Symlink Traversal in Portainer Git-Backed Stacks

CVE-2026-44881

Analyzed

Vulnerability type

Category:

Symlink Traversal / Insecure Symlink Handling

CWE:

CWE-59, CWE-200

Impact:

Arbitrary File Read / Information Disclosure

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

Portainer Community Edition improperly follows symbolic links when handling Git-backed stacks, allowing docker-compose.yml to be a symlink to arbitrary paths on the host filesystem.

Any authenticated user who can create or update a Git-backed stack can cause Portainer to read and return the contents of files accessible to the Portainer process, leading to critical information disclosure.

Affected context

This vulnerability appears in Portainer CE deployments that:

  • Enable Git-backed stack deployment and management
  • Allow authenticated users to create or update stacks from Git (default in many setups)
  • Run the Portainer service with access to sensitive files (e.g., Docker socket, configuration files, host paths)

The issue arises when Portainer clones a Git repository and materializes symlink entries as real OS symlinks, then later reads stack entry files without treating symlinks as untrusted or validating their targets.

Exploit preconditions

  • Attack surface: Portainer HTTP API, specifically the Git-backed stack creation/update flow and the GET /api/stacks/{id}/file endpoint.
  • Required access: Valid, authenticated Portainer account with permission to create or update a Git-backed stack (often any authenticated user in the default configuration).
  • Trigger point: Supplying a Git repository where docker-compose.yml (or the stack entry point file) is a symlink to an arbitrary file path on the host filesystem.
  • Why exploitation is possible: The go-git clone process maps Git symlink blobs to OS-level symlinks across almost all paths, and subsequent file reads (os.ReadFile) follow those symlinks transparently, without checking that the target remains within the intended stack directory or enforcing a safe path policy.

Why this happens

The core issue is an insecure handling of filesystem symlinks created from untrusted repository content.

When Portainer uses go-git to clone Git-backed stacks, it maps blobs with mode 0o120000 into real OS symlinks using os.Symlink on the host filesystem.

With the exception of .gitmodules, Portainer does not restrict which paths may become symlinks or where they may point.

Later, the GET /api/stacks/{id}/file endpoint reads the stack file via os.ReadFile, which follows symlinks by design.

This pattern violates the expectation that stack-related file reads should be confined to the cloned project directory, and maps to CWE-59: Improper Link Resolution Before File Access, with a resulting CWE-200: Exposure of Sensitive Information to an Unauthorized Actor due to arbitrary file disclosure.

Potential impact

  • Reading arbitrary files on the host that are accessible to the Portainer process
  • Exposure of configuration files, secrets, and environment-specific credentials
  • Potential disclosure of Docker or Kubernetes configuration, including socket-mounted paths
  • Leakage of internal system paths, user data, and application source code present on the host
  • Facilitation of further attacks (e.g., targeted exploitation using disclosed secrets or configuration)

General mitigation guidance

Effective mitigation centers on treating Git-derived filesystem content as untrusted and enforcing strict file access boundaries:

  • Avoid materializing Git symlinks as raw OS symlinks where they will later be read without verification; instead, treat symlink entries as metadata or block them for stack entry points.
  • Implement canonical path checks before reading files, ensuring targets are confined within an expected project root and rejecting paths that escape that root or rely on symlink resolution.
  • Enforce allowlists for which files may be served through stack-related APIs (e.g., only specific filenames within the stack directory, no symlinks).
  • Run Portainer with least-privilege filesystem access, avoiding unnecessary mounts of sensitive host directories and secrets into the Portainer container.
  • Separate concerns by using dedicated service accounts and volumes so that compromise of Portainer's view of the filesystem does not automatically expose critical host-level files.

How teams detect issues like this

Detection efforts can focus on both code and runtime behavior:

  • Static analysis / code review:
  • Flag any use of os.Symlink, os.ReadFile, or equivalent file access APIs that operate on paths derived from untrusted Git content.
  • Look for file-serving endpoints that accept dynamic paths or stack identifiers and do not validate that resolved paths remain under a controlled root.
  • Review logic that translates Git blob modes into filesystem objects, ensuring symlink handling is explicitly constrained.
  • Policy and configuration checks:
  • Periodically audit Portainer and similar tooling for symlink traversal patterns and file-serving APIs.
  • Enforce infrastructure policies that restrict access to sensitive host paths from management containers.
  • Runtime monitoring:
  • Monitor access logs for unusual stack repositories or repeated access to /api/stacks/{id}/file.
  • Use host-level logging (e.g., auditd, container runtime logs) to identify unexpected file reads originating from the Portainer process.

Sources

SourceLink
github.comgithub.com/portainer/portainer/security/advisories/GHSA-rpgq-m5fp-32wr

Frequently asked

questions

Yes. Any attacker who can reach the Portainer API and authenticate with an account that can create or update a Git-backed stack can exploit this remotely by pointing Portainer at a malicious Git repository.

Not necessarily. The key requirement is permission to create or update Git-backed stacks, which in many Portainer CE configurations is granted to regular authenticated users by default. Higher privileges are not strictly required if those permissions are present.

The safest pattern is to eliminate or strictly constrain symlink handling for Git-backed stacks: do not materialize untrusted symlinks as OS symlinks for stack entry files, enforce that all accessed files resolve within a controlled project root, and block or separately handle symlink entries instead of transparently following them.

Treat all filesystem artifacts derived from untrusted sources (such as Git repositories) as untrusted, enforce robust path canonicalization and root confinement, avoid following symlinks by default, and subject file-serving endpoints to regular security review and automated checks for link and path traversal vulnerabilities.

Find out what's already
exploitable in your codebase.