VAITP Dataset

← Back to the dataset

CVE-2026-78683

Unsafe pickle deserialization in NLTK TransitionParser allows code execution.

  • CVSS 9.4
  • CWE-502
  • Input Validation and Sanitization
  • Remote

NLTK before 3.10.0 (affected versions <=3.9.4) contains an unsafe pickle deserialization vulnerability in the TransitionParser.parse() method (nltk/parse/transitionparser.py). The method calls pickle_load() with the default restricted=False, routing deserialization through WarningUnpickler, which does not override find_class() and therefore permits arbitrary class resolution. When an application loads an attacker-crafted model file, embedded pickle gadget chains execute arbitrary Python code with the privileges of the user running the application. NLTK provides a RestrictedUnpickler for safe deserialization, but it is not used by production code paths. Fixed in 3.10.0.

CVSS base score
9.4
Published
2026-08-25
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
NLTK
Fixed by upgrading
Yes

Solution

Upgrade NLTK to version 3.10.0 or later.

Vulnerable code sample

import os
from nltk.parse.transitionparser import TransitionParser
from nltk import pickle_load

def load_parser(model_path: str) -> TransitionParser:
    """Load a transition parser model from disk (vulnerable)."""
    # VULNERABLE: unsafe pickle deserialization
    with open(model_path, "rb") as f:
        model_data = pickle_load(f)  # unrestricted unpickling
    parser = TransitionParser()
    parser.model = model_data
    return parser

Patched code sample

import os
from nltk.parse.transitionparser import TransitionParser
from nltk import pickle_load, RestrictedUnpickler

def load_parser(model_path: str) -> TransitionParser:
    """Load a transition parser model from disk (patched)."""
    # FIX: use restricted unpickler for safe deserialization
    with open(model_path, "rb") as f:
        model_data = pickle_load(f, restricted=True, unpickler=RestrictedUnpickler)
    parser = TransitionParser()
    parser.model = model_data
    return parser

Published 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.

Cite this entry

@misc{vaitp:cve202678683,
  title        = {{Unsafe pickle deserialization in NLTK TransitionParser allows code execution.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-78683},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-78683/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.