# CVE-2026-5366: Prefect remote code execution in GitRepository storage class

Source: https://junglewise.ai/threats/cve-2026-5366-prefect-remote-code-execution-in-gitrepository-storage-class  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-20. Updated: 2026-06-21  
License: CC BY 4.0 with a link back

CVE-2026-5366 · Severity: critical · CVSS 9.9 · Published 2026-06-20

Prefect, a workflow orchestration platform used to manage data pipelines, contains a vulnerability that allows remote code execution. An attacker with basic permissions to create deployments can exploit improper input handling to run unauthorized commands on the worker machines that execute tasks. This could lead to a complete takeover of the infrastructure, data theft, or disruption of business operations, especially in environments where multiple teams share the same resources.

Technologies: [prefect (PyPI)](https://junglewise.ai/threats/technologies/prefect). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-5366 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-5366 being exploited in the wild.

**How severe is CVE-2026-5366?** Critical severity, with a CVSS score of 9.9, published 20 June 2026.

**Which products and versions are affected?** prefect (PyPI) >= 3.1.11, < 3.6.25, ECOSYSTEM:introduced=3.1.11,fixed=3.6.25.

**Is there a fix for CVE-2026-5366?** Yes. prefect (PyPI): upgrade to 3.6.25 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-5366 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-5366?** Check whether you run prefect (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- prefect (PyPI): upgrade to 3.6.25 or later

  ```sh
  pip install "prefect>=3.6.25"
  ```


## Technical details

A remote code execution vulnerability exists in Prefect's `GitRepository` storage class due to improper validation of the `commit_sha` and `directories` parameters. These parameters are passed directly to git commands without a `--` separator, allowing an attacker to inject git flags such as `--upload-pack`. By providing a malicious flag, an authenticated user with deployment creation permissions can trigger the execution of arbitrary external programs on the worker node. This is particularly impactful in multi-tenant environments where shared work pools can be compromised. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code).

## Affected products

- PrefectHQ Prefect 3.6.23 and earlier

## Identifiers

- CVE-2026-5366
- GHSA-7pm4-56h2-5rxr

## Timeline

- 2026-06-20: disclosed
- 2026-06-20: advisory

## References

- [https://huntr.com/bounties/e2e88a0f-a8f6-49c9-94c5-e98dc385f07a](https://huntr.com/bounties/e2e88a0f-a8f6-49c9-94c5-e98dc385f07a)

## Related threats

- [PYSEC-2026-1800 - Prefect CORS (Cross-Origin Resource Sharing) misconfiguration](https://junglewise.ai/threats/cve-2024-8183-prefect-cors-cross-origin-resource-sharing-misconfiguration)
- [PYSEC-2026-1799 - Cross-Site Request Forgery vulnerability in Prefect](https://junglewise.ai/threats/cve-2023-6022-cross-site-request-forgery-vulnerability-in-prefect)
- [Prefect authentication bypass via health check path exemption](https://junglewise.ai/threats/cve-2026-3514-prefect-authentication-bypass-via-health-check-path-exemption)
- [Prefect prefect-github argument injection in GitHubRepository](https://junglewise.ai/threats/cve-2026-3515-prefect-prefect-github-argument-injection-in-githubrepository)
- [Prefect Git argument injection in GitRepository Pull Handler](https://junglewise.ai/threats/cve-2026-7725-prefect-git-argument-injection-in-gitrepository-pull-handler)
