Offline educational model of CVE-2026-104851 (fsspec ReferenceFileSystem Jinja SSTI)
Offline, inert model of CVE-2026-104851 (GHSA-27vj-qcqg-25rc, CWE-94 /
CWE-1336). fsspec.implementations.reference.ReferenceFileSystem rendered
Kerchunk JSON fields through unrestricted jinja2.Template(...).render in
three sinks — refs (_process_references1._render_jinja), templates
(_process_templates), gen (_process_gen). An attacker-controlled references document achieved RCE
before any data was read. The fix is two commits, both in 2026.6.0
(see evidence/fix-in-2026.6.0.md):
a1c16ab3f07f354aa371c38f7b1b07ea7fd4c5c8 — honour simple_templates
(default True) so _process_gen is skipped.86438783f93b1398ef245b92f0e6063b445b611c — replace jinja2.Template
with jinja2.sandbox.SandboxedEnvironment().from_string in all three
sinks (86438783:L143-146, 86438783:L161-164, 86438783:L178-199).Spanish: README.es.md. Exercises: PRACTICE.md.
src/c9fsspec/template.py: a symbolic {{ expr }} engine. Pre = plain
Template (any attribute); post = SandboxedEnvironment policy (leading
_ and type.mro refused; mutating list/dict/set methods are not, as
in the real SandboxedEnvironment). jinja2 is never imported.src/c9fsspec/reference.py: the three sinks and the simple_templates
short-circuit (SKIPPED_SIMPLE, a1c16ab3:L19-20).ImmutableSandboxedEnvironment; the landed
fix uses SandboxedEnvironment. This model follows the diff.results/summary.csv)| Class | n | pre | post |
|---|---|---|---|
| pos (gadgets / skip) | 6 | 5 INTERNAL_REACHED, 1 SKIPPED_SIMPLE | 3 SECURITY_ERROR, 2 BLOCKED_EMPTY, 1 SKIPPED_SIMPLE |
| neg (legit) | 5 | OK / LITERAL | identical |
Every line citation has the form <tag>:L<n> or <tag>:L<n>-<m>: the real
cat -n line(s) of the saved diff copied into sources/:
86438783 → sources/CVE-2026-104851_fsspec_86438783f93b.diff (SHA-256 9b220f203831953bafb513d4519e25bd52c187993dcee14f17903ad0f59f4459)a1c16ab3 → sources/CVE-2026-104851_fsspec_a1c16ab3f07f.diff (SHA-256 7dacf5059e7a7a08dc0d77638122ea765b3726bcb713dc6e9a8d5ea1da69084f)All cited ranges and the text each must contain are in citations.tsv;
tests/test_citations.py checks the SHA-256, the text of every range, and
that no citation in the repo is missing from the table or lacks a tag.
Optionally, C9_DIFF=<diff>[:<diff>] (a fresh download of the upstream
commit diff) is checked to be byte-identical to the in-repo copy:
C9_DIFF=/tmp/x.diff PYTHONPATH=src python3 -m unittest -v tests.test_citations. Without it that one check is reported as an
explicit skip; the in-repo copies are always checked. License notice of the
copies: sources/README.md, sources/UPSTREAM-LICENSE.
PYTHONPATH=src python3 -m unittest discover -s tests -v
python3 scripts/derive_expected.py | diff - fixtures/expected.tsv
python3 scripts/gen_results.py /tmp/r && diff -r results /tmp/r
A model is not a finding. See LIMITATIONS.md and SOURCES.md. License: Apache-2.0.