CVE-2024-21511
JavaScript vulnerability analysis and mitigation

Overview

CVE-2024-21511 affects versions of the mysql2 package before 3.9.7. The vulnerability is related to Arbitrary Code Injection due to improper sanitization of the timezone parameter in the readCodeFor function when calling a native MySQL Server date/time function. The vulnerability was discovered by zhaoyudi from Nebulalab and disclosed on April 21, 2024 (Snyk Report, GitHub Release).

Technical details

The vulnerability exists because the node-mysql2 library allows the first argument passed to the connection query function to be a string containing the query, but this argument is not validated correctly. This allows users to pass objects instead of strings. The library generates a parsing function for every query, which is usually cached for optimization purposes. The vulnerability specifically relates to the improper sanitization of the timezone parameter, which could be exploited to inject arbitrary code. The vulnerability has been assigned a CVSS v3.1 score of 9.8 (Critical) (Snyk Report).

Impact

The vulnerability could lead to a complete compromise of system confidentiality, integrity, and availability. An attacker could potentially execute arbitrary code on the affected system, leading to unauthorized access to sensitive information, modification of data, or disruption of services (Snyk Report).

Exploitability

The vulnerability is remotely exploitable without requiring authentication or user interaction. Snyk has confirmed the existence of a proof-of-concept exploit. The exploit involves manipulating the timezone parameter in SQL queries to inject malicious code that can be executed on the target system (Snyk Report, Security Online).

Mitigation and workarounds

The vulnerability has been patched in mysql2 version 3.9.7. Users are strongly recommended to upgrade to this version or later to address the security issue. The fix involves proper sanitization of the timezone parameter value to prevent code injection (GitHub Release, GitHub PR).

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-54155HIGH7.7
  • JavaScript logoJavaScript
  • node-opcua
NoNoAug 20, 2026
CVE-2026-54156HIGH7.5
  • JavaScript logoJavaScript
  • node-opcua
NoYesAug 20, 2026
CVE-2026-55451MEDIUM6.9
  • JavaScript logoJavaScript
  • gettext-converter
NoYesAug 20, 2026
CVE-2026-54150MEDIUM6.9
  • JavaScript logoJavaScript
  • next-video
NoYesAug 20, 2026
GHSA-ghvf-qf6h-g8x5HIGHN/A
  • JavaScript logoJavaScript
  • @nocobase/server
NoYesAug 20, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management