Vulnerability in mysql Node.JS Module: Remote Memory Exposure
Summary
GHSA-5f7m-mmpc-qhh4: mysql Node.JS Module Vulnerable to Remote Memory Exposure. Affects mysql versions >= 2.0.0-alpha8, < 2.14.0. Fixed in 2.14.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The mysql Node.js module is a popular package used for connecting to MySQL databases from Node.js applications. It provides a convenient way to interact with MySQL databases and execute queries. However, versions of the mysql package before 2.14.0 are vulnerable to remote memory exposure.
Vulnerability Detail
The vulnerability in the mysql Node.js module occurs when a number is provided as a password. Affected versions of the package allocate and send uninitialized memory over the network, potentially exposing sensitive information. This vulnerability only affects mysql running on Node.js versions below 6.0.0, as newer versions of Node.js have added a throw to prevent this issue.
How To Fix
Latest published version: 2.18.1 as of 22 Oct 2026
npm install mysql@2.18.1
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.14.0
This is the first release that contains the fix.
npm install mysql@2.14.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating the mysql package is not immediately possible, a workaround can be implemented by ensuring that the password provided is not a number. This can be achieved by converting the password to a string before passing it to the mysql module. Here is an example of a workaround code snippet:
const password = String(USERPROVIDEDINPUT);
require('mysql').createConnection({
host: 'localhost',
user: 'user',
password: password,
database: 'my_db'
}).connect();
Conclusion
The mysql Node.js module versions before 2.14.0 are vulnerable to remote memory exposure when a number is provided as a password. It is recommended to update to version 2.14.0 or later to fix this vulnerability. If immediate update is not possible, a workaround can be implemented by converting the password to a string. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for mysql →
FAQ
Versions of the mysql package before 2.14.0 are affected by this vulnerability.
The vulnerability can potentially expose uninitialized memory over the network, which may contain sensitive information.
No, only Node.js versions below 6.0.0 are affected. Newer versions of Node.js have added a throw to prevent this issue.
Yes, updating to version 2.14.0 or later of the mysql package will fix this vulnerability.
If updating the mysql package is not possible, a workaround can be implemented by converting the password to a string before passing it to the mysql module.
References
Related vulnerabilities
Recent vulnerabilities recorded for mysql.