Security Digest · Vulnerability record

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

Pymatgen (Python Materials Genomics) is an open-source Python library for materials analysis.

CVSS 9.4 Critical EPSS 3.8% · p90

Should you act?

Critical, preconditions apply

Severe if exploited, but exploitation needs conditions that may not apply to you. This signal is computed from CISA KEV, EPSS and CVSS data; it is not an editorial verdict.

  • Not in CISA KEV, but CISA’s SSVC assessment records a public proof-of-concept, so attack code exists.
  • EPSS 3.8%, percentile 90: FIRST’s model estimates a 3.8% chance of exploitation activity in the next 30 days, higher than 90% of all scored CVEs (elevated). EPSS is a probability, not a verdict.
  • Needs local access needed. Lower urgency for most teams unless an attacker could already run code on the machine.
  • Only applies if your dependency tree includes pymatgen (PyPI) < 2024.2.20, fixed in 2024.2.20. Check your lockfile, including transitive dependencies.

What it is

Pymatgen (Python Materials Genomics) is an open-source Python library for materials analysis. A critical security vulnerability exists in the JonesFaithfulTransformation.fromtransformationstr() 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.

From the GitHub advisory

Summary A critical security vulnerability exists in the JonesFaithfulTransformation.fromtransformationstr() method within the pymatgen library. This method insecurely utilizes eval() for processing input, enabling execution of arbitrary code when parsing untrusted input. This can be exploited when parsing a maliciously-created CIF file.

Details The cause of the vulnerability is in pymatgen/symmetry/settings.py#L97C1-L111C108. The flawed code segment involves a regular expression operation followed by the use of eval().

Vulnerable code

The use of eval, even with builtins set to None, is still a security risk. The BuiltinImporter class can be recovered with subclass traversal.

PoC

Weakness type: CWE-77.

Product: pymatgen (PyPI) · Assigned by: GitHub_M · Published: 2024-02-21

Affected and fixed versions

EcosystemPackageVulnerableFirst fixed
PyPIpymatgen< 2024.2.202024.2.20
VendorProductAffected versions (per CVE record)
materialsprojectpymatgen< 2024.2.20

Severity scores

Scored byCVSSScoreVector
GitHub_M3.19.4 CriticalCVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
GitHub3.19.3 CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
  • Attack vector: local access needed
  • Attack complexity: low
  • Privileges required: none (no login)
  • User interaction: none
  • Scope: changed (can affect other components)

CVSS measures how bad a flaw is if exploited, not how likely exploitation is. Read it next to the exploitation data below.

Exploitation and urgency

  • CISA KEV: not listed (no confirmed in-the-wild exploitation known to CISA).
  • CISA SSVC assessment: exploitation poc, automatable no, technical impact total.
  • FIRST EPSS (model of 2026-10-21): 3.82% probability of exploitation activity in the next 30 days; percentile 90.

Timeline

  • — CVE record published by GitHub_M
  • — GitHub-reviewed advisory GHSA-vgv8-5cpj-qj2f published (critical)
  • — CVE record last updated

Sources and references

Original sources first. Version and fix details should always be confirmed against the vendor or project advisory.

Vulnerability records

  1. GitHub Advisory GHSA-vgv8-5cpj-qj2f github.com
  2. CVE.org record CVE-2024-23346 cve.org
  3. NVD entry CVE-2024-23346 nvd.nist.gov

Other references from the CVE record and advisory

  1. github.com github.com
  2. github.com github.com
  3. github.com github.com
  4. vicarius.io vicarius.io
  5. github.com github.com

Critical PyPI advisories · Today’s Security Digest