CVE-2024-23346 pymatgen arbitrary code execution when parsing a maliciously crafted JonesFaithfulTransformation transformation_string

Critical 9.4 Published Updated

Attackers can execute arbitrary code by providing a malicious transformation string to the pymatgen library's parsing method.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-23346?

CVE-2024-23346 is a critical code injection vulnerability in materialsproject pymatgen, published on 21 Feb 2024. It can only be exploited from the same machine or local network, with no action from the victim.

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

Weakness: CWE-77

Which versions are affected by CVE-2024-23346?

3 open source packages ship an affected version, including pymatgen. It affects 1 product.

PackageAffectedFixed in
pymatgen PyPIAll versions2024.2.20
pymatgen PyPIAll versions2024.2.20
pymatgen PyPIAll versions2024.2.20

Products include Materialsvirtuallab Pymatgen.

How do I fix CVE-2024-23346?

Upgrade pymatgen to 2024.2.20 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2024-23346 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-23346 exists.

Public exploit code: 1 Exploit-DB entry and 5 proofs of concept on GitHub.

Sources

Also known as DEBIAN-CVE-2024-23346, DSA-5763-1, GHSA-vgv8-5cpj-qj2f, PYSEC-2024-226, UBUNTU-CVE-2024-23346.

Is CVE-2024-23346 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free