CVE-2024-21509 mysql2 vulnerable to Prototype Poisoning

Medium 6.5 Published Updated

Prototype poisoning in mysql2 allows attackers to execute arbitrary code via insecure object creation and input sanitization flaws.

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-21509?

CVE-2024-21509 is a medium-severity code injection vulnerability in mysql2, published on 10 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 Prototype Poisoning due to insecure results object creation and improper user input sanitization passed through parserFn in text_parser.js and binary_parser.js.

Weakness: CWE-1321

Which versions are affected by CVE-2024-21509?

2 open source packages ship an affected version, including mysql2. It affects 1 product.

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

Products include Sidorares Mysql2.

How do I fix CVE-2024-21509?

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-21509 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21509 exists.

Sources

Also known as CLSA-2026-1786373168, GHSA-49j4-86m8-q2jw, ROOT-APP-NPM-CVE-2024-21509.

Is CVE-2024-21509 in your software?

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

Check your SBOMs for free