CHGNet torch.load weights_only=False allows code execution via crafted model files
Article Content
- •CHGNet.from_file() calls torch.load with weights_only=False, allowing arbitrary code execution when a crafted model file is loaded.
- •Delivery is local and requires the victim to load the attacker-supplied file.
- •A pull request passing weights_only=True at four loading sites is published alongside the report.
- •The fix is described as rejecting non-allowlisted objects, which may break legacy checkpoints that contain numpy arrays or custom classes.
- •No CVE, CVSS score, or in-the-wild exploitation is reported in these sources.
A GitHub issue reports that CHGNet.from_file(path) calls torch.load(path, weights_only=False), so loading an attacker-supplied CHGNet model file can run arbitrary code as the user via a pickle __reduce__ gadget during the load.
The reporter states the flaw is reached when a victim loads a file locally, and that the same flaw exists in other loads without the flag (trainer.py and crystalgraph.py), which are restricted only on torch 2.6 and later.
The reporter tested with chgnet 0.4.2 and torch 2.15.0+cpu, using a benign payload that ran id and wrote a marker file.
A separate GitHub pull request, published the same day, passes weights_only=True explicitly at four loading sites in CHGNet.from_file, Trainer.load, the best-checkpoint reload in Trainer.train, and CrystalGraph.from_file.
That PR states it adds tests/test_safe_loading.py confirming crafted payloads are rejected at three entry points, and that the three bundled pretrained models still load.
The PR notes that legacy checkpoints containing non-allowlisted objects (numpy arrays, custom classes) are now refused, with torch.serialization.add_safe_globals() as the stated workaround. Neither source reports exploitation in the wild, a CVE identifier, or a CVSS score.
Ask AI about this cluster
Answers cite the sources they use
Timeline
More articles in this cluster (2)
Common questions
Am I affected?
How urgent is this?
What should I do?
Continue Reading
React Server Components RCE Vulnerability CVE-2025-55182 Disclosed and Patched A critical unauthenticated remote code execution vulnerability, CVE-2025-55182, exists in React Server Components, reported by Lachlan Davidson on November 29 and rated CVSS 10.0. The flaw lies in how React decodes payloads sent to React Server Function endpoints. Vulnerable versions are 19.0, 19.1.0, 19.1.1, and…
Critical WP Rocket Path Traversal RCE (CVE-2026-125812) Under Active Exploitation CVE-2026-125812 is a path traversal flaw in the WP Rocket WordPress caching plugin, fixed in version 3.24.2, that allows unauthenticated remote code execution. Patchstack scores it CVSS 3.1 9.8 and says every release before 3.24.2 is affected; WP Media states the plugin is installed on more than 5.6 million sites. The…