CVE-2022-42964 Exponential ReDoS in pymatgen leads to denial of service
An attacker can cause denial of service in pymatgen by supplying malicious input to the GaussianInput.from_string method, triggering exponential regex backtracking.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-42964?
CVE-2022-42964 is a medium-severity denial of service vulnerability in pymatgen, published on 9 Nov 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An exponential ReDoS (Regular Expression Denial of Service) can be triggered in the pymatgen PyPI package, when an attacker is able to supply arbitrary input to the GaussianInput.from_string method
Weakness: CWE-1333
Which versions are affected by CVE-2022-42964?
3 open source packages ship an affected version, including pymatgen. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
pymatgen PyPI | All versions to 2022.9.21 | None |
pymatgen PyPI | All versions to 2022.9.21 | None |
pymatgen PyPI | All versions | 2025.10.7 |
Products include Materialsvirtuallab Pymatgen.
How do I fix CVE-2022-42964?
Upgrade pymatgen to 2025.10.7 or later.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2022-42964 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-42964 exists.
Other vulnerabilities in pymatgen
Sources
Also known as DEBIAN-CVE-2022-42964, GHSA-5jqp-885w-xj32, PYSEC-2026-909, UBUNTU-CVE-2022-42964.