CVE-2024-21511 MySQL2 for Node Arbitrary Code Injection

Critical 9.8 Published Updated

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.

PackageAffectedFixed in
mysql2 npmAll versions3.9.7
mysql2 npmAll versions3.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.

Is CVE-2024-21511 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free