CVE-2024-21508 mysql2 Remote Code Execution (RCE) via the readCodeFor function

Critical 9.8 Published Updated

An attacker can execute arbitrary code by exploiting improper validation of specific configuration options 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-21508?

CVE-2024-21508 is a critical code injection vulnerability in mysql2, published on 11 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.4 are vulnerable to Remote Code Execution (RCE) via the readCodeFor function due to improper validation of the supportBigNumbers and bigNumberStrings values.

Weakness: CWE-94

Which versions are affected by CVE-2024-21508?

2 open source packages ship an affected version, including mysql2.

PackageAffectedFixed in
mysql2 npmAll versions3.9.4
mysql2 npmAll versions3.9.4

How do I fix CVE-2024-21508?

Upgrade mysql2 to 3.9.4 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2024-21508 being exploited?

There is no known exploitation of CVE-2024-21508 in the wild and no public exploit code.

Sources

Also known as GHSA-fpw7-j2hg-69v5, ROOT-APP-NPM-CVE-2024-21508.

Is CVE-2024-21508 in your software?

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

Check your SBOMs for free