CVE-2024-23346CWE-77

pymatgen arbitrary code execution when parsing a maliciously crafted JonesFaithfulTransformation transformation_string

Critical · published February 21, 2024

CVSS v3.1
9.4
EPSS
4%
Percentile
90.1
In the wild
Unconfirmed
What it is

🔥 A critical pitfall lies in Pymatgen's `from_transformation_str()` method! This open-source library is letting a sneaky use of `eval()` slip into the mix, allowing attackers to execute arbitrary code like it's a hot new recipe! Think of it as a restaurant that accepts any handwritten order without checking the ingredients — if a clever customer submits a recipe for chaos, the kitchen will cook it right up! This vulnerability could lead to an attacker injecting malicious code that runs with the same privileges as the application. It's a recipe for disaster, potentially allowing unauthorized access to sensitive data or manipulation of the system, making it absolutely devastating for anyone using this library!

Put simply

Think of it as a restaurant that accepts any handwritten order without checking the ingredients — if a clever customer submits a recipe for chaos, the kitchen will cook it right up! The issue stems from the insecure use of `eval()` within the `from_transformation_str()` method, which processes untrusted input without proper validation, thereby allowing arbitrary code execution.

What to do

This vulnerability could lead to an attacker injecting malicious code that runs with the same privileges as the application. It's a recipe for disaster, potentially allowing unauthorized access to sensitive data or manipulation of the system, making it absolutely devastating for anyone using this library! To mitigate this vulnerability, update Pymatgen to version 2024.2.20 or later immediately. Additionally, review your code to ensure that untrusted inputs are handled securely without relying on `eval()`. Regular audits of your libraries can also help prevent future issues! You've got this! With a quick update, you'll be back to securely analyzing materials in no time! 🛡️

The record
Technical detail
CVSS v3.1
9.4 · CRITICAL
Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.03848 · 90.1th percentile
Weakness
CWE-77 · Improper Neutralization of Special Elements used in a Command ('Command Injection')
Published
2024-02-21T16:13Z
EPSS history
Timeline
  • 21 FEB 16:13Z
    pymatgen arbitrary code execution when parsing a maliciously crafted JonesFaithfulTransformation transformation_string
    cvelistv5