# CVE-2026-31220: PySyft server-side arbitrary Python execution after code approval

> Remote attackers can execute arbitrary Python code on PySyft servers by submitting malicious functions that bypass security checks during execution.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 12 May 2026
- **Updated:** 15 May 2026
- **Also known as:** GHSA-cfpg-c974-jfhq, PYSEC-2026-546

## What is CVE-2026-31220?

CVE-2026-31220 is a critical code injection vulnerability in n/a, published on 12 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

PySyft (Syft Datasite/Server) versions 0.9.5 and earlier are vulnerable to remote code execution due to insufficient validation and sandboxing of user-submitted code. The system allows low-privileged users to submit Python functions (via @sy.syft_function()) for remote execution on the server. While a code approval mechanism exists, the submitted code undergoes no security checks for dangerous operations (e.g., file access, command execution). Once approved, the code is executed within the server process using exec() and eval() functions without proper isolation. A remote attacker can leverage this to execute arbitrary Python code on the server, leading to complete compromise of the server environment.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2026-31220?

3 open source packages ship an affected version, including syft.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `syft` | PyPI | All versions to 0.9.5 | None |
| `syft` | PyPI | All versions to 0.9.5 | None |
| `syft` | PyPI | All versions to 0.9.5 | None |

## How do I fix CVE-2026-31220?

No fix has been published for CVE-2026-31220 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-31220 being exploited?

There is no known exploitation of CVE-2026-31220 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-31220 and fix it if it is affected.

What it is: CVE-2026-31220 is a critical code injection vulnerability in n/a, published on 12 May 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-31220 in the wild and no public exploit code.

Affected packages and fixed versions:
- syft (PyPI): affected all versions up to 0.9.5; no fix listed
- syft (PyPI): affected all versions up to 0.9.5; no fix listed
- syft (PyPI): affected all versions up to 0.9.5; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-31220/ (Markdown: https://insights.sbomify.com/CVE-2026-31220/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-31220
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-31220
- OSV: https://osv.dev/vulnerability/CVE-2026-31220

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-31220/
Summaries are generated and may contain mistakes; the official description above is the record.
