CVE-2024-21511 MySQL2 for Node Arbitrary Code Injection
An attacker can execute arbitrary code via improper sanitization of the timezone parameter in the mysql2 library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-21511?
CVE-2024-21511 is a critical code injection vulnerability in mysql2, published on 23 Apr 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Versions of the package mysql2 before 3.9.7 are vulnerable to Arbitrary Code Injection due to improper sanitization of the timezone parameter in the readCodeFor function by calling a native MySQL Server date/time function.
Weakness: CWE-94
Which versions are affected by CVE-2024-21511?
2 open source packages ship an affected version, including mysql2.
| Package | Affected | Fixed in |
|---|---|---|
mysql2 npm | All versions | 3.9.7 |
mysql2 npm | All versions | 3.9.7 |
How do I fix CVE-2024-21511?
Upgrade mysql2 to 3.9.7 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2024-21511 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21511 exists.
Sources
Also known as GHSA-4rch-2fh8-94vw, ROOT-APP-NPM-CVE-2024-21511.