Read the docs

SQL injection in mysql2 placeholder escaping under NO_BACKSLASH_ESCAPES

Priority MEDIUM 54CWE-89Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
High
Attack requirements
Present
Impact type
SQL injection
Confidentiality · integrity · availability
High · High · None
Fix status
Fixed

Attack profile from CVSS 4.0 · CNA. Fix status from CNA. Impact type from CWE-89.

Summary

The mysql2 package before 3.25.0 contains an SQL injection flaw in Connection.format() and Connection.escape(), which always backslash-escape quotes regardless of the session SQL mode. When NO_BACKSLASH_ESCAPES is enabled, an unauthenticated remote attacker can pass crafted values through positional placeholders in connection.query() to close string literals and append SQL, which can disclose or modify data. This is tracked as CWE-89.

Written with Claude Haiku 5.5 from the sources below · 2026-12-01

Description from the CNA

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.

Why it matters now

Fix Fixed mysql2 (sidorares): 3.25.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
sidoraresmysql2before 3.25.03.25.0Patch availableCNA
  • mysql2 Vendorsidorares Affected before 3.25.0 Fixed in 3.25.0 Patch available CNA

Remediation

Upgrade mysql2 to version 3.25.0.

Written with Claude Haiku 5.5 from the sources below · 2026-12-01

  • Fix · CNA mysql2 (sidorares) Fixed in 3.25.0

Timeline

  1. 2026-11-30 Threatist record created from CVE-2026-139877
  2. 2026-11-30 Alias added: GHSA-fx9j-5664-pqx4

References

  • TI-2024-14265 Prototype pollution in mysql2 CVSS 3.1MEDIUM 6.5
  • TI-2024-14263 Improper input validation in mysql2 CVSS 3.1MEDIUM 6.5

Sources