Skip to main content
Vulnerability Database/CVE-2026-104851

CVE-2026-104851: fsspec RCE Vulnerability

CVE-2026-104851 is a remote code execution vulnerability in fsspec that allows attackers to execute arbitrary Python code through malicious Kerchunk reference documents. This post covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-104851 Overview

CVE-2026-104851 is a code injection vulnerability in fsspec, a Python framework for filesystem interfaces widely used by data science and machine learning workloads. The flaw resides in fsspec.implementations.reference.ReferenceFileSystem, which evaluates fields from Kerchunk reference JSON documents through unrestricted jinja2.Template(...).render(...) calls. Attackers who control a reference document, whether supplied inline or fetched from a remote URL, can execute arbitrary Python code when the reference filesystem is opened. The issue affects versions 0.9.0 through 2026.6.0 and is categorized under CWE-94: Improper Control of Generation of Code.

Critical Impact

Opening or indirectly loading a malicious Kerchunk reference document, including through consumers such as xarray, triggers arbitrary code execution before any referenced data is read.

Affected Products

  • fsspec versions 0.9.0 through versions prior to 2026.6.0
  • Downstream consumers that open reference filesystems, including xarray and Kerchunk-based workflows
  • Python data pipelines that ingest third-party or user-supplied reference JSON documents

Discovery Timeline

  • 2026-10-02 - CVE-2026-104851 published to the National Vulnerability Database (NVD)
  • 2026-10-05 - Last updated in the NVD database

Technical Details for CVE-2026-104851

Vulnerability Analysis

The vulnerability affects three code paths in fsspec/implementations/reference.py: _process_references1._render_jinja, _process_templates, and _process_gen. Each path passes attacker-influenced strings directly into jinja2.Template(...).render(...) without sandboxing. Jinja2's default environment allows access to Python object internals through attributes such as __class__ and __mro__, which attackers use to reach arbitrary callables including os.system and subprocess.Popen.

The _process_gen path is reached whenever a reference document contains a gen array, making it the most reliably exploitable sink. The other two paths depend on whether specific template-related options or fields are set in the reference document. Code execution happens at filesystem open time, before any referenced byte ranges are fetched, so simply pointing a consumer at a malicious reference triggers execution.

Root Cause

The root cause is improper neutralization of template directives embedded in untrusted data. The reference loader treats Kerchunk JSON fields as trusted template sources and renders them with a non-sandboxed Jinja2 environment. There is no allowlist of permitted expressions and no use of jinja2.sandbox.SandboxedEnvironment, so any expression the attacker provides is evaluated by the Python interpreter.

Attack Vector

Exploitation requires an application to open a Kerchunk reference document the attacker controls. Delivery channels include a reference JSON hosted at an attacker-controlled URL, a reference blob stored in a shared data lake, or a document passed inline by an upstream service. User interaction is required in the form of loading the reference, which is a routine operation for data science tooling such as xarray.open_dataset with the reference protocol.

The attack vector is network-based, requires low complexity, and compromises confidentiality, integrity, and availability of the Python process executing fsspec. See the GitHub Security Advisory GHSA-27vj-qcqg-25rc for additional technical context.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-104851

Indicators of Compromise

  • Kerchunk reference JSON documents containing Jinja2 syntax such as {{ and }} inside gen, templates, or reference entries
  • Unexpected child processes spawned by Python interpreters that import fsspec or xarray
  • Outbound network connections initiated by data-processing jobs immediately after loading a reference URL
  • Reference documents fetched from untrusted or newly observed external domains

Detection Strategies

  • Inspect fsspec and xarray call sites for use of the reference:// protocol or ReferenceFileSystem with externally sourced inputs
  • Scan stored reference JSON files for Jinja2 expressions referencing Python attributes like __class__, __mro__, __subclasses__, or __import__
  • Correlate process execution telemetry from data-science hosts with Python parent processes spawning shells, curl, wget, or python -c payloads

Monitoring Recommendations

  • Alert on Python processes that execute os.system, subprocess.Popen, or /bin/sh shortly after loading remote JSON
  • Log and review all outbound HTTP(S) fetches performed by fsspec-backed workloads, including Jupyter and workflow orchestrators
  • Track fsspec package versions across build pipelines and notebooks to flag environments pinned below 2026.6.0

How to Mitigate CVE-2026-104851

Immediate Actions Required

  • Upgrade fsspec to version 2026.6.0 or later across all Python environments, container images, and notebook kernels
  • Audit stored Kerchunk reference documents and remove any that contain Jinja2 template expressions from untrusted sources
  • Restrict ReferenceFileSystem consumers so they only load reference documents from vetted, access-controlled storage

Patch Information

The fix is included in fsspec release 2026.6.0. The remediation ships in pull request #2029 and pull request #2039, with the underlying changes in commits 86438783 and a1c16ab3. The patches constrain template evaluation in the affected _process_references1, _process_templates, and _process_gen paths.

Workarounds

  • Block loading of reference documents from untrusted URLs by proxying fsspec fetches through an allowlist
  • Pre-validate reference JSON files with a schema check that rejects any field containing {{ or {% Jinja2 delimiters
  • Run fsspec-based workloads in least-privilege containers with egress restrictions to limit post-exploitation impact
bash
# Upgrade fsspec to the patched release
pip install --upgrade "fsspec>=2026.6.0"

# Verify the installed version
python -c "import fsspec; print(fsspec.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.