npm
CVE-2026-139877
mysql2 before 3.25.0 SQL Injection via Placeholder Escaping under NO_BACKSLASH_ESCAPES
- Severity
- Critical 9.1
- Published
- 30 Nov 2026
- Last changed
- 30 Nov 2026
- Added to UpHeron
- 30 Nov 2026
- Fixed in
- 3.25.0
- Weakness
- SQL injection (CWE-89)
- Attack
- Over the network · Only under certain conditions · No login needed · No user action needed
- Attacker can
- Read data · Change data
- CVSS vector
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N- Sources
- CVE Program
Description
mysql2 before 3.25.0 contains an sql injection vulnerability in Connection.format() and Connection.escape() because quotes are always backslash-escaped regardless of session SQL mode. When NO_BACKSLASH_ESCAPES is enabled, attackers can pass crafted values through ? placeholders in connection.query() to close string literals and append SQL, disclosing or modifying data.
Affected software
| Software | Affected versions |
|---|---|
mysql2npm · osv:npm:mysql2 |
|
About mysql2
- Weekly downloads (npm)
- 23,547,995npm, 30 Nov 2026
This is the only vulnerability in mysql2 in our list.
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-139877