Offline, inert model of CVE-2026-115878 in Stanza's lemma loader: versioned pickle-to-JSON decision logic, static pickletools opcode scanning, and differential pre/post-fix test evidence.
Offline, inert model of CVE-2026-115878 (GHSA-gh9r-c94j-cmp5, CWE-502 /
CWE-94). In Stanza 1.14.0 the lemmatizer stored pos_dict as gzip-compressed
pickle bytes inside the checkpoint (dicts_version = 2).
torch.load(..., weights_only=True) treats bytes as a primitive and does
not inspect them, so Trainer.load then called unrestricted
pickle.loads on that stream (b21e1c9b:L58, pre). An attacker-supplied lemma
.pt therefore ran code at pipeline construction. The fix, commit
b21e1c9b47b4fccff21d3b0a6c0687a19410c2f0 (in 1.15.0), renames v2 to
_DICTS_VERSION_POS_PICKLE, stores v3 as gzip+JSON via orjson, and
raises ValueError on any v2 load (b21e1c9b:L68-73).
Spanish: README.es.md. Exercises: PRACTICE.md.
src/c9stanza/loader.py: the versioned decision. Pre: any POS version
(2 or, for the model, 3) goes through gzip then a static pickle
scan. Post: v3 → JSON; v2 → REJECT_PICKLE_V2 (b21e1c9b:L68-73); v1 → legacy
convert (b21e1c9b:L74-76).src/c9stanza/opstream.py: pickletools.genops + a symbolic stack.
pickle.loads / Unpickler are never used; tests patch them to
fail and check the AST. A STACK_GLOBAL / GLOBAL naming a module outside
an inert builtins allowlist is a SINK.json module (the real fix uses orjson;
see LIMITATIONS).results/summary.csv)| Class | n | pre | post |
|---|---|---|---|
| pos (gadgets) | 3 | 3 PICKLE_EXECUTED_SINK | 3 REJECT_PICKLE_V2 |
| neg | 3 | malformed / legacy | JSON / legacy |
| compat | 2 | legit v2 loads; bad JSON malformed | v2 rejected; JSON error |
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/:
b21e1c9b → sources/CVE-2026-115878_stanza_b21e1c9b47b4.diff (SHA-256 d5c38c6023732da2881933bb95c4e0ccbbb5fc47bdaa79ef1fc8ae7b26de6bbd)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
fixtures/expected.tsv comes from scripts/derive_expected.py, an
independent pickletools scanner that does not import src/. Python 3.10+
standard library only. Nothing is ever unpickled.
A model is not a finding. See LIMITATIONS.md and SOURCES.md. License: Apache-2.0.