CVE-2026-139877

7.4High

Published Nov 30, 2026 · NVD status: Received · AI triage by gemini-3.1-flash-lite

7.4CVSS

High

0CVSS v3.110

Attack vector
Network
Complexity
High
Privileges
None
User action
None
Impact
High impact on confidentiality, integrity
Weakness
CWE-89

What an attacker gets

Remote attackers can inject arbitrary SQL commands to read or modify database data. This requires the application to use the NO_BACKSLASH_ESCAPES SQL mode.

Root cause

The library incorrectly escapes quotes using backslashes even when the database session is configured with NO_BACKSLASH_ESCAPES.

Affected versions

mysql2 before 3.25.0

CVSS v3.1 · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Fix & remediation

Upgrade to mysql2 version 3.25.0 or later. If you cannot upgrade, disable the NO_BACKSLASH_ESCAPES SQL mode in your database configuration.

remediation — bash
$ npm install mysql2@latest

AI-suggested. Run it in staging first and check it against the vendor advisory. Why?

NVD 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.

References

Source: nvd.nist.gov/vuln/detail/CVE-2026-139877

More fully triaged vulnerabilities you may want to check next.