All posts

Critical vulnerability

Critical SQL injection in mysql2 (CVE-2026-139877)

SQL injection in mysql2 · 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
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

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.

From the CVE Program.
SoftwareAffected versions
mysql2npm
  • Every version before 3.25.0
  • CVE.org https://www.cve.org/CVERecord?id=CVE-2026-139877
Everything about CVE-2026-139877

From NVD, the CVE Program, OSV.dev with the GitHub Advisory Database, WPVulnerability, WordPress's security advisories and CISA's Known Exploited Vulnerabilities catalog, as they stood when this was written. Each vulnerability's own page has its latest rating and fix. This product uses the NVD API but is not endorsed or certified by the NVD.