# CVE-2026-104851: fsspec: Server-Side Template Injection in ReferenceFileSystem leads to Remote Code Execution

> Attackers can execute arbitrary Python code by supplying malicious Jinja2 templates in Kerchunk reference JSON documents processed by fsspec.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/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:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Oct 2026
- **Updated:** 5 Oct 2026
- **Also known as:** CLEANSTART-2026-ER50683, DEBIAN-CVE-2026-104851, ECHO-e799-0dd6-47ec, GHSA-27vj-qcqg-25rc, MINI-3hvw-xjwj-vwfx, MINI-3m3w-jfxf-x2j3, MINI-4v32-fxp5-32pf, MINI-6rxh-vm9f-f4jf, MINI-73f8-jffr-x7mw, MINI-7pgp-8g74-m6pj, MINI-83qw-r28g-m2qv, MINI-cr2w-pr8c-53g2, MINI-gg5p-8248-4cpw, MINI-mhv9-4qrq-8prh, MINI-pgw4-7wgw-wc65, MINI-q653-6mm4-9p9h, MINI-rw8h-fw2h-7w87, MINI-rxjp-h62h-xwf5, MINI-wj5w-5f83-x4rh, PYSEC-2026-4217, ROOT-APP-PYPI-CVE-2026-104851, UBUNTU-CVE-2026-104851, openSUSE-SU-2026:22028-1

## What is CVE-2026-104851?

CVE-2026-104851 is a high-severity code injection vulnerability in fsspec filesystem_spec, published on 2 Oct 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

fsspec is a specification and Python implementation framework for filesystem interfaces. From 0.9.0 until 2026.6.0, fsspec.implementations.reference.ReferenceFileSystem evaluates fields from Kerchunk reference JSON documents through unrestricted jinja2.Template(...).render(...) calls in _process_references1._render_jinja, _process_templates, and _process_gen in fsspec/implementations/reference.py. A document supplied inline or fetched from an attacker-controlled URL can provide template expressions that execute Python code when the reference filesystem is opened, including through consumers such as xarray, before referenced data is read. The _process_gen path is reached whenever a document includes a gen array, while the other paths depend on template-related options and values. This issue is fixed in version 2026.6.0.

Weakness: CWE-94 (Improper Control of Generation of Code), CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

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

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `fsspec` | PyPI | From 0.9.0 | 2026.6.0 |
| `fsspec` | PyPI | From 0.9.0 | 2026.6.0 |
| `fsspec` | PyPI | From 0.9.0 | 2026.6.0 |
| `python-fsspec` | openSUSE:Leap 16.0 | All versions | 2024.3.1-bp160.2.1 |

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

Upgrade fsspec to 2026.6.0 or later.

## Is CVE-2026-104851 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-104851 exists.

## Fix prompt for AI coding agents

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

What it is: CVE-2026-104851 is a high-severity code injection vulnerability in fsspec filesystem_spec, published on 2 Oct 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-104851 exists.

Affected packages and fixed versions:
- fsspec (PyPI): affected from 0.9.0; fixed in 2026.6.0
- fsspec (PyPI): affected from 0.9.0; fixed in 2026.6.0
- fsspec (PyPI): affected from 0.9.0; fixed in 2026.6.0

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-104851/ (Markdown: https://insights.sbomify.com/CVE-2026-104851/index.md)
```

## Sources

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

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