﻿# Lightning CVE-2026-31221: checkpoint paths and omitted restrictions

The Lightning advisory gives no patched release. Tagged source exposes weights_only but treats an omitted value differently for HTTP checkpoint loading.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/lightning-cve-2026-31221-checkpoint-url-weights-only-default/
Language: en

## The advisory describes a wrapper-level trust decision

CVE-2026-31221 concerns Lightning checkpoint deserialization. The [reviewed advisory](https://github.com/advisories/GHSA-75m9-98v2-hjpm) lists PyTorch Lightning versions through 2.6.0 as affected and gives no patched version. Its stated problem is that `load_from_checkpoint` can reach unrestricted object deserialization without enforcing `weights_only=True`. This is distinct from a bypass inside PyTorch's restricted unpickler.

The recorded absence of a patched version should remain visible. It does not establish that every later release has identical behavior, nor does the existence of a newer package alone establish remediation. A useful review compares the recorded issue with the particular API and path actually used by the application.

## The inspected release exposes an explicit restriction argument

The [current API reference](https://lightning.ai/docs/pytorch/stable/optional-api/api/lightning.pytorch.core.LightningModule) documents `weights_only` separately from `strict` and `map_location`. Strict loading concerns agreement between state-dictionary keys; map location concerns storage placement. Those options do not substitute for the deserialization restriction.

The [tagged saving implementation](https://raw.githubusercontent.com/Lightning-AI/pytorch-lightning/2.6.6/src/lightning/pytorch/core/saving.py) in release 2.6.6 forwards the selected restriction argument into the shared loader before checkpoint migration and module-state reconstruction. Thus the incoming claim should not be expanded into an assertion that the inspected API provides no way to request restricted loading.

For compatibility work, preserve the model class and expected checkpoint content alongside the argument. An archive with saved application objects may have different restoration requirements from a dictionary of plain tensors. If restriction produces a compatibility failure, that outcome should be recorded rather than automatically retried with a broader permission.

## URL handling changes the meaning of an omitted value

The [same release's shared loader](https://raw.githubusercontent.com/Lightning-AI/pytorch-lightning/2.6.6/src/lightning/fabric/utilities/cloud_io.py) has a concrete branch worth reviewing: for an HTTP path, an omitted `weights_only` value is replaced with `False` before calling the URL loader. File-like and filesystem paths forward the supplied value to `torch.load`. Therefore an unspecified option cannot be summarized as one uniform behavior independent of artifact source.

This source inspection does not by itself identify the official first fixed release for the CVE. It does identify a reviewable condition in the selected code. Record whether the application supplies a URL, a filesystem path or an already opened object, and whether its wrapper explicitly supplies the restriction. A copied high-level example can conceal that difference even when the visible method name is unchanged.

## Make the acceptance record cover every restoration stage

A defensible record links the accepted checkpoint digest, Lightning and PyTorch builds, source kind and effective arguments. Include preparatory conversion and evaluation programs, since a file can be restored before reaching the final inference service. Separate a rejected unsupported object from corrupted delivery or a missing tensor.

The [artifact-validation guide](/journal/safetensors-artifact-validation/) explains why format and executable reconstruction need separate judgments. The [environment guide](/journal/software-stack-reproducibility/) supports preserving the concrete caller and library versions. This article reviewed the advisory and tagged source without executing an untrusted checkpoint, testing an exploit or certifying an installed system as unaffected.
