---
id: "CVE-2026-5366"
kind: "vulnerability"
aliases: ["CVE-2026-5366", "GHSA-7pm4-56h2-5rxr"]
title: "Prefect has Git Flag Injection via commit_sha and directories Parameters Leading to Remote Code Execution (RCE)"
severity: "critical"
cvss: 9.9
epss: 0.01034
exploited: false
status: "open"
category: "package"
products: [{"name": "prefect", "fixed": ["3.6.25"], "affected": ">= 3.1.11, < 3.6.25", "ecosystem": "pypi"}, {"name": "prefect", "fixed": [], "affected": "= 3.6.23", "ecosystem": "vendor"}]
ecosystems: ["pypi", "vendor"]
tags: ["cwe-94", "multi-tenant", "package", "prefect", "python", "self-hosted"]
not_affected_if: ["no-git-storage", "single-tenant", "version-outside-range"]
published_at: "2026-06-20T17:16:26+00:00"
first_seen_at: "2026-11-03T21:19:44+00:00"
updated_at: "2026-11-03T22:07:19+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-7pm4-56h2-5rxr", "first_seen_at": "2026-11-03T21:19:44+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-5366", "first_seen_at": "2026-11-03T22:07:19+00:00"}]
---

# Prefect has Git Flag Injection via commit_sha and directories Parameters Leading to Remote Code Execution (RCE)

Prefect's GitRepository storage class passes the commit_sha and directories parameters to git without validation or a `--` separator, so user-supplied values can inject git flags such as `--upload-pack`. An attacker who can create deployments can run arbitrary commands on worker machines.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:prefect affected >= 3.1.11, < 3.6.25 fixed 3.6.25
- vendor:prefect affected = 3.6.23 fixed ?

## How to check

- Check the installed Prefect version with `pip show prefect` or `prefect version`.
- Look for deployments that use `GitRepository` storage with `commit_sha` or `directories` set from user input.
- Check whether shared work pools run workers for multiple tenants.

## Fix

- Upgrade `prefect` to `3.6.25` or later (affected range 3.1.11 through 3.6.24).

## Timeline

- 2026-11-03T21:19:44+00:00 ghsa https://github.com/advisories/GHSA-7pm4-56h2-5rxr
- 2026-11-03T22:07:19+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-5366

## Documents

- [fix] Patch: github.com https://github.com/PrefectHQ/prefect/pull/21384
- [fix] Patch: github.com https://github.com/PrefectHQ/prefect/commit/6a9d9918716ce4ee0297b69f3046f7067ef1faae
- [poc] Exploit: huntr.com https://huntr.com/bounties/e2e88a0f-a8f6-49c9-94c5-e98dc385f07a

## From the sources

Prefect versions 3.1.11 through 3.6.24 are vulnerable to remote code execution due to improper handling of user-controlled input in the `GitRepository` storage class. The `commit_sha` parameter, which is passed to git commands, lacks validation and does not include a `--` separator to distinguish user input from git flags. This allows attackers to inject arbitrary git flags, such as `--upload-pack`, enabling execution of external programs. Additionally, the `directories` parameter can be exploited to inject git flags during sparse-checkout operations. These vulnerabilities allow any user with deployment creation permissions to execute arbitrary commands on worker machines, compromising shared work pools in multi-tenant environments.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
