CVE-2026-115878
Arbitrary code execution via malicious lemmatizer pickle in Stanza 1.14‑1.15.0.
- CVSS 7.8
- CWE-94
- Input Validation and Sanitization
- Remote
Stanza is a Stanford NLP Python library for tokenization, sentence segmentation, NER, and parsing of many human languages. From 1.14.0 until 1.15.0, loading an attacker-supplied lemmatizer checkpoint can execute arbitrary code because stanza/models/lemma/trainer.py stores pos_dict as gzip-compressed pickle bytes and Trainer.load passes the decompressed stream to unrestricted pickle.loads. The outer torch.load call uses weights_only=True, but the nested bytes are treated as a primitive and are not inspected by that allowlist. The path is reachable during pipeline construction through a caller-influenced lemma_model_path, before inference begins. This issue is fixed in version 1.15.0.
- CWE
- CWE-94
- CVSS base score
- 7.8
- Published
- 2026-11-03
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Stanza
- Fixed by upgrading
- Yes
Solution
Upgrade Stanza to version 1.15.0 or later.
Vulnerable code sample
import gzip
import pickle
import torch
def load_lemma_model(lemma_model_path: str):
# VULNERABLE: unsafe deserialization of attacker‑controlled pickle data
checkpoint = torch.load(lemma_model_path, weights_only=True)
with gzip.GzipFile(fileobj=checkpoint["pos_dict_bytes"]) as gz:
pos_dict = pickle.loads(gz.read())
return pos_dictPatched code sample
import gzip
import pickle
import torch
class SafeUnpickler(pickle.Unpickler):
def find_class(self, module, name):
raise pickle.UnpicklingError("Disallowed class")
def load_lemma_model(lemma_model_path: str):
# FIX: restrict deserialization to built‑in containers only
checkpoint = torch.load(lemma_model_path, weights_only=True)
with gzip.GzipFile(fileobj=checkpoint["pos_dict_bytes"]) as gz:
raw = gz.read()
pos_dict = SafeUnpickler(io.BytesIO(raw)).load()
return pos_dictPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Patch a security hole by using orjson to encode/decode the lemma dictionary instead of pickle. Built in json is much slower than pickle, but orjson is faster than either. https://github.com/stanfordnlp/stanza/security/advisories/GHSA-gh9r-c94j-cmp5 (stanfordnlp/stanza)
setup.py,stanza/models/lemma/trainer.py,stanza/models/lemma/trainer.py · Trainer.load,stanza/models/lemma/trainer.py · _pack_pos_dict,stanza/models/lemma/trainer.py · _unpack_pos_dict,stanza/utils/lemma/convert_lemma_dict.py,stanza/utils/lemma/convert_lemma_dict.py · convert,stanza/utils/lemma/convert_lemma_dict.py · _pack_pos_dict
Cite this entry
@misc{vaitp:cve2026115878,
title = {{Arbitrary code execution via malicious lemmatizer pickle in Stanza 1.14‑1.15.0.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-115878},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-115878/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
