{"answers":{"affected":"3 open source packages ship an affected version, including pymatgen. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-23346 exists.","fix":"Upgrade pymatgen to 2024.2.20 or later.","what":"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."},"fix_prompt":"Check this codebase for CVE-2024-23346 and fix it if it is affected.\n\nWhat it is: 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.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-23346 exists.\n\nAffected packages and fixed versions:\n- pymatgen (PyPI): affected all versions; fixed in 2024.2.20\n- pymatgen (PyPI): affected all versions; fixed in 2024.2.20\n- pymatgen (PyPI): affected all versions; fixed in 2024.2.20\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-23346/ (Markdown: https://insights.sbomify.com/CVE-2024-23346/index.md)","id":"CVE-2024-23346","markdown":"https://insights.sbomify.com/CVE-2024-23346/index.md","name":"CVE-2024-23346","record":{"aliases":["DEBIAN-CVE-2024-23346","DSA-5763-1","GHSA-vgv8-5cpj-qj2f","PYSEC-2024-226","UBUNTU-CVE-2024-23346"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Python materials analysis library","requires_auth":"none","summary":"Attackers can execute arbitrary code by providing a malicious transformation string to the pymatgen library's parsing method.","user_interaction":"not_required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"pymatgen","vendor":"materialsvirtuallab"}],"cvss":{"score":9.4,"severity":"critical","source":"cna","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-77","name":"Improper Neutralization of Special Elements used in a Command"}],"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.","ecosystems":["PyPI"],"exploits":{"exploitdb":1,"first_seen":"2024-11-05","github_poc":5,"max_poc_stars":4,"metasploit":0,"nuclei":0,"refs":[{"date":"2025-07-24T18:12:42Z","kind":"github_poc","ref":"https://github.com/DAVIDAROCA27/CVE-2024-23346-exploit","stars":4,"title":"This is a exploit for the known Remote Code Execution (RCE) vulnerability in the `pymatgen` (CVE-2024-23346) Python library by uploading a malicious `CIF` file to the hosted `CIF Analyzer` website on the target running on the Chemistry machine from Hack the Box."},{"date":"2024-11-05T14:27:06Z","kind":"github_poc","ref":"https://github.com/9carlo6/CVE-2024-23346","stars":3,"title":"This repository contains a Crystallographic Information File (CIF) intended for use on the \"Chemistry\" machine on Hack The Box (HTB)."},{"date":"2025-02-20T12:23:43Z","kind":"github_poc","ref":"https://github.com/Sanity-Archive/CVE-2024-23346","stars":2,"title":"PoC of the vulnerability CVE-2024-23346"},{"date":"2024-12-09T22:34:44Z","kind":"github_poc","ref":"https://github.com/MAWK0235/CVE-2024-23346","stars":0,"title":"This is an exploit for CVE-2024-23346 that acts as a \"terminal\" (tested on chemistry.htb)"},{"date":"2025-02-25T14:52:28Z","kind":"github_poc","ref":"https://github.com/szyth/CVE-2024-23346-rust-exploit","stars":0,"title":"A Rust exploit for CVE-2024-23346 that functions as a \"terminal\" (tested on chemistry.htb)"},{"date":"2025-04-15","kind":"exploitdb","ref":"52205","stars":null,"title":"Pymatgen 2024.1 - Remote Code Execution (RCE)"}],"tier":"weaponised"},"has_fix":true,"headline":"pymatgen arbitrary code execution when parsing a maliciously crafted JonesFaithfulTransformation transformation_string","id":"CVE-2024-23346","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"code_injection","year":"2024"},"n_packages":3,"n_references":3,"next":{"headline":"Code injection in Meta Spark Studio","id":"CVE-2024-23347"},"packages":[{"ecosystem":"PyPI","fixed":["2024.2.20"],"introduced":["0"],"last_affected":[],"package":"pymatgen","purl":null,"source":"GHSA-vgv8-5cpj-qj2f"},{"ecosystem":"PyPI","fixed":["2024.2.20"],"introduced":["0"],"last_affected":[],"package":"pymatgen","purl":"pkg:pypi/pymatgen","source":"GHSA-vgv8-5cpj-qj2f"},{"ecosystem":"PyPI","fixed":["2024.2.20"],"introduced":["0"],"last_affected":[],"package":"pymatgen","purl":"pkg:pypi/pymatgen","source":"PYSEC-2024-226"}],"prev":{"headline":"Nautobot has XSS potential in rendered Markdown fields","id":"CVE-2024-23345"},"products":["pymatgen"],"published":"2024-02-21","related":[{"cvss_score":5.9,"headline":"Exponential ReDoS in pymatgen leads to denial of service","id":"CVE-2022-42964","kev_date_added":null,"published":"2022-11-09"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"attribution","licence":"GPL-2.0-or-later","name":"Exploit-DB"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-08-19","vendors":["materialsproject"]},"summary":"Attackers can execute arbitrary code by providing a malicious transformation string to the pymatgen library's parsing method.","url":"https://insights.sbomify.com/CVE-2024-23346/"}