CHGNet model files become code execution paths when torch.load trusts the archive
Machine-learning teams often treat a model checkpoint like data. In a Python environment that uses pickle-backed PyTorch loading, a checkpoint is executable input. CVE-2026-138444 affects CHGNet through version 0.4.2 because CHGNet.from_file() calls torch.load() with weights_only=False. A crafted .pth.tar file can contain a pickle __reduce__ gadget and run code with the privileges of the user who opens it.
The CVE record assigns a CVSS 4.0 score of 8.4 and describes local attack access with user interaction. That matches the usual workflow: a researcher downloads a model, receives an attachment, or pulls an artifact from a shared storage bucket, then asks CHGNet to load it. The attack does not need a remote service listening for requests. It needs the victim to process an untrusted archive.
The affected call is especially important because model files travel through informal channels. A file may be copied from a paper repository, a colleague's training run, an experiment tracker, or a public object store. The suffix and the directory name do not establish trust. A .pth.tar container can hold ordinary tensors and a malicious pickle payload in the same archive. Loading the file is enough to trigger the payload before the application inspects the model.
CHGNet's repository published a fix in commit 5403c44c6c1ac053010252988da77dc14e7c811c. Teams should verify that their installed revision includes the change. Where the loader cannot enforce weights_only=True, use the documented safe-loading path and reject unknown serializers. Do not patch a local copy by changing a file extension or wrapping the loader in a retry. Those actions do not remove the deserialization primitive.
The practical control is provenance. Store model hashes next to training metadata. Require a signed or internally mirrored artifact for production jobs. Separate the account that downloads models from the account that holds cloud credentials. Run model conversion and evaluation in a disposable container with a read-only base image, a constrained filesystem, and no access to the host's SSH agent or cloud metadata endpoint.
Code scanning has a role, but it cannot prove that every archive is safe. A dependency scanner may alert on the known vulnerable package version. An artifact registry can show who uploaded a file. Neither control evaluates every pickle opcode before the process runs. The runtime should assume that model parsing is an untrusted operation and place it behind the same kind of boundary used for document converters and media parsers.
Incident response should include artifact birth time and access history. If a bad model was opened, identify the Python process, its user identity, the working directory, inherited environment, and network sessions that began during loading. Review credentials available to that process and rotate any that could be read from memory or the filesystem. Search for new files in the model cache, startup directories, and shell history. The source archive and the Python environment are evidence and should be preserved before cleanup.
For research teams, the least disruptive fix is a safe loader with explicit support for weights-only checkpoints. Test it against legacy files and document the conversion process. Unknown archives should fail closed and return a clear error. A model-quality review is not a security review. The loader must decide whether the file format is allowed before the checkpoint can execute any Python.
Top comments (0)