SQL injection in mysql2 placeholder escaping under NO_BACKSLASH_ESCAPES
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
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
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
- 2026-11-30 Threatist record created from CVE-2026-139877
- 2026-11-30 Alias added: GHSA-fx9j-5664-pqx4
References
More sidorares vulnerabilities
- 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
- CVE-2026-139877 · CVE Program
- CVE-2026-139877 · NVD
- GHSA-fx9j-5664-pqx4 · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences